In short
Coverage tells you which lines your tests actually ran. It's brilliant for spotting code nobody tests, and terrible as the only measure of whether your tests are any good.
A metric showing what percentage of your code is executed by your test suite — useful for finding untested areas, but a poor standalone measure of test quality.

Think of it like this
Painting the wall
You roll paint over the wall and step back. Most of it is violet, but the corners by the switchboard are bare. Coverage shows you those bare patches. But paint over a crack still hides the crack. Running a line isn't the same as checking it works.
Watch it happen
Coverage of applyCoupon(), line by line
1/5applyCoupon has 8 lines. The test suite calls it with one valid coupon.
The big ideas
What you need to know
Four numbers
Statements, branches, functions and lines. Branch coverage, both sides of every if, usually tells you the most.
Use it to find gaps
Open the HTML report and look for red lines in important code, like payments and auth.
100% isn't the goal
A test can run a line without asserting anything. High coverage with weak assertions is false comfort.
Set a floor, not a target
A CI threshold like 80% stops coverage dropping, without pushing people to write pointless tests.
See it in code
Walk through the code
1// jest.config.js2export default {3 collectCoverage: true,4 collectCoverageFrom: ["src/**/*.ts", "!src/**/*.d.ts"],5 coverageReporters: ["text", "html"],6 coverageThreshold: {7 global: { branches: 75, lines: 80 },8 "./src/payments/": { branches: 95, lines: 95 },9 },10};1/3Collect coverage from all source files, so untested files show up as 0% instead of vanishing.
Run npx jest, then open the HTML report in the coverage folder and click into a file to see uncovered lines in red.
Save yourself the pain
Common mistakes
Oops
Writing tests that call functions but assert nothing, just to raise coverage.
Do this instead
Coverage goes up and quality doesn't. Every test should check a result or a side effect.
Oops
Only looking at the overall percentage.
Do this instead
Look at which files and branches are uncovered. 90% overall can still mean the payment code is untested.
Your mission
Find your bare patches
Quick check
A function's tests reach 100% line coverage. What does that guarantee?
Go deeper
- 1Run a coverage report on a project and identify the least-tested files.
- 2Add tests for one genuinely important untested code path, not just to raise the percentage.
- 3Learn why 100% coverage doesn't guarantee your tests actually catch bugs.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.