/coverage-gap
What to test next, prioritized by risk.
Usage
/coverage-gap # whole project
/coverage-gap src/lib/payments/ # scoped
/coverage-gap --threshold 80 # only show files below 80% coverage
What it does
- Runs your test command with coverage enabled (auto-detects Jest/Vitest/Pytest config)
- Parses the coverage report (lcov/json)
- Cross-references with git churn — files changed often + low coverage = highest risk
- Identifies the specific functions that lack coverage
- Suggests which to test FIRST based on:
- Risk (touches money, auth, DB writes)
- Churn (changed in last 30 commits)
- Complexity (cyclomatic > 10)
Output
Top 5 coverage gaps to address:
1. src/lib/payments/refund.ts → calculateRefund()
Coverage: 0% · Churn: 8 commits · Risk: HIGH (handles money)
Suggest: test edge cases — partial refund, expired window, currency mismatch
2. src/api/auth/reset.ts → POST handler
Coverage: 23% · Risk: HIGH (auth)
...
Rules
- Don't just report numbers — recommend ACTION (which test to write, why)
- Skip generated files (
.next/,dist/) - Adapt the test framework suggestion to whatever the project uses