Awesome
start-istanbul
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)
options
– Istanbul instrumenter options (note that you can't changecoverageVariable
at this moment)
report
istanbul.report(formats)
formats
– Istanbul reporter formats,[ 'lcovonly', 'text-summary' ]
by default
thresholds
istanbul.thresholds(thresholds)
thresholds
–{ lines, statements, functions, branches }
object,{}
by default
It works as check-coverage
command:
Checks the coverage of
statements
,functions
,branches
, andlines
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
}