# Jest coverageThreshold: global, per-folder and per-file > Why Jest says coverage does not meet the global threshold when tests pass: coverageThreshold floors, negative counts, per-folder and glob keys, sharding. Web page: https://supercov.com/blog/jest-coverage-threshold · Published 2026-11-27 All Supercov pages for agents: https://supercov.com/llms.txt · Full text: https://supercov.com/llms-full.txt 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`. ```js // jest.config.js module.exports = { collectCoverageFrom: ['src/**/*.js'], coverageThreshold: { global: { branches: 75, functions: 80, lines: 80, statements: 80 }, './src/legacy/': { branches: 0 }, }, }; ``` ![A diagram of a Jest run: the tests pass, collectCoverageFrom picks three files, a ./src/legacy/ key gives its file its own check with branches 0, and the other files form global at 75%. Any floor missed prints the metric and exits 1, as in: Coverage for branches (50%) does not meet global threshold (80%).](https://supercov.com/assets/jest-coverage-threshold-flow-1360.841803739c.webp) *How Jest splits files between path keys and global, then checks each floor.* ## 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. ![A grid of five setups against three files, pricing.js, shipping.js and legacy/old.js, marking which count toward global. All three: 50%, fail. With a legacy folder key: pricing and shipping, 75%, pass. With a ./src/*.js glob: only legacy, 0%, fail. Without collectCoverageFrom: pricing and shipping, 75%. A single shard: all three, 16.66%.](https://supercov.com/assets/jest-coverage-threshold-grid-1360.bc3201a5b0.webp) *Which files counted toward global, and global's branch coverage, in Jest 30.5.2.* ## 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`: ```js 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](https://supercov.com/blog/merge-coverage-reports.md). ## On the command line ```sh 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 ```sh 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](https://supercov.com/blog/jest-coverage-exclude.md) for leaving files out, and [Jest coverage](https://supercov.com/compare/jest-coverage.md) for the providers.