'Alternative for istanbul programmatic API
We currently use istanbul for programmatically generating code coverage reports, and in order to do so, we make use of istanbul's Reporter() and Collector() classes. Since istanbul is now deprecated, are there any alternatives for the same?
var istanbul = require('istanbul'),
collector = new istanbul.Collector(),
reporter = new istanbul.Reporter(),
sync = false;
collector.add(obj1);
collector.add(obj2); //etc.
reporter.add('text');
reporter.addAll([ 'lcov', 'clover' ]);
reporter.write(collector, sync, function () {
console.log('All reports generated');
});
This is the sample code present in istanbul's docs. Which other npm can we use in order to generate reports from coverage JSON objects? Istanbul's migration guide points us to nyc, but is there a programmatic way to use nyc? I could find only command line interfaces.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
