fix(coverage): emit coverage report when tests fail#84
Merged
Conversation
Add `reportOnFailure: true` to vitest's coverage config. Without it, vitest skips writing `coverage/coverage-summary.json` when any test fails — which makes the Coverage Floor workflow fail with "no coverage-summary.json produced" on every PR with even one flaky test. The Coverage Floor reusable uses `npm test -- --coverage || true` to tolerate vitest's non-zero exit, but the `|| true` can't recover a file that vitest never wrote. The fix is on the caller side. Reproduced locally: with this flag set, `vitest run --coverage` writes `coverage/coverage-summary.json` (lines: 72.07%) even when 3 tests fail. This unblocks the main-protection ruleset's `coverage-floor` required check so PRs can land without admin bypass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No issues found. Single config-option change with no logic, auth, or safety surface — the coverage/CI interaction is intentional and correctly described. |
|
Coverage Floor — mode:
|
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
reportOnFailure: trueto vitest's coverage config socoverage/coverage-summary.jsongets written even when tests fail.no coverage/coverage-summary.json producedon every PR that has even one flaky test (the workflow's|| trueonvitest --coverageswallows the exit code, but vitest never wrote the file in the first place).Why now
Coverage Floor has been failing on every nanoclaw PR since 2026-05-24 (one test in
src/brain/__tests__/wiki-projection.test.tsstarted failing intermittently — fixing it is a separate task). PR #83 was admin-bypass-merged for this same reason. With this fix, Coverage Floor will produce a real measurement regardless of test failures, and the main-protection required check can gate PRs cleanly.Repro / verification
Locally with the prior config (no
reportOnFailure):With the fix:
Above the current floor of 70.8 — no recalibration needed.
Auto-merge rationale
Trivial test-config tweak (1 option in
vitest.config.ts). Not in any high-risk surface (no auth/secrets/migrations/billing/destructive ops/prod infra/customer-facing copy).Codex pre-review
Skipped — 1-line config change (5 LOC including comment), far below the threshold.
Test plan
measured coverage:value (not theno coverage-summary.jsonerror)🤖 Generated with Claude Code