Home

Awesome

start-istanbul

npm linux build windows build coverage deps

Istanbul (ES6+ ready using Babel recently) tasks for Start.

Install

npm install --save-dev start-istanbul
# or
yarn add --dev start-istanbul

Usage

The sequence of tasks is simple: "instrument" sources, run tests, report collected code coverage and then check the result against 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 istanbul from 'start-istanbul';
import mocha from 'start-mocha';

const start = Start(reporter());

export const coverage = () => start(
  files('coverage/'),
  clean(),
  files('lib/**/*.js'),
  istanbul.instrument({ esModules: true }),
  files('test/**/*.js'),
  mocha(),
  istanbul.report([ 'lcovonly', 'html', 'text-summary' ]),
  istanbul.thresholds({ functions: 100 })
);

Instrument task relies on array of files, see documentation for details.

Arguments

instrument

istanbul.instrument(options)

report

istanbul.report(formats)

thresholds

istanbul.thresholds(thresholds)

It works as 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, for example:

{
  statements: 100,
  functions: -10
}