Statement vs branch coverage, with decision, line and path coverage
One function, four test sets, three tools: what statement, line, branch, path and MC/DC coverage each report.

Statement coverage counts the statements your tests ran. Branch coverage
counts the outcomes of each decision: both the true and the false side of
every if. One test can run every statement and still skip half the
branches. In coverage tools, decision coverage means the same as branch
coverage. Path coverage counts whole routes through a function, and none of
the tools we measured reports it.

The kinds at a glance
| Kind | Counts | Reported by |
|---|---|---|
| Line | Lines with code that ran | Istanbul, V8, JaCoCo, coverage.py |
| Statement | Statements that ran; a line can hold several | Istanbul, V8, coverage.py, go test -cover |
| Branch (decision) | Each outcome of each if, ?:, &&, switch | Istanbul, V8, JaCoCo, coverage.py --branch |
| Condition / MC/DC | Each condition inside a decision, shown to matter | Supercov |
| Path | Every route through the function | None of the tools we measured |
We measured one function with Jest 30.5.2, coverage.py 7.17.2 and Go 1.27.4, then with Supercov 4.28.0:
function price(cents, member, coupon) {
let total = cents;
if (member && cents >= 5000) total = total - 500;
if (coupon) {
total = total / 2;
}
return total;
}One test: every statement, half the branches
price(6000, true, true);| Tool | Statements | Branches |
|---|---|---|
| Jest (Istanbul) | 7/7 | 4/6 |
| coverage.py | 6/6 | 1/2 with --branch |
go test -cover | 100% | Not reported |
Every statement ran, so statement and line coverage read 100%. Neither if
was ever false. Jest counts six branches: two outcomes for each if, plus
the two sides of &&. go test -cover reports statements only, so the
missing outcomes do not show at all.
coverage.py counted 2 branches, not 4, because the first if and its body
share a line, and it tracks branches as jumps between lines. Written over two
lines, the same test showed 4 branches with 2 partial, and the report listed
the missing jumps 3->5, 5->7.

Two tests: 100% branches, half the paths
price(6000, true, true);
price(1000, false, false);
Branch coverage reached 6/6 in Jest and 100% in coverage.py: each if went
both ways. The function has four paths, member discount with or without the
coupon, and no discount with or without it. These two tests ran two of them.
Reaching all four took four tests, and no tool’s numbers changed on the way:
path coverage is not something they count.
Decision vs condition coverage
At 100% branch coverage, cents >= 5000 had never been false. The second
test set member to false, so && stopped before reaching cents. Jest’s
&& branch counts whether each side ran, not whether it was ever false, so
it still read 6/6.
LINE STATUS SOURCE
3 PARTIAL member && cents >= 5000
Unobserved: `cents >= 5000` was never false; needs `member` true,
`cents >= 5000` false, decision false
Supercov reported this as an MC/DC gap. Adding price(1000, true, false)
closed it with three tests. The four tests that ran every path did not:
none of them had a member with a small order, so the gap was still there. See
MC/DC vs branch coverage for how the two
differ on larger decisions.
Which to use
Statement or line coverage tells you what never ran. Branch coverage tells you
which decisions only ever went one way, and is the usual number to put a
floor on. Condition and MC/DC coverage tell you which part of a compound
condition no test changed. Path coverage doubles with every if in
sequence, which is why the tools leave it out, and as the four tests above
showed, every path still does not mean every condition.
What Supercov adds
npx supercov -- npm test
npx supercov runs latest file src/price.js
Supercov reports lines, statements, branches and MC/DC in one run, and names the test that covered each line. See Line, statement and branch coverage for how each tool counts lines.
More coverage guides
- Jest coverageThreshold: global, per-folder and per-file
- JaCoCo aggregate report for multi-module Maven and Gradle builds
- pytest ignore directory: --ignore, norecursedirs and collect_ignore
- Merge coverage reports from shards: Vitest, Jest and coverage.py
- JaCoCo report not generated: the causes in Maven and Gradle
- Kover exclude: classes, packages and generated code
- sonar.coverage.exclusions: why SonarQube ignores your JaCoCo excludes
- istanbul ignore next vs c8 ignore next: every hint, measured
- Go test coverage exclude: files, packages and mocks
- Jest coverage exclude: files, folders and lines
- pytest coverage exclude: omit files, folders and lines
- Vitest coverage exclude: files, folders and lines
- JaCoCo exclude in Maven and Gradle: packages, classes and generated code