jeffrifwald / babel-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
144 stars 23 forks source link

mocha options #57

Closed fpaxton closed 8 years ago

fpaxton commented 8 years ago

Thanks for your work on this project. I'm attempting to run: babel-istanbul cover -x <some_file> _mocha -- -R spec <some_file> --compilers js:babel-register

With the compilers option, my tests run fine with es6 but as for the babel-istanbul coverage I get: No coverage information was collected, exit without writing coverage information

Without the compiler option, I get the coverage summary but of course without using es6.

jeffrifwald commented 8 years ago

When you use the compilers flag, a new process is spawned by the babel-register compiler. Istanbul does not work with multiple processes. You should however be able to run your tests with babel-node instead of node like so:

babel-node node_modules/.bin/babel-istanbul cover -x <some_file> _mocha -- -R spec <some_file>
fpaxton commented 8 years ago

Thanks for the response. Mocha is still not recognizing es6 but I suppose this could be a mocha issue or more likely I have something setup wrong.

fpaxton commented 8 years ago

@jmcriffey babel-istanbul with/without babel-node will work fine for running tests that cover es6 but my tests can't be written in it. I'm uncertain if that distinction was expressed in my original post but this will be fine for my purpose.