# Test Coverage

> Measures and reports test coverage for the project. Use when asked about coverage, before PRs, or when coverage drops.

- Skill: `theophiluschinomona/test-coverage` (Agent Skill)
- Install (CLI): `npx skillmds@latest add theophiluschinomona/test-coverage`
- Raw SKILL.md: https://api.skillmd.com/api/skills/theophiluschinomona/test-coverage/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: TheophilusChinomona (https://skillmd.com/u/theophiluschinomona)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/theophiluschinomona/test-coverage

---


# Test Coverage Skill

## Purpose
Measure, report, and enforce test coverage thresholds.

## Activation
- User says "check coverage" or "what's the coverage?"
- Before creating a PR
- When coverage drops below threshold

## How It Works

### 1. Detect Test Framework
```
JavaScript/TypeScript:
  jest.config.* → npx jest --coverage
  vitest.config.* → npx vitest --coverage
  .nycrc → npx nyc report

Python:
  pytest.ini → pytest --cov
  pyproject.toml [tool.pytest] → pytest --cov

.NET:
  *.Tests.csproj → dotnet test /p:CollectCoverage=true
```

### 2. Run Coverage
```bash
# JavaScript/TypeScript
npx jest --coverage --coverageReporters=text-summary

# Python
pytest --cov=src --cov-report=term-missing

# .NET
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov
```

### 3. Report
```
Coverage Report
═══════════════
Lines:    85% (120/141)
Branches: 78% (45/58)
Functions: 92% (33/36)

Below 80% threshold:
  src/auth.ts: 65% (missing edge cases)
  src/utils.ts: 72% (missing error paths)
```

## Threshold
- Minimum: 80% line coverage
- Target: 90% line coverage
- Branches: 75% minimum

## Anti-Patterns
1. Do NOT skip coverage on "simple" files
2. Do NOT mock everything — integration tests need real calls
3. Do NOT ignore coverage drops — investigate and fix

