npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

esnext-coverage

v0.0.9

Published

Modular coverage tools for the modern web

Readme

esnext-coverage

NPM version

Modular coverage tools for the modern web.

Installation

npm install --save-dev esnext-coverage

Usage with test frameworks

See esnext-coverage-examples repository for more details.

Tape

Require esnext-coverage when running Tape:

tape -r esnext-coverage test/*.js

Mocha

Require esnext-coverage when running Mocha:

mocha -r esnext-coverage test/*.js

Jasmine

Replace babel-register with esnext-coverage in the list of Jasmine helpers:

"helpers": [
  "../node_modules/esnext-coverage/lib/esnext-coverage.js"
]

Options

The esnext-coverage configuration is an object that extends Babel API options with two additional properties:

reporters

A reporter signature is an object containing formatter (String or Function, defaults to JSON.stringify), console (Boolean, defaults to false) and outFile (String, optional) properties.

When formatter is a String, esnext-coverage will attempt to require(`esnext-coverage-format-${formatter}`) similar to Babel requiring plugins.

reporters: [
  // Format using esnext-coverage-format-text,
  // and write the formatted output to stdout:
  {formatter: 'text', console: true},
  // Format using esnext-coverage-format-html,
  // and write the formatted output to a file:
  {formatter: 'html', outFile: 'reports/coverage/coverage.html'},
  // Format using a custom formatter function,
  // and write the formatted output to a file:
  {formatter: myFormatter, outFile: 'reports/coverage/coverage.my'}
]

If reporters are not specified, a default reporter is used with 'json' as formatter and 'reports/coverage/coverage.json' file as output:

reporters: [
  {formatter: 'json', outFile: 'reports/coverage/coverage.json'}
]

thresholds

Both global and local properties are optional. No threshold is enforced by default.

thresholds: {
  global: {
    statement: 100,
    branch: 100,
    function: 100,
    line: 100
  },
  local: {
    statement: 100,
    branch: 100,
    function: 100,
    line: 100
  }
}

Configuration

Add an "esnext-coverage": {...options} entry in your package.json file or create either .esnextcoverage.js or .esnextcoveragerc file in the root of your project.

package.json

{
  "name": "my project",
  "version": "1.2.3",
  "esnext-coverage": {
    "only": "test/*.js",
    "reporters": [
      {"formatter": "text", "console": true}
    ]
  }
}

.esnextcoverage.js

module.exports = {
  only: 'test/*.js',
  reporters: [
    {formatter: 'text', console: true}
  ]
};

.esnextcoveragerc

{
  "only": "test/*.js",
  "reporters": [
    {"formatter": "text", "console": true}
  ]
}

CLI usage

Usage: esnext-coverage [options] [command]

Commands:

  instrument [options] [file]  instruments code
  collect [options] [file]     collects coverage data
  format [options] [file]      formats coverage data

Options:

  -h, --help     output usage information
  -V, --version  output the version number

instrument

Reads code from stdin or from a file, instruments it, and writes the instrumented code to stdout or to a file.

collect

Reads code from stdin or from a file, collects coverage data, and writes the result to stdout or to a file.

format

Transforms coverage data to the specified format.

Prior art

esnext-coverage has been inspired by Adana.

License

MIT License