Socket
Socket
Sign inDemoInstall

jest-it-up

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-it-up - npm Package Compare versions

Comparing version 2.0.2 to 2.2.0

2

lib/getData.js

@@ -11,3 +11,3 @@ const fs = require('fs')

const reportPath = path.resolve(
process.cwd(),
path.dirname(configPath),
coverageDirectory,

@@ -14,0 +14,0 @@ 'coverage-summary.json',

@@ -1,12 +0,14 @@

const getNewThresholds = (thresholds, coverages, margin) =>
const getNewThresholds = (thresholds, coverages, margin, tolerance) =>
Object.entries(thresholds).reduce((acc, [type, threshold]) => {
const { pct: coverage } = coverages[type]
const desiredCoverage = coverage - tolerance
// Only update threshold if new coverage is higher than
// current threshold + margin
if (coverage >= threshold + margin) {
if (desiredCoverage >= threshold + margin) {
acc[type] = {
prev: threshold,
next: coverage,
diff: +(coverage - threshold).toFixed(2),
next: desiredCoverage,
diff: +(desiredCoverage - threshold).toFixed(2),
}

@@ -13,0 +15,0 @@ }

@@ -13,11 +13,18 @@ #!/usr/bin/env node

module.exports = async ({
config = 'jest.config.js',
dryRun = false,
interactive = false,
margin = 0,
tolerance = 0,
silent = false,
} = {}) => {
const configPath = path.resolve(process.cwd(), 'jest.config.js')
const configPath = path.resolve(process.cwd(), config)
const { thresholds, coverages } = await getData(configPath)
const newThresholds = getNewThresholds(thresholds, coverages, margin)
const newThresholds = getNewThresholds(
thresholds,
coverages,
margin,
tolerance,
)
const { changes, data } = getChanges(configPath, newThresholds)

@@ -46,3 +53,3 @@

outputResult(dryRun)
outputResult(configPath, dryRun)
}
const { yellow } = require('ansi-colors')
const outputResult = dryRun => {
const outputResult = (configPath, dryRun) => {
console.log(
dryRun
? `No changes made to ${yellow('jest.config.js')}. (dry-run mode)`
: `Done! Please record the changes to ${yellow('jest.config.js')}.`,
? `No changes made to ${yellow(configPath)}. (dry-run mode)`
: `Done! Please record the changes to ${yellow(configPath)}.`,
)

@@ -9,0 +9,0 @@ }

{
"name": "jest-it-up",
"version": "2.0.2",
"version": "2.2.0",
"description": "Automatically bump up global Jest thresholds whenever coverage goes above them",

@@ -5,0 +5,0 @@ "keywords": [

@@ -66,8 +66,10 @@ # jest-it-up

Options:
-m, --margin <margin> minimum threshold increase (default: 0)
-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
-h, --help display help for command
-c, --config <path> path to a Jest config file (default: 'jest.config.js')
-m, --margin <margin> minimum threshold increase (default: 0)
-t, --tolerance <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
-h, --help display help for command
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc