From harness-claude
Configures Vitest test coverage with thresholds, per-file gates, exclusions, reporters, and ignores. Interprets lines, branches, functions, statements for CI quality gates and undertested code.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Configure and interpret test coverage thresholds for meaningful quality signals
Checks and configures code coverage thresholds, reporters, and CI integrations like Codecov for Vitest, Jest, pytest, and Rust projects.
Runs coverage tools like pytest-cov and istanbul/c8 via Bash to analyze test coverage, identify gaps, and provide actionable test recommendations.
Queries test coverage in Python, Node.js, Rust, Go projects. Identifies uncovered areas/files, analyzes trends, and generates reports before changes or PRs.
Share bugs, ideas, or general feedback.
Configure and interpret test coverage thresholds for meaningful quality signals
// vitest.config.ts
export default defineConfig({
test: {
coverage: {
provider: 'v8', // or 'istanbul'
reporter: ['text', 'html', 'lcov'],
include: ['src/**/*.ts'],
exclude: ['src/**/*.test.ts', 'src/**/*.d.ts', 'src/**/index.ts'],
},
},
});
Run with: vitest --coverage
coverage: {
thresholds: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
CI fails if coverage drops below these thresholds.
coverage: {
thresholds: {
'src/services/**': { branches: 90, functions: 90, lines: 90, statements: 90 },
'src/utils/**': { branches: 70, functions: 70, lines: 70, statements: 70 },
},
},
if/else, switch, ternary paths takenBranch coverage is the most meaningful metric. A file can have 100% line coverage but miss error-handling branches.
coverage: {
exclude: [
'src/**/*.test.ts',
'src/**/*.stories.ts',
'src/generated/**',
'src/**/index.ts', // barrel files
'src/**/*.d.ts',
'src/main.ts', // entry point
],
},
/* v8 ignore next */ or /* istanbul ignore next */ sparingly for code that cannot be tested:/* v8 ignore next 3 */
if (process.env.NODE_ENV === 'development') {
enableDevTools();
}
vitest --coverage
open coverage/index.html
The HTML report highlights uncovered lines in red and shows branch coverage inline.
// Start low, increase as coverage improves
coverage: {
thresholds: {
lines: 60, // Current: 62% — ratchet up as tests are added
branches: 50, // Current: 53%
},
},
Code coverage measures which lines, branches, and functions your tests exercise. It is a negative indicator — low coverage definitively means undertested code. High coverage does NOT mean well-tested code.
V8 vs Istanbul providers:
Coverage anti-patterns:
Meaningful thresholds by code type:
Coverage in CI:
lcov reporter for SonarQube, Codecov, or Coveralls integrationTrade-offs:
https://vitest.dev/guide/coverage.html