I\'m having some issues while running istanbul with mocha and the babel compiler..
all my tests are runnning just fine, but after all the tests done it shows me this
As of now 17.4.2016 this coverage reporting stuff is still a bit messy and with my React-project that has .jsx files and a helper file the coverage reporting script looks like this:
istanbul cover node_modules/mocha/bin/_mocha -- \
--compilers js:babel-core/register \
--require ./test/testhelper.js \
\"test/**/*@(.js|.jsx)\"
So it wouldn't be too easy the current version 0.4.3 of Istanbul doesn't work with Babel so you have to use the experimental alpha-version:
npm install istanbul@1.0.0-alpha.2 --save-dev
And then you need .istanbul.yml -file so that Istanbul recognizes the .jsx-files with these lines:
instrumentation:
root: .
extensions: ['.js', '.jsx']
And now it should work. Also as a small bonus if you want to add coverage reporting with Travis and Coveralls you should:
npm i coveralls --save-devadd this to your .travis.yml:
script:
- npm --silent test
- cat ./c
coverage/lcov.info | coveralls
And now you can put that cool badge to your README. Neato!