---
title: "The test command passed because it ran no tests | Proofline"
description: "Check the number of tests executed before you accept a filtered run as evidence."
url: https://proofline.sh/learn/filtered-test-run-zero-tests/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# The test command passed because it ran no tests

Check the number of tests executed before you accept a filtered run as evidence. Several runners exit 0 when a name filter matches nothing, so a typing error looks like a pass.

Code review The Proofline team November 24, 2026 3 min read

## What each runner does with a filter that matches nothing

Each command below was given a name that no test has.

| Runner | Command | Output | Exit |
| --- | --- | --- | --- |
| Go 1.26 | `go test -run TestTypo .` | `ok ex 0.002s [no tests to run]` | 0 |
| Vitest 5.1 | `vitest run -t zzz` | `Tests 3 skipped (3)` | 0 |
| Node 24 | `node --test --test-name-pattern=zzz nt.test.mjs` | `tests 1`, `pass 1` | 0 |
| pytest 9.2 | `pytest -k zzz` | `1 deselected` | 5 |
| Playwright 1.65 | `playwright test -g zzz` | `Error: No tests found` | 1 |

The Node row is the most misleading. The file holds one test, named `real`, which did not run. The summary still says one test passed, and the name on that line is the file's. The [Node documentation](https://nodejs.org/api/test.html) says that tests excluded by the pattern are omitted from the output.

pytest documents exit code 5 as [no tests collected](https://docs.pytest.org/en/stable/reference/exit-codes.html). A file filter can behave differently from a name filter in the same runner: `vitest run nofile` exited 1.

## Ways to get there

-   A renamed test, with the old name still in the command.
-   Shell quoting. `-t "returns 'x'"` passes through two layers of quotes in a script.
-   A regular expression. A `(`, `[` or `+` in a test's name changes the match.
-   The wrong directory or project in a monorepo.
-   A flag that accepts emptiness on purpose, such as Playwright's `--pass-with-no-tests`, which made the same command exit 0.

## Send a count with every filtered result

> `go test -count=1 -v -run '^TestExportLimit$' ./api` at `4c1e9aa`: 1 test, 0 failed, exit 0.

`-v` prints each test's name, and `-count=1` stops Go from answering with a cached result. The equivalent in other runners is a verbose reporter or a JSON report, where the receiver can read the executed names.

The receiver compares two numbers: how many ran, and how many match in the source.

```
git grep -nE 'func TestExportLimit' 4c1e9aa
```

Subtests and table tests make the two differ for good reasons, so treat a difference as a question. Zero executed is the one value that always means the result says nothing.

## Make it fail in CI

For a step that must run a named test, assert on the count and not only on the status. In Go:

```
go test -json -count=1 -run '^TestExportLimit$' ./api > run.json &&
  grep -q '"Action":"pass".*"Test":"TestExportLimit"' run.json
```

The `&&` keeps a failure of `go test` itself, for example in teardown after the test passed. The second command fails when the test did not pass, including when it did not run. `go test` writes one JSON event per line, so the pattern only has to match inside a line.

## Worked example

This example is fictional. A handoff says that the regression test passes on the release branch, with the command. Ben reruns it with `-v` and sees `testing: warning: no tests to run`. The test was added on `main` and never picked to the release branch. The evidence was for an absent test, and the decision changes from "ship" to "backport the test and run it".

If the count is right and the exit code is in doubt, look for [a pipe that hides it](/learn/pipeline-hides-test-exit-code/). Return to [handing over evidence](/learn/engineering-handoff-evidence/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [The log says failed and the step is green](/learn/pipeline-hides-test-exit-code/)
    
    Code review The Proofline team November 24, 2026 3 min read
    
-   ### [Hand over skipped tests so that someone can un-skip them](/learn/skipped-tests-without-reason/)
    
    Code review The Proofline team November 24, 2026 3 min read
