ghosttest
How many of your tests actually run?
---
The problem
Somebody writes user.spec.ts. Your Jest config says testMatch: ["/.test.ts"].
The file is never collected. The tests inside it have never run — not once, not in CI, not locally. The suite passes. Coverage does not drop, because uncovered files were never in the denominator. Code review sees a file full of tests and approves it.
Nothing anywhere reports this. There is no warning, no error, no summary line. Jest cannot tell you about a file it does not know exists.
The same thing happens four other ways:
- a .only left behind after debugging silently switches off every other test
in that file — and the run still says PASS;
- an ignore pattern added for one directory quietly swallows another;
- a test moved outside roots;
- a test that asserts nothing and therefore cannot fail.
Every one of these is invisible from a green build. That is what makes them expensive: the build is not just failing to catch bugs, it is actively reporting that it checked.
ghosttest counts the tests in your repository, counts the ones that will run, and tells you where the difference went.
What it looks like
$ ghosttest
13 tests found · 4 will run · 9 never will
█████████▎ 31%
5 in files never collected · 3 suppressed by a focused test · 1 skipped
runner: jest — collection rules read exactly from JSON (package.json)
error uncollected-test-file legacy/cart.test.js:1
2 tests in this file, and jest would not collect it — it is excluded by `/legacy/`.
so: These tests have never run. The suite passes without them, so nothing has
ever reported that this code is untested — which is worse than having nofix: Narrow the exclude pattern. Exclusion is applied after matching, so a broad entry silently beats a correct include.
error focused-test-committed src/checkout.test.js:2 A focused test on line 2 silently switches off the other 3 tests in this file.
Two numbers, side by side. That is the whole product.
## Install