v8-coverage

Use native v8 inspector to generate coverage reports


Keywords
coverage, v8, istanbul
License
ISC
Install
npm install v8-coverage@1.0.9

Documentation

cov8 - Native V8 coverage tool

Code-coverage using v8's Inspector that's compatible with Istanbul's reporters. This tool is inspired from c8.

Like nyc, cov8 just magically works:

yarn global add v8-coverage
cov8 node foo.js

The above example will collect coverage for foo.js using v8's inspector.

How to use

Like the above example you just need to run this command to collect coverage:

cov8 <command>

If you want to get a coverage report, you just need to run this:

cov8 report <reporter>

You can find the list of available reporters here.

If you want to clean the coverage folder, run this:

cov8 clear

Options

Some options can be pass as parameter like:

  • include you can specify which files you want to cover
  • exclude you can specify which files you want to don't cover
  • coverage-directory where coverage files are stored (map/reports), ./coverage by default
  • forks use this option if you want to collect coverage from forked process

You can get more help with:

cov8 --help

How it Works

Before running your application cov8 creates an inspector session in v8 and enables v8's built in coverage reporting.

Just before your application exits, cov8 fetches the coverage information from v8 and writes it to disk in a format compatible with Istanbul's reporters.