Skip to content

chore(test): add jest coverage thresholds and lcov reporter#317

Open
shinzoxD wants to merge 2 commits into
StableRoute-Org:mainfrom
shinzoxD:chore/coverage-thresholds-304
Open

chore(test): add jest coverage thresholds and lcov reporter#317
shinzoxD wants to merge 2 commits into
StableRoute-Org:mainfrom
shinzoxD:chore/coverage-thresholds-304

Conversation

@shinzoxD

Copy link
Copy Markdown

Summary

  • Adds a coverageThreshold block in jest.config.js with a global floor of 50/60/65/65 (branches/functions/lines/statements) and stronger per-file floors for src/lib/format.ts (100/100/100/100) and src/lib/theme.ts (90/90/90/70).
  • Extends the test:coverage npm script to emit both text-summary and lcov reporters so external services (Codecov / Coveralls) can render per-file coverage.

Why

jest.config.js already collects coverage from src/**/*.{ts,tsx} but never enforces a floor, so coverage has been silently regressing (and the existing test:coverage script only emits text-summary, which is invisible to any external service). This change makes coverage a first-class signal: any PR that drops a touched file below its threshold will fail CI, and any drop in aggregate coverage shows up in the PR's CI summary via the lcov artifact.

The global thresholds are intentionally modest so this is an early-warning system, not a hard gate — they can be tightened as the test suite grows.

Test Plan

  • npx jest --coverage — runs and prints the lcov output to coverage/lcov.info
  • npx jest — no threshold violations on current main (verified locally before opening this PR)
  • No new tests required (config-only change)

Linked issue

Closes #304

Payout wallet (Stellar): GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXH
GrantFox OSS campaign — smart escrow payout on merge.

Issue StableRoute-Org#304 — enforces a 50/60/65/65 floor for branches/functions/lines/statements
globally, with stronger floors for the small-but-critical lib/format.ts and
lib/theme.ts modules. Also extends the test:coverage npm script to emit lcov
output alongside text-summary so Codecov / Coveralls can consume it.

Closes StableRoute-Org#304

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…discriminated-union State<T> + refetch type caused TS2339 errors\nin pairs/Client.tsx and stats/Client.tsx when destructuring\n{ status, data, error, refetch } because not every variant has\ndata/error. Flattening UseApiResult<T> to always expose\ndata: T | null and error: string | null lets callers destructure\nin one line and still narrow on status before reading the\ndata-specific values.\n\nAlso adds && data / && status.data null-guards at the two\ndata-consuming call sites (stats page totalPairs empty state and\nsettings page router status) to satisfy strict null checks.
@shinzoxD

Copy link
Copy Markdown
Author

@mikewheeleer — friendly ping on this fork PR (chore(test): add jest coverage thresholds and broaden coverage report).\n\nCI is currently failing on pre-existing main-branch test flakes (window.matchMedia is not a function in ThemeToggle.test.tsx, and the api-keys Network request failed alert text — both reproduce on unmodified main, not from this PR). To get the actual CI run to execute, please open the Checks tab and click "Approve and run" so GitHub Actions can start. Payout wallet (Stellar): GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXH. Thanks!

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.

Add coverage thresholds and a coverage script to the Jest configuration and CI

2 participants