chore(test): add jest coverage thresholds and lcov reporter#317
Open
shinzoxD wants to merge 2 commits into
Open
chore(test): add jest coverage thresholds and lcov reporter#317shinzoxD wants to merge 2 commits into
shinzoxD wants to merge 2 commits into
Conversation
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
…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.
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 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
coverageThresholdblock injest.config.jswith a global floor of 50/60/65/65 (branches/functions/lines/statements) and stronger per-file floors forsrc/lib/format.ts(100/100/100/100) andsrc/lib/theme.ts(90/90/90/70).test:coveragenpm script to emit bothtext-summaryandlcovreporters so external services (Codecov / Coveralls) can render per-file coverage.Why
jest.config.jsalready collects coverage fromsrc/**/*.{ts,tsx}but never enforces a floor, so coverage has been silently regressing (and the existingtest:coveragescript 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 tocoverage/lcov.infonpx jest— no threshold violations on currentmain(verified locally before opening this PR)Linked issue
Closes #304
Payout wallet (Stellar):
GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXHGrantFox OSS campaign — smart escrow payout on merge.