rtk vitest drops coverage threshold errors: a failing coverage run renders PASS (N) FAIL (0)
Summary
rtk vitest run --coverage drops vitest's coverage threshold errors. When every test passes but coverage is below a configured threshold, vitest exits 1 and prints ERROR: Coverage for … does not meet global threshold. rtk prints only PASS (N) FAIL (0).
The exit code is still 1, so CI goes red. But the summary that a person or an LLM reads says nothing failed, and it gives no hint that coverage is the reason. The full output is only in the tee log.
Related: #220 (coverage data is lost), #3935 (suite-level failures dropped from the vitest summary). This is a third way a failing vitest run renders as green.
- rtk 0.51.0 (aarch64-apple-darwin)
- vitest 4.1.11, @vitest/coverage-v8 4.1.11
- Node 24.16, macOS
With vitest 5.0.4 the parser fails ([RTK:PASSTHROUGH] vitest parser: All parsing tiers failed) and the raw output passes through, so the error is visible there.
Repro
mkdir rtk-vitest-cov && cd rtk-vitest-cov
echo '{ "name": "rtk-vitest-cov", "private": true, "type": "module" }' > package.json
npm i -D vitest@4 @vitest/coverage-v8@4
cat > math.js <<'EOF'
export const add = (a, b) => a + b
export const sub = (a, b) => a - b
EOF
cat > math.test.js <<'EOF'
import { expect, test } from 'vitest'
import { add } from './math.js'
test('add', () => expect(add(1, 2)).toBe(3))
EOF
cat > vitest.config.js <<'EOF'
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: { coverage: { provider: 'v8', include: ['math.js'], thresholds: { functions: 100 } } },
})
EOF
npx vitest run --coverage; echo "exit $?"
rtk vitest run --coverage; echo "exit $?"
Actual
PASS (1) FAIL (0)
[full output: ~/…/rtk/tee/…_vitest_run.log]
exit 1
Raw vitest
Test Files 1 passed (1)
Tests 1 passed (1)
…
Functions : 50% ( 1/2 )
…
ERROR: Coverage for functions (50%) does not meet global threshold (100%)
exit 1
Expected
The ERROR: Coverage for … does not meet global threshold lines kept in the output, or at least a summary that doesn't read as a pass. For example:
PASS (1) FAIL (0)
ERROR: Coverage for functions (50%) does not meet global threshold (100%)
wshm · Automated triage by AI
🔍 Automated Triage
| 🐛 Category | bug |
| 🟠 Priority | high |
| 🎯 Confidence | 90% |
Summary
rtk vitest's summary parser drops vitest coverage-threshold errors, rendering a coverage-failing run as PASS (N) FAIL (0) despite exit code 1.
📁 Relevant files
src/filter/vitest.rssrc/pipe/vitest.rs
Suggested Actions
- Reproduce with the provided repro script against vitest 4.1.11 + @vitest/coverage-v8
- Relate to #220 (coverage data lost) and #3935 (suite-level failures dropped) — likely same parser code path
- Surface
ERROR: Coverage for … does not meet global thresholdlines in the rtk summary, not just exit code - Note vitest 5.0.4 already falls back to passthrough via parser failure — confirm fix doesn't regress that path
Triaged automatically by wshm · This is an automated analysis, not a human review.