Coder Social home page Coder Social logo

zypher606 / jest-coverage-badges Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pamepeixinho/jest-coverage-badges

0.0 1.0 0.0 76 KB

Create jest coverage badges (from all jest types)

License: MIT License

JavaScript 96.22% Vim Script 3.78%

jest-coverage-badges's Introduction

Jest Coverage Badges

Create a group of coverage badge

License npm

Creates a group of code coverage badges like the following:

Coverage badge gree Coverage badge gree Coverage badge gree

Currently just reads from Istanbul's JSON summary reporter and downloads a badge from https://shields.io/ for each jest coverage type (statement, branch, functions, lines). Like this:

Coverage lines Coverage functions Coverage branches Coverage statements

This package is an extension of make-coverage-badge, but this one creates all the types of coverage.

Usage

  1. Install jest-coverage-badges in your project or global

    Project (in your project folder):

    npm install --save jest-coverage-badges

    Global:

    npm install --global jest-coverage-badges

  2. Configure Jest (in package.json):

    (optional: "text" and "lcov")

    "jest": {
      "coverageReporters": [
        "json-summary", 
        "text",
        "lcov"
      ]
    }

    If you installed in your project, you can create a script to run it, for example:

    "scripts": {
      "test:coverage": "npm test -- --coverage",
      "test:badges": "npm run test:coverage  && jest-coverage-badges"
    }
  3. Run npm test -- --coverage

  4. Run jest-coverage-badges (or just run: npm run test:badges)

    Resulting in badges:

    • ./coverage/badge-statements.svg
    • ./coverage/badge-lines.svg
    • ./coverage/badge-functions.svg
    • ./coverage/badge-branches.svg

CLI Options

  • input [default: ./coverage/coverage-summary.json] - the file (and its path) of the summary json that contains the coverage data
  • output [default: ./coverage] - the path to the directory where the svg files will be placed after download. If path doesn't exist it will be created.

Example:
$ jest-coverage-badges --input "./cov" --output "./badges"

After this you can add into Github readme (for example) ๐Ÿ˜ƒ

Why use this package?

We have great companies like coveralls and codecov, but it's paid for private repositories. If this package we can add badges in our readme by creating the badges (this can be run at your build, upload to a store and consume in the readme or the website).

Author of adaptation of (make-coverage-badge)

ยฉ 2018 [Main Author of Adaptations] Pamela Peixinho [email protected] (https://pamepeixinho.github.io)

jest-coverage-badges's People

Contributors

pamepeixinho avatar tlvince avatar michaelrodov avatar benrthiele-monsanto avatar matismasters 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.