gotwarlost / istanbul

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.
Other
8.7k stars 786 forks source link

Bug with using underscores in folder names #640

Closed vuk closed 5 years ago

vuk commented 8 years ago

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