
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
jest-coverage-ratchet
Advanced tools
Raises jest
's minimum coverage thresholds (per category) if current coverage is higher.
Lets say you have some jest coverage thresholds set in the package.json
for your project at the following values:
{
"branches": 30,
"functions": 30,
"lines": 30,
"statements": 50,
}
then you get inspired one day and write lots of tests. Now your actual coverage summary might look like this:
{
"branches": 50,
"functions": 60,
"lines": 77,
"statements": 50,
}
Great 🌸‼ Except you'd really like your accomplishment to set the new standard for test coverage in this project. jest-coverage-ratchet
just does that automatically by looking at your current coverage summary, comparing it to your specified coverage thresholds, and updating the minimum for any threshold that is higher in the summary.
So given the previous values, running this script will update your coverage thresholds specified in the jest
key of package.json
to the following values:
{
"branches": 50,
"functions": 60,
"lines": 77,
"statements": 50,
}
Just add as a dev dependency to your project like
npm install --save-dev jest-coverage-ratchet
or
yarn add --dev jest-coverage-ratchet
I recommend then using the binary jest-coverage-ratchet
as part of a prepush
hook.
I know what happens when you assume, but jest-coverage-ratchet
makes the following assumptions about your project.
jest
has been run for project at least once with --coverage
so that there is a valid file at the path ./coverage/coverage-summary.json
(alternatively pass a path with --coverageSummaryPath
of ./your/path/to/coverage-summary.json
)jest
configuration object is present in the package.json
that specifies at least:
--configPath
of ./your/path/to/jest.config.json
)'json-summary'
in your jest config's reporters list like so:{
// ...
"jest": {
"coverageReporters": [
"json-summary"
],
"coverageThreshold": {
"global": {
"branches": Number,
"functions": Number,
"lines": Number,
"statements": Number,
}
}
},
// ...
}
Should this tool support things like piping the coverage data in as an argument? Of course it should. If you want to build that and send a PR I will be all smiles 😀✨. If not then you probably see me do it eventually.
Just submit an issue or a PR, I'm no elitist.
FAQs
Ensures code coverage only increases
The npm package jest-coverage-ratchet receives a total of 425 weekly downloads. As such, jest-coverage-ratchet popularity was classified as not popular.
We found that jest-coverage-ratchet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.