TurnSignal

Playwright "Error: No tests found": every cause and how to fix it

By · October 31, 2026 · 5 min read

In short

  • Playwright stops with "Error: No tests found" when, after every filter, not a single test is left to run.
  • Run npx playwright test --list first. It prints what Playwright can see, and an empty list points at discovery (testDir, file names, .gitignore) rather than at your filters.
  • Test files must sit under testDir (by default the folder of the config file) and match **/*.@(spec|test).?(c|m)[jt]s?(x): login.spec.ts is found, login.ts is not.
  • Playwright 1.63 skips this error with --pass-with-no-tests, with --shard, with --only-changed and with a test list file.

The two versions of the message

Playwright 1.63 prints one of two messages. Without file arguments:

Error: No tests found

When you passed file or folder arguments, it adds a hint, because those arguments are the usual suspect:

Error: No tests found.
Make sure that arguments are regular expressions matching test files.
You may need to escape symbols like "$" or "*" and quote the arguments.

Both mean the same thing: Playwright loaded your config, collected test files, applied every filter, and ended up with zero tests. The fix depends on which step removed them.

Step 1: see what Playwright sees

Before changing anything, list the tests without running them:

npx playwright test --list
npx playwright test --list --project=chromium
  • The list is empty without any filter: Playwright finds no test files. Go to [discovery](#discovery).
  • The list has tests, but your real command finds none: a filter removes them. Go to [filters](#filters).
  • The command fails before listing: the config or a test file did not load; read that error first. A common one is "Playwright Test did not expect test() to be called here".

Discovery: no test files found

The file name does not match testMatch

Playwright's default testMatch is the glob **/*.@(spec|test).?(c|m)[jt]s?(x). A file needs .spec or .test before an extension such as .ts, .js, .mts or .tsx. This is the typical TypeScript case: tests/login.ts is ignored, tests/login.spec.ts is found. Rename the file or set testMatch in the config.

testDir points to the wrong place

testDir defaults to the folder that contains the config file, and a relative testDir is resolved from there too, not from where you run the command. If the folder does not exist, Playwright 1.63 collects no files and says nothing else: a typo such as testDir: './test' for a folder called tests ends in "No tests found".

// playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
  testDir: './tests',
  testMatch: '**/*.spec.ts',
});

The wrong config, or none at all

Playwright looks for playwright.config.ts (or .js, .mjs and the other variants) in the current directory. Run from the root of a monorepo, it may not find the config of the package you meant, and then searches for tests with default settings. Run the command in the package folder, or pass the config: npx playwright test -c packages/web/playwright.config.ts.

The files are in .gitignore

This one is easy to miss. When neither the config nor any project sets testDir, Playwright skips files that match .gitignore entries while it searches for tests. If your tests live in a folder that is ignored by git, for example generated tests in generated/, they are never found. Set testDir explicitly, or set respectGitIgnore: false.

Filters: tests found, then all removed

  • File arguments are regular expressions. npx playwright test login runs files whose path matches login. Characters such as $, *, ( or . have regex meaning; quote the argument and escape them, or pass a plain part of the path.
  • `--grep` or `-g` matches nothing. It is matched against one string made of the project name, the file name, the describe blocks, the test title and the tags, separated by spaces (for example chromium login.spec.ts login shows an error @smoke). --grep-invert can remove everything too.
  • A project filter. --project with a name that does not exist fails with a different error ("Project(s) … not found. Available projects: …"). A project that exists but whose own testDir, testMatch or grep matches nothing ends in "No tests found".
  • `--last-failed` after a green run. The previous run had no failures, so there is nothing to re-run. See how --last-failed works.

When Playwright does not raise the error

In Playwright 1.63 the check is skipped in four cases:

  • --pass-with-no-tests: the run succeeds with zero tests. Useful for scripts that run a filtered subset that may legitimately be empty.
  • --shard: a shard that ends up with no tests is not an error. So a suite smaller than its shard count does not fail on the empty shards. See sharding on CI.
  • --only-changed: when no test file is affected by the change, nothing runs and that is fine.
  • --test-list <file> or --test-list-invert <file>: the run is driven by a list file.

Be careful with --pass-with-no-tests in CI. It turns "we ran nothing" into a green check. A config change that breaks discovery, such as a renamed folder, would then pass every pipeline silently.

Related: "did not expect test() to be called here"

This error is not "No tests found", but it often comes up while debugging one. Playwright 1.63 lists the common reasons in the message itself:

  • calling test() in a configuration file, or in a file imported by it;
  • two different versions of @playwright/test installed, usually because a dependency depends on it;
  • calling test() from an async test.describe() callback; only synchronous ones are supported.

For the version case, npm ls @playwright/test shows every copy in the tree.

A run that tests nothing is a result too

The dangerous version of this problem is the quiet one: not zero tests, but fewer than there should be. A folder renamed, a testMatch narrowed, a shard killed before it reported, and the run is green with 600 tests instead of 900. Compare the test count with the previous run when something looks too fast.

TurnSignal records which tests each shard planned to run and lists the ones that never reported as Missing, so a run that quietly lost tests does not look like a clean pass. See tests missing after a crashed shard and the docs.

Questions people ask

Does Playwright find tests in node_modules?

Playwright collects files under testDir that match testMatch and not testIgnore. Keep tests in their own folder and set testDir to it, so dependencies and build output are never searched.

Do skipped tests count as found?

Yes. test.skip(), test.fixme() and skip conditions do not remove a test from the run; it is found and reported as skipped. Only filters and discovery can leave zero tests.

Can I run a single file without hitting the regex problem?

Pass a part of the path that has no special characters, for example npx playwright test login.spec, or a file with a line number, npx playwright test login.spec.ts:42.

Does "No tests found" fail the CI job?

Yes. It is an error, so the command exits with a non-zero code, unless one of the exceptions above applies.

Sources

Playwright details were checked against Playwright 1.63 and its documentation on October 31, 2026.

Try TurnSignal on your next run

Add one reporter line next to your existing reporters. Free to start, no credit card, no repository access.

Get started free Read the docs