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 🙏

© 2024 – Pkg Stats / Ryan Hefner

coverage-badge-creator

v1.0.19

Published

Coverage Badge Creator creates badges based on your test coverage and inserts them into the README

Downloads

4,398

Readme

CI Build Code-Style

MIT License Release Maintenance

About The Project

Coverage Badge Creator is a super easy to use tool for your project. It creates badges based on your test coverage and inserts them into the README. All without any third-party libraries or tools.

Installation

npm:

npm install --save-dev coverage-badge-creator

yarn:

yarn add --dev coverage-badge-creator

Usage

  1. First you need to set up your test environment.

    • jest

      In jest config you need to add 'json-summary' to coverageReporters. https://jestjs.io/docs/en/configuration

    • mocha

      {
        "test": "nyc --reporter=json-summary mocha"
      }
  2. Insert one of the following keys anywhere in your README. These will be replaced by the coverage-badge-creator with the appropriate badge.

    The following keys are available:

    • $coverage$
    • $statements$
    • $branches$
    • $functions$
    • $lines$

    important are also the surrounding dollar signs

  3. Now you can create the badges.

    Add the command to your package.json scripts block:

    "scripts": {
      "coverage:badge": "coverage-badge-creator",
    }   

    and run it from the CLI:

    npm run coverage:badge

Config

There are various ways to configure the badges according to your wishes. To do this, you only need to create a new file called .badge-config. Then you have the following options:

For a simple example click here.

coverage file path

{
  coverage_file_path: './coverage/json-summary.json'
}

badges

 {
   badges: {
     coverage: {
      logo: 'foo'
      color: 'bar'
     }
   }
 }

Depending on your test tool, you will probably have the following badges available for configuration:

  • coverage
  • statements
  • branches
  • functions
  • lines

Options

  • style
    plastic flat flat-square flat-for-the-badge social
  • logo
    kotlin medium github
  • logoColor
    blue green white
  • color
    blue green white
  • link
    blue green white

For more information on all options, see ->

Extended

In addition, you have further options in the cli.

  • --config

    This allows you to change the path and name of the configuration file.

    "scripts": {
      "coverage:badge": "coverage-badge-creator --config './badge-coverage-config.json'",
    }

Requirements

  • Node > v10.0.0

Built With

This section lists all programming languages and main frameworks.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/new_feature)
  3. Commit your Changes (git commit -m 'feat: Add new feature')
  4. Push to the Branch (git push origin feature/new_feature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

This npm package is primarily the work of Henry Steinhauer (H3nSte1n), for full list of contributors see the contributors graph.

Acknowledgements