Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tlvince/make-coverage-badge
Create a coverage badge
https://github.com/tlvince/make-coverage-badge
coverage-badge istanbul jest
Last synced: 1 day ago
JSON representation
Create a coverage badge
- Host: GitHub
- URL: https://github.com/tlvince/make-coverage-badge
- Owner: tlvince
- License: mit
- Created: 2017-07-26T11:08:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-24T18:12:22.000Z (almost 2 years ago)
- Last Synced: 2025-01-25T00:11:53.986Z (8 days ago)
- Topics: coverage-badge, istanbul, jest
- Language: JavaScript
- Size: 851 KB
- Stars: 27
- Watchers: 2
- Forks: 213
- Open Issues: 29
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
- Support: .github/SUPPORT.md
Awesome Lists containing this project
README
# make-coverage-badge
[![Build Status][travis-image]][travis-url]
[![npm version][npm-image]][npm-url]
[![License][license-image]][license-url][travis-url]: https://travis-ci.org/tlvince/make-coverage-badge
[travis-image]: https://img.shields.io/travis/tlvince/make-coverage-badge.svg
[npm-url]: https://www.npmjs.com/package/make-coverage-badge
[npm-image]: https://img.shields.io/npm/v/make-coverage-badge.svg
[license-url]: https://opensource.org/licenses/MIT
[license-image]: https://img.shields.io/npm/l/make-coverage-badge.svg> Create a coverage badge
Creates a code coverage badge like the following:
![Coverage badge][coverage-badge]
Currently just reads from Istanbul's JSON summary reporter and downloads a badge from https://shields.io/. Don't expect too much! Send a PR if you need configuration etc.
[coverage-badge]: https://img.shields.io/badge/Coverage-100%25-brightgreen.svg
## Usage
(For Create React Apps)
1. Configure Jest (in `package.json`):
```json
"jest": {
"coverageReporters": [
"json-summary"
]
}
```2. Run `npm test -- --coverage`
3. Run `make-coverage-badge`Resulting badge will be in `./coverage/badge.svg`.
## Options
### `--output-path `
Writes the coverage badge to the given path (relative to project root). Defaults to `./coverage/badge.svg`.
### `--report-path `
Path to a coverage report file. Defaults to `./coverage/coverage-summary.json`.
## Prior work
- [Coveralls][]: paid for private repos
- [coverage-badger][]: same approach, but using an XML report and therefore requires XML dependencies[coveralls]: https://coveralls.io/
[coverage-badger]: https://github.com/notnotse/coverage-badger## Author
© 2019 Tom Vincent (https://tlvince.com)
## License
Released under the [MIT license](http://tlvince.mit-license.org).