plugins/aai-stack-jest/skills/jest-coverage/SKILL.md
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/the-answerai/alphaagent-team/blob/main/plugins/aai-stack-jest/skills/jest-coverage/SKILL.md -a claude-code --skill jest-coverageInstallation paths:
.claude/skills/jest-coverage/# Jest Coverage Skill
Patterns for configuring and analyzing code coverage in Jest.
## Configuration
### Basic Coverage Config
```javascript
// jest.config.js
module.exports = {
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.test.{js,jsx,ts,tsx}',
'!src/**/__tests__/**',
'!src/**/__mocks__/**',
],
}
```
### Coverage Thresholds
```javascript
// jest.config.js
module.exports = {
coverageThreshold: {
// Global thresholds
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
// Per-directory thresholds
'./src/utils/': {
branches: 90,
functions: 90,
lines: 90,
statements: 90,
},
// Per-file thresholds
'./src/critical-module.ts': {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
}
```
### Coverage Reporters
```javascript
// jest.config.js
module.exports = {
coverageReporters: [
'text', // Console output
'text-summary', // Condensed console output
'lcov', // For CI tools (Codecov, Coveralls)
'html', // Browser-viewable report
'json', // Machine-readable
'json-summary', // Condensed JSON
'cobertura', // XML format for CI
'clover', // Clover XML format
],
}
```
## Running Coverage
### CLI Commands
```bash
# Run with coverage
jest --coverage
# Run specific files with coverage
jest --coverage --collectCoverageFrom='src/utils/**/*.ts' src/utils
# Update snapshots with coverage
jest --coverage --updateSnapshot
# Watch mode with coverage
jest --coverage --watch
# Coverage with verbose output
jest --coverage --verbose
# Coverage threshold check only
jest --coverage --coverageThreshold='{"global":{"lines":80}}'
```
### Package.json Scripts
```json
{
"scripts": {
"te