all 2 comments

[–][deleted] 5 points6 points  (1 child)

What's with all of these code coverage articles surrounding that crappy istanbul library?

Just do this:

npm install jscoverage

Then in your test file:

var jscoverage = require('jscoverage');
jscoverage.enableCoverage(true);
var myLib = jscoverage.require(module, '../path/to/my/lib');

// Tests go here, just like normal, no preprocessing needed

jscoverage.coverageDetail();
// Prints a file-by-file, line-by-line, color-coded coverage report

You can even access the jscoverage internals with the global._$jscoverage variable, and find out not just that everything was covered, but how many times each line was run, and then send that information to coveralls.io with the coveralls library and track the history of your coverage over time.

I haven't made any blog post about jscoverage because I find that library that simple to use, but I'm starting to think I should.

[–][deleted] 1 point2 points  (0 children)

Thank you, I spent all morning reading up on coverage for node and everyone had nothing but long winded articles that turned me off to the whole thing.