Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markis/jest-ratchet
🔧 Ratchet up test coverage
https://github.com/markis/jest-ratchet
code-coverage jest jest-reporter test-coverage testing
Last synced: 3 months ago
JSON representation
🔧 Ratchet up test coverage
- Host: GitHub
- URL: https://github.com/markis/jest-ratchet
- Owner: markis
- License: mit
- Created: 2018-01-13T23:22:15.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T02:49:05.000Z (about 2 years ago)
- Last Synced: 2024-09-26T12:08:17.777Z (5 months ago)
- Topics: code-coverage, jest, jest-reporter, test-coverage, testing
- Language: TypeScript
- Homepage: https://www.npmjs.com/jest-ratchet
- Size: 497 KB
- Stars: 10
- Watchers: 5
- Forks: 5
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Jest-Ratchet
[![Maintainability](https://api.codeclimate.com/v1/badges/dcf0bf468746ec3dc221/maintainability)](https://codeclimate.com/github/markis/jest-ratchet/maintainability)
[![Build Status](https://travis-ci.org/markis/jest-ratchet.svg?branch=master)](https://travis-ci.org/markis/jest-ratchet)
[![Coverage Status](https://coveralls.io/repos/github/markis/jest-ratchet/badge.svg?branch=master)](https://coveralls.io/github/markis/jest-ratchet?branch=master)
[![Known Vulnerabilities](https://snyk.io/test/github/markis/jest-ratchet/badge.svg?targetFile=package.json)](https://snyk.io/test/github/markis/jest-ratchet?targetFile=package.json)Ratchet up code coverage - keep test coverage going only one direction -- up
Jest-Ratchet is a coverage watcher for Jest. Everytime a new level of coverage is reached Jest-Ratchet will automatically update the coverageThreshold.
### Installation
npm
```bash
npm install jest-ratchet --dev
```yarn
```bash
yarn add jest-ratchet --dev
```### Jest Settings
Add `jest-ratchet` to the `reporters` section. And also ensure that `collectCoverage` is enabled and `json-summary` is added to the `coverageReporters`.
```json
{
"collectCoverage": true,
"coverageReporters": ["json", "lcov", "text", "clover", "json-summary"],
"reporters": ["default", "jest-ratchet"]
}
```### Optional Settings
By default, Jest-Ratchet is aggressive with updating coverage thresholds. Every time your coverage ticks up by 0.01%, the coverageThreshold is updated. There are a couple of options dampen this behavior.
- tolerance (number): keeps the threshold below the measured coverage, allowing wiggle room. default: 0 tolerance
- roundDown (boolean): round down to the nearest integer. default: false
- timeout (number): the number of milliseconds to wait for to the Jest coverage json summary. default: wait indefinitelyHere's how to pass configuration to Jest-Ratchet, per the [Jest documentation](https://jestjs.io/docs/en/configuration.html#reporters-array-modulename-modulename-options)
```json
{
"collectCoverage": true,
"coverageReporters": ["json", "lcov", "text", "clover", "json-summary"],
"reporters": [
"default",
[
"jest-ratchet",
{ "tolerance": 2, "roundDown": true, "timeout": 5000 }
]
]
}
```