Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rbardini/jest-it-up
🌐📈 Automatically bump up global Jest thresholds whenever coverage goes above them
https://github.com/rbardini/jest-it-up
coverage global jest test testing threshold
Last synced: 3 months ago
JSON representation
🌐📈 Automatically bump up global Jest thresholds whenever coverage goes above them
- Host: GitHub
- URL: https://github.com/rbardini/jest-it-up
- Owner: rbardini
- License: mit
- Created: 2020-04-29T15:21:58.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-30T05:47:23.000Z (3 months ago)
- Last Synced: 2024-07-30T11:27:49.216Z (3 months ago)
- Topics: coverage, global, jest, test, testing, threshold
- Language: JavaScript
- Homepage: https://npm.im/jest-it-up
- Size: 2.17 MB
- Stars: 62
- Watchers: 3
- Forks: 10
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-jest - jest-it-up
README
# jest-it-up
[![npm package version](https://img.shields.io/npm/v/jest-it-up)](https://www.npmjs.com/package/jest-it-up)
[![Build status](https://img.shields.io/github/workflow/status/rbardini/jest-it-up/Main)](https://github.com/rbardini/jest-it-up/actions)
[![Code coverage](https://img.shields.io/codecov/c/github/rbardini/jest-it-up.svg)](https://codecov.io/gh/rbardini/jest-it-up)
[![Dependencies status](https://img.shields.io/librariesio/release/npm/jest-it-up)](https://libraries.io/npm/jest-it-up)Ensure incremental coverage gains are not lost, and positively reinforce good testing habits. Automatically bump up global Jest thresholds whenever coverage goes above them.
![Demo](demo.gif)
## Requirements
- Node.js 16+
- Conventional `jest.config.js` (`package.json` config unsupported)
- `json-summary` coverage report (see [usage](#usage))## Installation
```console
npm install --save-dev jest-it-up
```## Usage
jest-it-up exposes a standalone CLI tool (see [options](#options)), but you most likely want to use it in a post-test script.
Within `package.json`:
```js
{
"scripts": {
"test": "jest --coverage", // or set `collectCoverage` to `true` in Jest config
"posttest": "jest-it-up" // must run from the same directory as `jest.config.js`
}
}
```within `jest.config.js`:
```js
module.exports = {
coverageReporters: [
'json-summary' // plus any other reporters, e.g. "lcov", "text", "text-summary"
],
coverageThreshold: {
global: {
branches: 0, // or your current numbers
functions: 0,
lines: 0,
statements: 0
}
}
}
```Once tests finish running, jest-it-up will update configured thresholds to match higher coverage numbers, if any.
## Options
```console
$ jest-it-up --help
Usage: jest-it-up [options]Options:
-c, --config path to a Jest config file (default: 'jest.config.js')
-m, --margin minimum threshold increase (default: 0)
-t, --tolerance threshold difference from actual coverage
-i, --interactive ask for confirmation before applying changes
-s, --silent do not output messages
-d, --dry-run process but do not change files
-v, --version output the version number
-p, --precision number of threshold decimal places to persist
-h, --help display help for command
```