I am trying to generate coverage metrics for a git project:
Here is the sample repo:
https://github.com/imvetri/JS-coverage
my.conf.js
files: [ 'base/*.js', 'src/*.js', 'test/spec/*.js' ]
Executing the test:
npm test
[email protected] test /Users/valappip/Downloads/coverage-jasmine-istanbul-karma-master
node_modules/.bin/karma start my.conf.js
INFO [karma]: Karma v0.10.10 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Mac OS X)]: Connected on socket 70e_eJb6AVI-1iy4f_F9
PhantomJS 1.9.8 (Mac OS X) ERROR
ReferenceError: Can't find variable: base
at /Users/valappip/Downloads/coverage-jasmine-istanbul-karma-master/base/base-base.js:6
PhantomJS 1.9.8 (Mac OS X): Executed 0 of 0 ERROR (0.03 secs / 0 secs)
npm ERR! weird error 1
npm ERR! not ok code 0
If I change the my.conf.js files to,
files: [ 'base/base.js', 'base/base-base.js', 'src/*.js' 'test/spec/*.js', ]
Then it gives the report. But in my actual project there are lots of JS files so I cannot add one by one. Is there any way I can include all files at once? Or can I load a dependency before the test starts?
You could try the following
The other option is to look at your code and ensure you are not depending in this way from one file to the other. As this sounds that the actual issues is somewhere in your code.