Fail npm run cov if aggregate coverage falls under 100% - #1605
Conversation
node --test supports --test-coverage-lines/--test-coverage-branches/ --test-coverage-functions as minimum-threshold flags: node exits non-zero if the aggregate percentage across included files falls below the given value. cov previously only reported numbers; CI's node26 job ran it but nothing failed the build on a regression, which is how the coverage gaps in #1596/#1597/#1600 slipped through unnoticed until a repo-wide sweep found them. Sets all three thresholds to 100, matching AGENTS.md's existing 100%-coverage requirement for new code. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BmWCv5YGRXToq26xPoSXjX
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BmWCv5YGRXToq26xPoSXjX
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
functionalscript | 6ca3c02 | Commit Preview URL Branch Preview URL |
Aug 16 2026, 03:11 AM |
|
The Generated by Claude Code |
o2alexanderfedin
left a comment
There was a problem hiding this comment.
The gate demonstrably fails, which is the thing worth checking here — a threshold that never trips is worse than none. At this head npm run cov exits 0 with all files | 100.00 | 100.00 | 100.00. Appending an exported, never-called two-line function with a branch to fjs/types/string/module.f.mjs made the same command exit 1, aggregate dropping to 99.99 lines / 99.95 functions. File restored, tree clean.
Semantics confirmed: the threshold compares against the aggregate "all files" row (one file at 95% still tripped it), and Node's --help describes --test-coverage-lines as a minimum threshold. Only the node26 job (26.7.0) runs npm run cov — node22/node24 run bare node --test with no coverage flags, so nothing breaks on those. fjs/ci/node/module.f.mjs:68 emits test({ run: 'npm run cov' }) as a plain step, so the thresholds take effect without regenerating; npm run ci-update produced zero drift.
The include pattern is untouched and no exclude was added, so nothing was narrowed to make 100% trivially true. npx tsc exit 0; fjs t → 2882 pass / 0 fail.
Two non-blocking notes: the body omits the Changelog: section CONTRIBUTING calls mandatory, and 1605.md skips the topic: prefix its siblings (1596–1602) use.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BmWCv5YGRXToq26xPoSXjX
Summary
node --test's coverage support includes--test-coverage-lines,--test-coverage-branches, and--test-coverage-functions— minimum-threshold flags that make the run exit non-zero if the aggregate percentage across included files falls below the given value.covpreviously only reported coverage numbers; nothing in CI's node26 job actually failed the build when coverage regressed. That's how the gaps fixed in Bring asn.1 to 100% line/branch/function coverage: 90.91% → 100% branch #1596, Bring dev to 100% line/branch/function coverage: 97.50% → 100% branch #1597, and Bring djs/tokenizer back to 100% line/branch/function coverage: 98.86% → 100% branch #1600 slipped in unnoticed until a repo-wide sweep found them after the fact.No change to
.github/workflows/ci.ymlor the CI generator (fjs/ci/) is needed: the generatednode26job already runsnpm run covas a plain step, so the new thresholds take effect purely frompackage.json. Verified withnpm run ci-updatethat nothing else drifts.Sequencing note (resolved): this PR was opened before #1603 (the
js/tokenizercoverage fix) merged, so its own CI initially failed at exactly the gate this PR adds — confirming the gate works. #1603 has since merged; after rebasing,npm run covexits 0 locally with100.00 | 100.00 | 100.00aggregate.Test plan
npx tsc --noEmitnpm run ci-update→git statusshows onlypackage.jsonchanged (no generated-file drift)node ./fjs/module.mjs t→ 2882 pass, 0 failnpm run cov→ exits 0,100.00 | 100.00 | 100.00aggregate (after rebasing onto main with tokenizer: bring back to 100% coverage #1603)Changelog
npm run covnow fails the build if aggregate line, branch, or function coverage falls under 100%, instead of only reporting the numbers🤖 Generated with Claude Code