Jest coverageThreshold: global, per-folder and per-file
Every coverageThreshold setup we ran with Jest 30.5.2, the messages it printed, and which files counted toward global.

coverageThreshold makes Jest exit 1 when coverage is below a floor, even
when every test passed. Positive numbers are minimum percentages; negative
numbers are the most uncovered items allowed. Keys other than global take a
folder, a file or a glob, and the files they match no longer count toward
global.
// jest.config.js
module.exports = {
collectCoverageFrom: ['src/**/*.js'],
coverageThreshold: {
global: { branches: 75, functions: 80, lines: 80, statements: 80 },
'./src/legacy/': { branches: 0 },
},
};

Threshold setups at a glance
| Setup | Result |
|---|---|
global: { branches: 80 }, branches at 50% | Exit 1, though all 3 tests passed |
global: { statements: -2 }, 5 uncovered | Exit 1: “Uncovered count for statements (5) exceeds global threshold (2)” |
global: { statements: -5 } | Passed |
global 75 plus './src/legacy/': { branches: 0 } | Passed: global rose from 50% to 75% |
'./src/': { branches: 80 } | One check over the whole folder |
'./src/*.js': { branches: 100 } | One check per file, and those files left global |
'./src/missing.js' | Exit 1: “Coverage data for ./src/missing.js was not found.” |
Threshold set, run without --coverage | No check, exit 0 |
--shard=1/2 | Checked against that shard’s coverage alone |
We ran each with Jest 30.5.2 on a project with pricing.js and
shipping.js under test and an untested src/legacy/old.js: 7 of 12 lines,
3 of 6 branches.
“Coverage for branches does not meet global threshold”
Jest: Coverage for branches (50%) does not meet "global" threshold (80%)
That is the whole message: the tests passed, the coverage check failed, and
Jest exited 1. Each metric that misses its floor gets a line. To find the
branches, run with --coverageReporters=text and read the Uncovered Line
column, or open coverage/lcov-report/index.html.
Common causes, measured:
| Cause | What we saw |
|---|---|
An untested file in collectCoverageFrom | src/legacy/old.js pulled branches from 75% to 50% |
No collectCoverageFrom | Untested files left out: branches 75% |
| Sharded runs | Shard 1 alone had 1 of 6 branches and failed a 50% floor |
Leaving out collectCoverageFrom raises the number only by not counting the
files no test imports. Set it, and carve out what you mean to leave untested.

Per-folder and per-file thresholds
A key that is a folder gets one check over all its files together. A glob
gets a check for each file it matches. In both cases the matched files leave
global:
coverageThreshold: {
global: { branches: 75 },
'./src/legacy/': { branches: 0 },
}
With legacy/ carved out, global covered only pricing.js and
shipping.js, at 75%, and the run passed. With './src/*.js': { branches: 100 }, shipping.js failed on its own at 50%, and global was left with
only legacy/old.js, at 0%. A path that matches no file fails the run.
'src/legacy/' without the leading ./ worked the same.
Thresholds with sharding
Jest checks the threshold inside each --shard run, against that shard’s
coverage. Our first shard covered 1 of 6 branches and failed a 50% floor
that the whole suite would pass. Keep coverageThreshold out of sharded
runs, and check the floor after merging; see Merge coverage
reports.
On the command line
jest --coverage --coverageThreshold='{"global":{"branches":80}}'
This failed the same way as the config. Quote the JSON so the shell passes it whole.
What Supercov adds
npx supercov -- npx jest
npx supercov runs check --min-lines 80 --min-branches 75 --min-mcdc 75
npx supercov runs check --min-lines 100 --per-file
runs check reads a recorded run, so the floor can apply after merging shards
or for one test level. On our two merged shards it printed branches 3/6 below
75% and exited 1. A floor is compared against the counts, never a rounded
percentage, and it adds MC/DC, which Jest does not measure. See Jest
coverage exclude for leaving files out, and
Jest coverage for the providers.
More coverage guides
- JaCoCo aggregate report for multi-module Maven and Gradle builds
- pytest ignore directory: --ignore, norecursedirs and collect_ignore
- Merge coverage reports from shards: Vitest, Jest and coverage.py
- Statement vs branch coverage, with decision, line and path coverage
- JaCoCo report not generated: the causes in Maven and Gradle
- Kover exclude: classes, packages and generated code
- sonar.coverage.exclusions: why SonarQube ignores your JaCoCo excludes
- istanbul ignore next vs c8 ignore next: every hint, measured
- Go test coverage exclude: files, packages and mocks
- Jest coverage exclude: files, folders and lines
- pytest coverage exclude: omit files, folders and lines
- Vitest coverage exclude: files, folders and lines
- JaCoCo exclude in Maven and Gradle: packages, classes and generated code