Testingintermediate
Analyze test coverage gaps and suggest tests to write
Test Coverage Analyzer
Analyze test coverage gaps and suggest tests to write
Analyze test coverage gaps and suggest which tests to write next.
Instructions
- Run coverage report:
# JavaScript (Jest/Vitest)
npx jest --coverage --coverageReporters=text
# or
npx vitest --coverage
# Python
pytest --cov=src --cov-report=term-missing
# Go
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
-
Identify gaps — focus on:
- Uncovered branches: if/else paths not exercised
- Uncovered functions: public functions with 0% coverage
- High-risk uncovered code: error handlers, auth checks, payment logic
-
Prioritize by risk:
Priority What to test Why Critical Auth, payments, data mutations Security & correctness High Business logic, API endpoints User-facing behavior Medium Utility functions, formatters Catch edge cases Low Logging, analytics, UI styling Unlikely to cause bugs -
Generate test suggestions: For each uncovered function, write a test skeleton with the cases needed.
Target Coverage
- Overall: 80%+
- Critical paths (auth, payments): 95%+
- New code: 100% (enforce in CI with --changedSince flag)