@start/plugin-lib-istanbul

💯 Collect, report and check code coverage using Istanbul

Usage no npm install needed!

<script type="module">
  import startPluginLibIstanbul from 'https://cdn.skypack.dev/@start/plugin-lib-istanbul';
</script>

README

💯 plugin-lib-istanbul

Collect, report and check code coverage using Istanbul.

Install

$ yarn add --dev @start/plugin-lib-istanbul

Usage

Signature

istanbulInstrument(extensions?: string[])

options

extensions

File extensions to instrument, for example ['.ts']

import type { ReportType } from 'istanbul-reports'

istanbulReports(formats: ReportType[] = ['lcovonly', 'text-summary'])
istanbulThresholds(options: {
  branches?: number,
  functions?: number,
  lines?: number,
  statements?: number
})

Example

import sequence from '@start/plugin-sequence'
import find from '@start/plugin-find'
import {
  istanbulInstrument,
  istanbulReport,
  istanbulThresholds
} from '@start/plugin-lib-istanbul'
import tape from '@start/plugin-lib-tape'

export const task = () =>
  sequence(
    find('src/**/*.js'),
    istanbulInstrument(),
    find('test/**/*.js'),
    tape(),
    istanbulReport(['lcovonly', 'html', 'text-summary']),
    istanbulThresholds({ functions: 100 })
  )