COVERAGE DROP CHECK · GUIDE

Why did my PR drop coverage when I didn't touch tests?

Coverage is a ratio, not a count of tests. A pull request can lower the number without deleting a single assertion — see the first question below for the arithmetic, then the file list for which modules actually moved.

See the delta first

Guessing from the overall percentage wastes time writing tests in the wrong file. Compare the coverage XML from main against the one from this PR and let the file list tell you — free, runs in your browser, nothing uploaded.

Open Coverage Drop Check →

Common questions

How can coverage drop if I didn't delete any tests?

Coverage is covered lines divided by executable lines. Adding a new branch, a new file, or a refactor that introduces executable lines you did not test increases the denominator. The tests you already had still pass; the rate still falls.

Why did --cov-fail-under=80 still pass after a big drop?

A floor only asks whether the current number is above a threshold. A drop from 92% to 81% is 11 points and still above 80, so the floor stays green. A delta check against a baseline report is what catches that.

Does deleting a well-tested file raise or lower coverage?

It can go either way. Removing a 100%-covered module raises the overall rate if the remaining code was worse; removing a poorly covered module lowers the rate. The file list on a delta report is what tells you which happened, not the single overall number.

How do I see which files actually dropped before I start writing tests?

Keep the coverage XML from main (or the last release) and produce one from the pull request, then compare them. The free Coverage Drop Check tool on this site does that from Cobertura or JaCoCo reports you already have, with no signup and nothing uploaded.

The four changes that move the number most often

1. New untested branches on an existing file

An extra if, an error path, or a feature flag adds executable lines. Existing tests still hit the old path, so they stay green, and the file's rate falls. This is the most common "I didn't touch tests" drop.

2. A new file with no tests yet

A new module starts at 0% unless you added tests in the same PR. The overall rate drops in proportion to how large the file is, even when every previously covered file is unchanged.

3. A refactor that rewrites executable lines

Extracting a helper, inlining a function, or moving code between files can change which lines the same tests hit. The behaviour is identical; the coverage map is not. Compare the file list before assuming tests are missing.

4. A floor check that hid a previous drop

--cov-fail-under and similar gates only fire at a threshold. A series of small PRs can walk coverage from 94% to 81% one point at a time without any of them failing the floor. A delta against main on every PR stops that walk.