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:
-
cfg
Configurationthe config object, a falsy value will load the default configuration instead
-
dir
Stringthe 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:
-
fmt
Stringthe format of the report to generate
addAll
(
-
fmts
adds an array of report formats to be generated
Parameters:
-
fmts
Arrayan array of report formats
write
(
-
collector
-
sync
-
callback
writes all reports added and calls the callback when done
Parameters:
-
collector
Collectorthe collector having the coverage data
-
sync
Booleantrue to write reports synchronously
-
callback
Functionthe callback to call when done. When
sync
is true, the callback will be called in the same process tick.