TypeScript Karma Jamsine Test "no export defined" with simpletsc preprocessor
To learn how to create my own NPM module, I first try to create a simple NPM module written in TypeScript that will simply provide an interface and a class that has a very simple sayHi () method that just returns "Hello World". I wanted to try creating a module so that I can put it in an Angular 2 app using NPM and then try calling the method.
The build in the dist folder works fine and can be pasted into the sample Angular 2 app and used without issue.
I wanted to make sure my code was tested, so I tried adding a Karma spec runner using the Jasmine framework. I followed the Karma installation guide and initialized my Karma.conf.js and finally I added a Simple TSC preprocessor to handle TypeScript files. The problem is, when I run the test, I get the following error:
Chrome 56.0.2924 (Windows 10 0.0.0) ERROR
Uncaught ReferenceError: exports is not defined
at index.js:10
All code and settings can be found on GitHub at https://github.com/holotrek/hello-world-npm-module
source to share
No one has answered this question yet
Check out similar questions: