API Docs for: 0.3.0
Show:

Report Class

Module: report

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
)
protected

Parameters:

  • options Object

    Optional. The options supported by a specific store implementation.

Item Index

Methods

create

(
  • type
  • opts
)
Report static

returns a report implementation of the specified type.

Parameters:

  • type String

    the type of report to create

  • opts Object

    Optional. Options specific to the report implementation

Returns:

Report:

a new store of the specified type

getDefaultConfig

() Object | Null

returns a config object that has override-able keys settable via config

Returns:

Object | Null:

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
)
static

registers a new report implementation.

Parameters:

  • constructor Function

    the constructor function for the report. This function must have a TYPE property of type String, that will be used in Report.create()

synopsis

() String

returns a one-line summary of the report

Returns:

String:

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 Collector

    the collector for getting the set of files and coverage

  • sync Boolean

    true if reports must be written synchronously, false if they can be written using asynchronous means (e.g. stream.write)