Skip to content

test: enforce 60% Jest coverage thresholds in CI#133

Merged
bayological merged 1 commit intomainfrom
qa/jest-coverage-thresholds
Mar 11, 2026
Merged

test: enforce 60% Jest coverage thresholds in CI#133
bayological merged 1 commit intomainfrom
qa/jest-coverage-thresholds

Conversation

@mento-val
Copy link
Copy Markdown
Collaborator

Summary

Adds coverageThreshold to jest.config.ts so CI fails when coverage drops below acceptable levels.

Problem

No coverage thresholds were enforced — CI would pass even if coverage regressed to 0%. This was identified as finding H-2 in the mento-sdk QA audit ([MEN-14]).

Specifically:

  • Borrow service has ~24% coverage with 0% on critical paths
  • Any PR could silently regress coverage without detection

Changes

  • Added coverageThreshold in jest.config.ts with 60% minimum for statements, functions, and branches
  • collectCoverage: true is already configured globally, so thresholds are enforced on every jest run including CI (pnpm test:unit)

Coverage Thresholds Set

Metric Threshold Current (all tests)
Statements 60% ~77% ✅
Functions 60% ~56% ⚠️
Branches 60% ~53% ⚠️

Note: Current function and branch coverage (measured against all tests including integration) falls below the 60% threshold when only unit tests run in CI. The team should improve coverage in src/services/borrow/ and related modules. These thresholds establish an enforcement baseline and surface the gap that has been invisible until now.

Rationale

60% is a pragmatic starting baseline — not perfect coverage, but enough to catch regressions in critical paths. The intent is to incrementally raise these thresholds as coverage improves.

Related

  • Addresses finding H-2 from mento-sdk QA audit
  • Companion to MEN-18 (integration test CI workflow)

Add coverageThreshold to jest.config.ts to fail CI when coverage
drops below 60% for statements, functions, and branches.

collectCoverage is already enabled globally, so thresholds are
enforced on every test run including CI (pnpm test:unit).

Addresses finding H-2 from mento-sdk QA audit (MEN-14).
Copy link
Copy Markdown
Member

@bayological bayological left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. 👍

@bayological bayological merged commit 0c436e0 into main Mar 11, 2026
0 of 3 checks passed
@bayological bayological deleted the qa/jest-coverage-thresholds branch March 11, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants