API Docs for: 0.3.0
Show:

Reporter Class

Defined in: lib/reporter.js:9
Module: main

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
)

Defined in lib/reporter.js:9

Parameters:

  • cfg Configuration

    the config object, a falsy value will load the default configuration instead

  • dir String

    the directory in which to write the reports, may be falsy to use config or global defaults

Item Index

Methods

Methods

add

(
  • fmt
)

Defined in lib/reporter.js:40

adds a report to be generated. Must be one of the entries returned by Report.getReportList()

Parameters:

  • fmt String

    the format of the report to generate

addAll

(
  • fmts
)

Defined in lib/reporter.js:61

adds an array of report formats to be generated

Parameters:

  • fmts Array

    an array of report formats

write

(
  • collector
  • sync
  • callback
)

Defined in lib/reporter.js:72

writes all reports added and calls the callback when done

Parameters:

  • collector Collector

    the collector having the coverage data

  • sync Boolean

    true to write reports synchronously

  • callback Function

    the callback to call when done. When sync is true, the callback will be called in the same process tick.