Analyzes test coverage, identifies untested code paths, and generates tests for the most critical uncovered areas. Use to improve test coverage before releases.
!ls package.json jest.config.* vitest.config.* .nycrc* .c8rc* .coveragerc* setup.cfg pyproject.toml tox.ini 2>/dev/null
!cat package.json 2>/dev/null | grep -E "jest|vitest|c8|nyc|istanbul|coverage" | head -5
Attempt to run the project's coverage command:
| Ecosystem | Coverage Command |
|---|---|
| npm (Jest) | npx jest --coverage --json 2>/dev/null |
| npm (Vitest) | npx vitest run --coverage 2>/dev/null |
| npm (c8) | npx c8 report --reporter=json 2>/dev/null |
| Python (pytest) | python -m pytest --cov --cov-report=json 2>/dev/null |
| Go | go test -coverprofile=coverage.out ./... 2>/dev/null && go tool cover -func=coverage.out |
| Rust | cargo tarpaulin --out json 2>/dev/null |
If coverage tools aren't configured, proceed with static analysis.
For the target file(s):
| Metric | Value |
|---|---|
| Line coverage | XX% |
| Branch coverage | XX% |
| Function coverage | XX% |
| Uncovered files | X |
List the most important uncovered code, prioritized by:
For each uncovered area:
For the top 5 most critical uncovered areas, generate test code following the project's test patterns (same structure as /write-tests).
| Priority | File | Current | Target | Tests Needed |
|---|---|---|---|---|
| 1 | ... | XX% | 80%+ | ... |
| 2 | ... | XX% | 80%+ | ... |