Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
I'm using Mocha with Istanbul and I have a module loaded globally to Mocha with --require test/common
In package.json I have posttest script that runs Istanbul to generate coverage report.
istanbul cover node_modules/mocha/bin/_mocha -- -R spec --recursive
Now, I tried to organize my tests to follow my app folder structure. So i have something like this
-- app
------ __lib__
------ another folder
So this structure should be followed in test folder also.
But when I add files to lib folder I get an error about global.my_helper that I've loaded from common module saying Object #<Object> has no method 'my_helper'.
When I rename __lib__ to lib everything goes as expected.
Also Mocha passes all tests even with __lib__, but Istanbul crashes and doesn't generate coverage report
I'm using Mocha with Istanbul and I have a module loaded globally to Mocha with
--require test/common
In package.json I have posttest script that runs Istanbul to generate coverage report.istanbul cover node_modules/mocha/bin/_mocha -- -R spec --recursive
Now, I tried to organize my tests to follow my app folder structure. So i have something like this
So this structure should be followed in test folder also. But when I add files to lib folder I get an error about
global.my_helper
that I've loaded fromcommon
module sayingObject #<Object> has no method 'my_helper'
.When I rename
__lib__
tolib
everything goes as expected.Also Mocha passes all tests even with
__lib__
, but Istanbul crashes and doesn't generate coverage report