Movatterモバイル変換


[0]ホーム

URL:


top
Coverage Badges<sup>2.2.0</sup> logoCoverage Badges2.2.0

coverage-badges-cli

Buy me a coffeeBuild & DeployCoverage Statusnpm versionDownload NPM

Create coverage badges from coverage reports. Using GitHub Actions and GitHub Workflow CPU time (no 3rd parties servers).

Don't worry about thecoverage.io service is down.

Install

$npm i coverage-badges-cli

Example

{"scripts":{"coverage":"jest --coverage""make-badges":"coverage-badges",},"jest":{"collectCoverageFrom":["<rootDir>/packages/**/*.{tsx,ts}","!**/*.{js,d.ts}"],"coverageReporters":["lcov","json-summary"],}}

This config creates a coverage badge in a default directory ./badges.

You can add![Coverage](./coverage/badges.svg) to your README.md after the badge creation.

Github Actions

Input Parameters

-name: Create Coverage Badgesuses: jaywcjlove/coverage-badges-cli@mainwith:style: flatsource: coverage/coverage-summary.jsonoutput: coverage/badges.svgjsonPath: totals.percent_covered-name: Deployuses: peaceiris/actions-gh-pages@v3with:github_token: ${{ secrets.GITHUB_TOKEN}}publish_dir: ./build

Output Parameters

svg svg image string:<svg xmlns.....

Using the command line

name: Build & Deployon:push:branches:- masterjobs:build-deploy:runs-on: ubuntu-18.04steps:-uses: actions/checkout@v2-uses: actions/setup-node@v2with:node-version:14-run: npm install-run: npm run build-run: npm run coverage-run: npm i coverage-badges-cli-g-run: coverage-badges--output coverage/badges.svg-name: Deployuses: peaceiris/actions-gh-pages@v3if: github.ref == 'refs/heads/master'with:github_token: ${{ secrets.GITHUB_TOKEN}}publish_dir: ./coverage

Command Help

Usage: coverage-badges[options][--help|h]Options:  --version,-v  Show version number  --help,-h     Displayshelp information.  --output,-o   Output directory.  --source,-s   The path of the targetfile"coverage-summary.json".--style        Badges style: flat, flat-square.--type         Coverage type: lines, statements, functions, branches.--scale        Set badge scale(default:1)--icon         Path to iconfile--iconWidth    Set thisif icon is not square(default:13)--label        The left label of the badge, usually static(default`coverage`).--labelColor<Color RGB> or<Color Name>(default:'555')--color<Color RGB> or<Color Name>(default:'')--jsonPath     Path to the coverage percentage number to be usedin the badge.--arbitrary    Allow jsonPath to point to non-number values. Worksin conjunction with jsonPath.Example:npm coverage-badges-cli--output coverage/badges.svgnpm coverage-badges-cli--style plasticnpm coverage-badges-cli--source coverage/coverage-summary.jsonnpm coverage-badges-cli--labelColor ADF

Development

$npm i$npm run build$npm runwatch

See also

Contributors

As always, thanks to our amazing contributors!

Made withcontributors.

License

MIT ©Kenny Wong

SponsorCreate TagContributorsRead File ContentGenerated Badges
Released under the MIT License. Copyright © 2025 Kenny Wong
Generated byidoc v1.34.2

[8]ページ先頭

©2009-2025 Movatter.jp