Code Coverage doesn't fail with 0% cover.
Author: n8oresCreated Jun 13, 2019Updated Sep 23, 2026
LabelsNeeds TriageBug ReportStale
Bug Report
Running JEST with code coverage enabled does not fail if the code coverage is 0%

To Reproduce
Enable JEST with the following configuration file
"jest": { "collectCoverage": true, "coverageDirectory": "../coverage", "testPathIgnorePatterns": [ "/node_modules/" ], "verbose": true, "coverageThreshold": { "global": { "branches": 50, "functions": 50, "lines": 50, "statements": 50 } } },
Then call your JEST script.
Expected behavior
JEST should fail with exit code 1 as the coverage limits are set to 50% and the test returned 0%.
Source: jestjs/jest