test-gap-finder
Procedure
- Detect test layout:
tests/, __tests__/, *_test.go, *.test.ts, test_*.py, spec/. Detect the runner from config (jest, vitest, pytest, go test, cargo test).
- Build the map: list source files (exclude generated, vendored, migrations). For each, find tests that import or name it (grep the module path/name inside test files). Result:
module | test files | test count (rough: count of test functions).
- If a coverage report is cheap, run it:
pytest --cov --cov-report=term-missing -q, npx vitest run --coverage, go test -cover ./.... Skip if it takes > 2 min or needs services.
- Rank untested/under-tested modules by: recent churn (
git log --since=90.days --format='' --name-only | sort | uniq -c), size (wc -l), and whether they sit on a critical path (auth, payments, data writes, public API).
- For the top 5, propose tests: file path, test names, and 2 to 4 concrete cases each (happy path, boundary, failure). Reference the module's real function signatures (read the code).
- Output a table plus the proposals. Ask before writing any test files; if approved, write them following the repo's existing test style and run them.
Rules
- Do not claim a coverage percentage unless a coverage tool produced it.
- Do not propose tests for generated code, vendored code, or trivial getters.
- Proposed cases must be derivable from the code read in this session.
Eval
evals/test-gap-finder/: fixture Python package with auth.py (untested, high churn), utils.py (tested), payments.py (untested); expected: auth.py and payments.py ranked top, utils.py not proposed, ≥2 concrete cases per proposal, no test files written.
1---2name: test-gap-finder3description: Use when the user asks what to test next, where coverage is weak, or before a refactor of untested code. Maps source modules to existing tests, ranks untested modules by churn and size, and proposes the five highest-value tests with concrete names and cases, without writing them unasked.4---56# test-gap-finder78## Procedure91. Detect test layout: `tests/`, `__tests__/`, `*_test.go`, `*.test.ts`, `test_*.py`, `spec/`. Detect the runner from config (`jest`, `vitest`, `pytest`, `go test`, `cargo test`).102. Build the map: list source files (exclude generated, vendored, migrations). For each, find tests that import or name it (grep the module path/name inside test files). Result: `module | test files | test count (rough: count of test functions)`.113. If a coverage report is cheap, run it: `pytest --cov --cov-report=term-missing -q`, `npx vitest run --coverage`, `go test -cover ./...`. Skip if it takes > 2 min or needs services.124. Rank untested/under-tested modules by: recent churn (`git log --since=90.days --format='' --name-only | sort | uniq -c`), size (`wc -l`), and whether they sit on a critical path (auth, payments, data writes, public API).135. For the top 5, propose tests: file path, test names, and 2 to 4 concrete cases each (happy path, boundary, failure). Reference the module's real function signatures (read the code).146. Output a table plus the proposals. Ask before writing any test files; if approved, write them following the repo's existing test style and run them.1516## Rules17- Do not claim a coverage percentage unless a coverage tool produced it.18- Do not propose tests for generated code, vendored code, or trivial getters.19- Proposed cases must be derivable from the code read in this session.2021## Eval22`evals/test-gap-finder/`: fixture Python package with `auth.py` (untested, high churn), `utils.py` (tested), `payments.py` (untested); expected: auth.py and payments.py ranked top, utils.py not proposed, ≥2 concrete cases per proposal, no test files written.