1

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

coverage-jasmine-istanbul-karma@0.0.1 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?

gariepy
  • 3,576
  • 6
  • 21
  • 34
uICoDEr
  • 11
  • 2

1 Answers1

0

You could try the following

files: [ 'base/base.js', 'base/*.js', 'src/*.js' 'test/spec/*.js']

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.

dignifiedquire
  • 1,360
  • 9
  • 14
  • Thanks alot! , I have lot of files like this in folder with same level dependency. In browser I include these files in correct order so i am not facing this problem in application. Is it something i can load all the files first after that can i start test? Any other lib or any work arround i can do for this? – uICoDEr Feb 13 '16 at 17:30