New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

jest-ratchet

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-ratchet

Ratchet up code coverage - keep test coverage going only one direction -- up


Version published
Weekly downloads
3K
decreased by-7.5%
Maintainers
1
Weekly downloads
 
Created

Jest-Ratchet

Maintainability Build Status Coverage Status Known Vulnerabilities Greenkeeper badge

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

npm install jest-ratchet --dev

yarn

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.

{
  "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 indefinitely

Here's how to pass configuration to Jest-Ratchet, per the Jest documentation

{
  "collectCoverage": true,
  "coverageReporters": ["json", "lcov", "text", "clover", "json-summary"],
  "reporters": [
    "default",
    [
      "jest-ratchet",
      { "tolerance": 2, "roundDown": true, "timeout": 5000 }
    ]
  ]
}

FAQs

Package last updated on 14 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts