Coder Social home page Coder Social logo

zang3tsu / 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 3.48 MB

Updates README testing coverage badges

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

License: MIT License

JavaScript 16.57% TypeScript 83.43%

istanbul-badges-readme's Introduction

traffic

Istanbul Badges Readme

Creates README badges from istanbul coverage report

Statements Branches Functions Lines
Statements Branches Functions Lines

Table of Contents


Example markup (paste it anywhere in your README.md)

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

Example running

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
  • With custom coverage directory:
  npm run istanbul-badges-readme --coverageDir="./my-custom-coverage-directory"
  • Or add it to your package.json scripts as follows:
"scripts": {
  "make-badges": "istanbul-badges-readme",
}

Using 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!

Contributors

Thanks goes to these wonderful people (emoji key):

Olavo Parno
Olavo Parno

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

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

๐Ÿ›

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

Watchers

 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.