Report Class
An abstraction for producing coverage reports.
This class is both the base class as well as a factory for Report
implementations.
All reports are event emitters and are expected to emit a done
event when
the report writing is complete.
See also the Reporter
class for easily producing multiple coverage reports
with a single call.
Usage
var Report = require('istanbul').Report,
report = Report.create('html'),
collector = new require('istanbul').Collector;
collector.add(coverageObject);
report.on('done', function () { console.log('done'); });
report.writeReport(collector);
Constructor
Report
-
options
Parameters:
-
options
ObjectOptional. The options supported by a specific store implementation.
Item Index
Methods
- create static
- getDefaultConfig
- getReportList static
- register static
- synopsis
- writeReport
Methods
create
-
type
-
opts
returns a report implementation of the specified type.
Parameters:
-
type
Stringthe type of report to create
-
opts
ObjectOptional. Options specific to the report implementation
Returns:
a new store of the specified type
getDefaultConfig
()
Object | Null
returns a config object that has override-able keys settable via config
Returns:
an object representing keys that can be overridden via the istanbul configuration where the values are the defaults used when not specified. A null return implies no config attributes
getReportList
()
static
returns the list of available reports as an array of strings
Returns:
an array of supported report formats
register
-
constructor
registers a new report implementation.
Parameters:
-
constructor
Functionthe constructor function for the report. This function must have a
TYPE
property of type String, that will be used inReport.create()
synopsis
()
String
returns a one-line summary of the report
Returns:
a description of what the report is about
writeReport
-
collector
-
sync
writes the report for a set of coverage objects added to a collector.
Parameters:
-
collector
Collectorthe collector for getting the set of files and coverage
-
sync
Booleantrue if reports must be written synchronously, false if they can be written using asynchronous means (e.g. stream.write)