Coder Social home page Coder Social logo

ethanbud5 / istanbul-badges-readme Goto Github PK

View Code? Open in Web Editor NEW

This project forked from the-bugging/istanbul-badges-readme

0.0 1.0 0.0 4.13 MB

Creates and updates README testing coverage badges with your json-summary

Home Page: https://www.npmjs.com/package/istanbul-badges-readme

License: MIT License

JavaScript 6.59% TypeScript 93.41%

istanbul-badges-readme's Introduction

traffic

Istanbul Badges Readme

Creates README badges from istanbul coverage report

Statements Branches Functions Lines
Statements Branches Functions Lines

Current Version: 1.2.0

Table of Contents


Markup example (paste it anywhere in your README.md)

| Statements                  | Branches                | Functions                 | Lines                |
| --------------------------- | ----------------------- | ------------------------- | -------------------- |
| ![Statements](#statements#) | ![Branches](#branches#) | ![Functions](#functions#) | ![Lines](#lines#)    |
  • The table is optional, the only markup that matters are the following:
  1. ![Statements](#statements#)
  2. ![Branches](#branches#)
  3. ![Functions](#functions#)
  4. ![Lines](#lines#)

Running example

Example


Requirements

  • Must have at least one of the before mentioned markup items;
  • You should have json-summary as a coverageReporter in your tests configuration;
  • For example, if you are using Jest, configuration should either be within package.json or inside your jest config file i.e. jest.config.js or jestconfig.json as shown below:
  "coverageReporters": ["json-summary"]

Installation

  npm i -D istanbul-badges-readme

Usage

  • Simply run it from the CLI as follows:
  npm run istanbul-badges-readme
  • Custom coverage directory? Use --coverageDir argument:
  npm run istanbul-badges-readme --coverageDir="./my-custom-coverage-directory"
  • Want it without logging? Try silent mode with --silent argument:
  npm run istanbul-badges-readme --silent
  • Or add it to your package.json scripts as follows:
"scripts": {
  "make-badges": "istanbul-badges-readme",
}

Usage as a part of your githooks

  • If you want to have this run on the pre-commit hook and update the commit in place, just install husky and add the pre-commit script to your package.json.
  1. Install Husky.
  npm install -D husky
  1. Add your pre-commit script:
  "husky": {
    "hooks": {
      "pre-commit": "npm run test && istanbul-badges-readme && git add 'README.md'"
    }
  }
  1. Git Commit and Push. Just use your workflow as usual. If your tests fail, no commit. If they pass, update the README.md and add the file to the commit. Nice!

See more examples

Examples folder


Contributors

Thanks goes to these wonderful people (emoji key):


Olavo Parno

๐Ÿค” ๐Ÿ’ป โš ๏ธ

nothingismagick

๐Ÿค” ๐Ÿ› ๐Ÿ–‹

Dave Fisher

๐Ÿ›

Martin Zagora

๐Ÿค” ๐Ÿ›

Victor Miti

๐Ÿ›

Stefan Huber

๐Ÿ’ฌ ๐Ÿ“–

This project follows the all-contributors specification. Contributions of any kind welcome!


License

Istanbul Badges Readme is MIT licensed.

istanbul-badges-readme's People

Contributors

olavoparno avatar allcontributors[bot] avatar dependabot[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.