## TL;DR

Jest found a test file with zero tests in it. Either the file has no `test` or `it` blocks (add one, or stop matching it with `testMatch`), every suite is skipped with `describe.skip` (unskip one, or delete the file), or it is a helper file that should never have been collected. In CI, `--passWithNoTests` turns the hard error into a pass.

## Error

```text
FAIL ./tests/helpers.test.ts
  Your test suite must contain at least one test.
```

## Steps

1. Open the named file and check for `test(` or `it(` blocks. Expected: you confirm whether the file defines any tests at all.
2. If it is a helper (shared fixtures, utilities), exclude it: add it to `testPathIgnorePatterns` in jest config, or rename it so it no longer matches `testMatch`. Expected: Jest stops collecting the file.
3. If every suite uses `describe.skip`, unskip at least one suite, or delete the file if it is dead code. Expected: the file registers one or more tests.
4. If the empty suite is expected in some environments (conditionally generated tests), run CI with `--passWithNoTests`. Expected: exit code 0 instead of 1 for that job.
5. Re-run the single file: `npx jest path/to/file`. Expected: it passes or fails on real assertions, not the empty-suite error.

## When to use

- The exact "Your test suite must contain at least one test" failure names a file.
- A helper or fixture file accidentally matches your test glob.
- An entire suite is skipped and CI treats the empty file as a failure.

## When not to use

- The file has tests but they are not found (check `testMatch` and `roots` instead).
- You want zero-test files to fail loudly; keep the default and fix the files.
- The error appears for every file (your `testMatch` probably matches nothing; different problem).

## Tool compatibility

- Jest 27 through 30.
- `--passWithNoTests` CLI flag, or `passWithNoTests: true` in config.
- `testPathIgnorePatterns` and `testMatch` in jest config.

## Variant phrasings

### jest test suite must contain at least one test

Same error. The file Jest collected registered zero tests.

### jest empty test file error

Usually a helper file matching the test glob, or a fully skipped describe block.

## Why it happens

Jest treats a collected file with no tests as a probable misconfiguration (wrong glob, or a broken import that swallowed the test definitions) and fails it rather than silently passing. Skipped suites register zero tests, so a fully `describe.skip`ped file trips the same error.

## Edge cases

- A file whose tests are generated conditionally (feature flags) trips this when the flag is off; scope `--passWithNoTests` to that job only.
- `test.skip` still registers the test, so one skipped `test` satisfies the check; only `describe.skip` empties the file.
- Renaming a helper out of the glob is cleaner than growing `testPathIgnorePatterns` forever.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_CL7RXAfOZsVVE_uGVfKofA
