Jest can output coverage as a terminal summary, an HTML report, or machine-readable formats like LCOV and JSON. This lesson focuses on reading and interpreting these reports effectively.
The Terminal Summary Table
By default, jest --coverage prints a summary table to the terminal with one row per file (and a totals row at the top). Beyond the four percentage columns, there's a "Uncovered Line #s" column listing exactly which line numbers in that file were never executed.
This uncovered-line list is often the fastest way to jump directly to a specific gap without opening the HTML report at all.
Lines 22-25 and 41 in orderService.js never ran during any test — a direct pointer to what to test next.
Generating an HTML Report
// jest.config.js
module.exports = {
collectCoverage: true,
coverageReporters: ['text', 'html', 'lcov'],
};
// then open the generated file:
// coverage/lcov-report/index.html
coverageReporters controls which report formats Jest generates (text, html, lcov, json, and more).
The HTML report lets you click into any file and see line-by-line coverage highlighting.
lcov format integrates with CI tools and services like Codecov or Coveralls.
json-summary is useful for custom scripts or badges that read coverage programmatically.
Coverage Reporters Cheat Sheet
Common coverage reporter formats and their purpose.
Reporter
Output
text
Terminal summary table (Jest's default)
html
Browsable HTML report with line highlighting
lcov
Standard format for CI coverage integrations
json
Full machine-readable coverage data
json-summary
Compact totals, useful for badges/scripts
clover
XML format for some CI dashboards
Reading HTML Report Highlighting
In the HTML report, green highlighting means a line ran, red means it never ran, and yellow typically marks a partially covered branch (for example, an if statement whose true case ran but whose else never did). Scanning for yellow and red across your most important files is the fastest way to prioritize new tests.
Sending Coverage to CI Dashboards
Generating an lcov report and uploading it to a service like Codecov or Coveralls lets your team track coverage trends over time and see per-pull-request coverage changes directly in code review, without anyone needing to run coverage locally.
# Example CI step (conceptual)
npx jest --coverage --coverageReporters=lcov
# upload coverage/lcov.info to your coverage service of choice
Common Mistakes
Only glancing at the terminal percentage summary and never opening the detailed HTML report.
Not configuring coverageReporters, missing out on CI-friendly formats like lcov.
Ignoring the "Uncovered Line #s" column, which often points directly at what to test next.
Assuming yellow (partial branch coverage) highlighting means the same thing as red (no coverage).
Key Takeaways
The terminal report's "Uncovered Line #s" column points directly to untested code.
The HTML report provides interactive, color-coded, line-by-line coverage detail.
coverageReporters controls output formats, including CI-friendly lcov.
Uploading lcov output to a coverage service enables tracking trends over time.
Pro Tip
Before writing new tests for a legacy file, generate an HTML coverage report first and use the highlighted red/yellow sections as your test-writing checklist instead of guessing what might be untested.
You now know how to read coverage reports thoroughly. Next, learn how to enforce minimum coverage with thresholds.