cicd testing ai_generated true

Jest: "global" coverage threshold for statements (80%) not met: 72.5%

ID: cicd/coverage-threshold-failed

Also available as: JSON · Markdown
80%Fix Rate
85%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

Code coverage fell below the configured threshold, causing the CI pipeline to fail. This is a quality gate check that ensures new code maintains minimum test coverage levels.

generic

Workarounds

  1. 88% success Write meaningful tests for uncovered code paths
    Run coverage locally: npx jest --coverage. Review the coverage report to identify uncovered lines/branches. Write tests targeting the specific uncovered paths. Verify the threshold is met before pushing.
  2. 82% success Use per-file or per-directory thresholds instead of global
    Configure different thresholds for different parts of the codebase. In jest.config.js: coverageThreshold: { './src/critical/': { statements: 90 }, './src/utils/': { statements: 70 } }. This allows new code to have higher thresholds without penalizing legacy code.

Dead Ends

Common approaches that don't work:

  1. Lowering the coverage threshold to make CI pass 60% fail

    This circumvents the quality gate entirely. Coverage will continue to drop over time without enforcement, accumulating untested code.

  2. Adding trivial tests that increase coverage without testing meaningful behavior 65% fail

    Tests that merely call functions without asserting behavior provide false coverage confidence. They pass coverage checks but do not catch bugs.

Error Chain

Leads to:
Preceded by:
Frequently confused with: