1.0.6 • Published 8 years ago

start-coverage v1.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

start-coverage

npm travis coverage deps gitter

Code coverage tasks for Start. Uses istanbul by default, but is compatible with babel-istanbul, isparta, ibrik and so on.

Install

npm i -D start-coverage

Usage

The sequence of tasks is simple: "instrument" sources, run tests, report collected code coverage and then check result against the provided thresholds (optional).

import start from 'start';
import reporter from 'start-pretty-reporter';
import files from 'start-files';
import clean from 'start-clean';
import * as coverage from 'start-coverage';
import mocha from 'start-mocha';

export function coverage() {
    return start(reporter())(
        files('coverage/'),
        clean(),
        files('lib/**/*.js'),
        coverage.instrument(),
        files('test/**/*.js'),
        mocha(),
        coverage.report([ 'lcovonly', 'html', 'text-summary' ]),
        coverage.thresholds({ functions: 100 })
    );
}

Instrument tasks is rely on array of files, see documentation for details.

Arguments

instrument

coverage.instrument(istanbul, options)

  • istanbul – istanbul-compatible coverage tool, require('istanbul') by default
  • optionsInstrumenter options, { embedSource: true, noAutoWrap: true } by default

report

coverage.report(reporters, dir)

  • reporters[ 'lcovonly', 'text-summary' ] by default
  • dir – output directory, coverage/ by default

thresholds

coverage.thresholds(thresholds)

Same as istanbul check-coverage command:

Checks the coverage of statements, functions, branches, and lines against the provided thresholds. Positive thresholds are taken to be the minimum percentage required and negative numbers are taken to be the number of uncovered entities allowed.

Only defined keys will be processed:

{
    statements: 100,
    functions: -10
}
1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago