-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
Claude Code doesn't know:
- Which code has tests, which doesn't
- Test quality (assertions, edge cases, mocks)
- Test-to-code ratio
- Which tests are flaky or slow
Developer Pain Points
❌ "I just wrote tests for code that already had tests"
❌ "AI suggested a change that broke untested code"
❌ "No guidance on what tests to write"
❌ "Tests are flaky but no visibility into which ones"
Proposed Solution
Test Coverage Service
```typescript
interface TestCoverageService {
// Parse test files
analyzeTests(projectRoot: string): Promise
// Map tests to source code
getTestsForFile(file: string): Promise<TestFile[]>
// Calculate coverage metrics
getCoverageMetrics(): Promise
// Identify missing tests
findUntested(): Promise<UntestedCode[]>
// Detect test smells
detectTestSmells(): Promise<TestSmell[]>
}
```
Features
-
Test File Parsing
- Support Jest, Mocha, Vitest, Playwright
- Extract test cases and assertions
- Map describe/it blocks to functions
-
Coverage Mapping
- Map test files to source files
- Track line/function/branch coverage
- Identify untested code paths
-
Quality Detection
- No assertions (empty tests)
- Only happy path (no edge cases)
- Missing mocks/spies
- Slow tests (>1s execution)
-
MCP Tools
- `test-analyze`: Analyze test coverage
- `test-suggest`: Suggest tests for file
- `test-quality`: Check test quality
- `test-untested`: Find untested code
Integration with ImplementationValidator
Add test coverage check:
```typescript
if (testCoverage < 80%) {
warnings.push("Low test coverage: " + coverage + "%")
suggestions.push("Add tests for: " + untestedFiles)
}
```
Acceptance Criteria
- TestCoverageService created
- Supports Jest, Vitest
- Maps tests to source files
- Detects 5+ test smells
- 4 MCP tools registered
- Integrated with validation pipeline
- Tests and documentation
Priority
🔴 Critical - Huge developer pain point
Effort Estimate
3 days