verify-istanbul-coverage
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

verify-istanbul-coverage

Build Status NPM version

Verifies minimum total covered lines in generated Istanbul reports.

Usage

CLI

npm i -g verify-istanbul-coverage
verify-istanbul-coverage

Flags

  • f/--file: File path to read from. Defaults to ./coverage/lcov-report/index.html.
  • -m/--minimum: Minimum expected coverage. Defaults to 100.

Node.js

import { VerificationStatus, verifyCoverage } from "verify-istanbul-coverage";
 
async main() {
    const coverage = await verifyCoverage();
 
    if (coverage.status === VerificationStatus.Successful) {
        console.log("All is well!");
    } else {
        console.error(`Failed: expected coverage to be at least ${coverage.minimum} but found ${coverage.actual}.`);
        console.log(`Check ${coverage.file}.`);
    }
}
 
main()
    .catch((error) => {
        console.error(`Error verifying coverage: ${error}`);
    });

Long names of flags can be passed as object members to verifyCoverage. See ./index.ts for the full typings.

Development

First clone the repository and install its dependencies:

git clone https://github.com/joshuakgoldberg/verify-istanbul-coverage
cd verify-istanbul-coverage
npm i
  • npm run watch runs TypeScript in watch mode.
  • npm run lint lints with TSLint.
  • npm run test runs tests in watch mode.
  • npm run prepublish builds code and runs tests.

Package Sidebar

Install

npm i verify-istanbul-coverage

Weekly Downloads

16

Version

1.0.1

License

MIT

Unpacked Size

44.5 kB

Total Files

25

Last publish

Collaborators

  • joshuakgoldberg