Reporter Class
convenience mechanism to write one or more reports ensuring that config options are respected.
Usage
var fs = require('fs'),
reporter = new require('istanbul').Reporter(),
collector = new require('istanbul').Collector(),
sync = true;
collector.add(JSON.parse(fs.readFileSync('coverage.json', 'utf8')));
reporter.add('lcovonly');
reporter.addAll(['clover', 'cobertura']);
reporter.write(collector, sync, function () { console.log('done'); });
Constructor
Reporter
(
-
cfg -
dir
Parameters:
-
cfgConfigurationthe config object, a falsy value will load the default configuration instead
-
dirStringthe directory in which to write the reports, may be falsy to use config or global defaults
Methods
add
(
-
fmt
adds a report to be generated. Must be one of the entries returned
by Report.getReportList()
Parameters:
-
fmtStringthe format of the report to generate
addAll
(
-
fmts
adds an array of report formats to be generated
Parameters:
-
fmtsArrayan array of report formats
write
(
-
collector -
sync -
callback
writes all reports added and calls the callback when done
Parameters:
-
collectorCollectorthe collector having the coverage data
-
syncBooleantrue to write reports synchronously
-
callbackFunctionthe callback to call when done. When
syncis true, the callback will be called in the same process tick.
