Jest
Coverage Commands
Measure test coverage with Jest's built-in Istanbul integration. Generate coverage reports, set thresholds, and identify untested code paths to improve test quality.
8 commands
Pro Tips
Run 'jest --coverage --coverageReporters=text' for a quick terminal summary without generating HTML files.
Set coverage thresholds in jest config to fail CI if coverage drops: 'coverageThreshold: { global: { branches: 80 } }'.
Use 'collectCoverageFrom' to include files that have no tests yet — reveals completely untested modules.
Common Mistakes
100% coverage doesn't mean bug-free code. Focus on testing behavior and edge cases, not just hitting lines.
Coverage collection slows tests significantly. Only enable '--coverage' in CI, not during local development.