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

Yet Another Istanbul Testing Question #679

Closed Announcement closed 8 years ago

Announcement commented 8 years ago

What is the proper way to use istanbul for es6 (babel?) with mocha.

Most answers I see recommend using things other than istanbul such as isparta or babel-istanbul, but I remember seeing mentioned somewhere that these are no longer needed...

My scripts must be run directly on the source without the compiling step please.

jcollum commented 8 years ago

My scripts must be run directly on the source

why? This seems like an unnecessary requirement. Why not transpile and run coverage on that? Pretty easy that way. Looking around my node_modules folders, I see a lot of code like this:

  "scripts": {
    "cover": "istanbul cover _mocha --report lcovonly",
    "coveralls": "npm run cover && istanbul-coveralls",

All you'd need to do is add an npm run transpile to the cover script.

gotwarlost commented 8 years ago

Please check out nyc that may have the features you need. istanbul-the-command-line-tool is mostly dead now and will be officially (whatever that means) replaced with https://github.com/istanbuljs/nyc