Skip to content

charlesbdudley/make-coverage-badge

 
 

Repository files navigation

make-coverage-badge

Build Status npm version License

Create a coverage badge

Creates a code coverage badge like the following:

Coverage badge

Currently just reads from Istanbul's JSON summary reporter and downloads a badge from https://shields.io/. Don't expect too much! Send a PR if you need configuration etc.

Usage

(For Create React Apps)

  1. Configure Jest (in package.json):

    "jest": {
      "coverageReporters": [
        "json-summary"
      ]
    }
  2. Run npm test -- --coverage

  3. Run make-coverage-badge

Resulting badge will be in ./coverage/badge.svg.

Options

make-coverage-badge --outputPath <path...>

Creates the svg at the specified path (relative to project root). Defaults to ./coverage/badge.svg.

Prior work

  • Coveralls: paid for private repos
  • coverage-badger: same approach, but using an XML report and therefore requires XML dependencies

Author

© 2017 Tom Vincent [email protected] (https://tlvince.com)

License

Released under the MIT license.

About

Create a coverage badge

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 93.6%
  • Vim Script 6.4%