Skip to content
Latchkey

Jest "Your test suite must contain at least one test"

Jest loaded a file matching your test pattern but found no test()/it() calls in it. A non-test file got matched, every test is skipped, or the suite is genuinely empty.

What this error means

Jest fails one specific file with "Your test suite must contain at least one test." The rest of the run may pass - only the empty or fully-skipped file is reported as a failure.

jest
FAIL src/setupHelpers.test.ts
  ● Test suite failed to run

    Your test suite must contain at least one test.

Common causes

A helper file matched the test pattern

A file named *.test.ts (or under __tests__) holds only fixtures/helpers and no it(). Jest treats it as a suite and reports it empty.

All tests are skipped or filtered out

Every test uses it.skip/xit, or an it.only/--testNamePattern elsewhere filtered them all out, leaving zero runnable tests.

How to fix it

Exclude non-test files from the pattern

Rename helper files so they do not match, or narrow testMatch/testPathIgnorePatterns.

jest.config.js
// jest.config.js
module.exports = {
  testPathIgnorePatterns: ['/node_modules/', '/__tests__/helpers/'],
};

Add a real test or unskip

  1. If the file should have tests, add at least one it()/test().
  2. If everything is it.skip/xit, unskip the tests you meant to run.
  3. Check for a stray it.only in another file that filtered this one to zero.

How to prevent it

  • Name fixtures and helpers so they fall outside testMatch.
  • Lint for focused/skipped tests with eslint-plugin-jest.
  • Keep helper modules outside the test glob entirely.

Frequently asked questions

What causes ""must contain at least one test""?
A file named *.test.ts (or under __tests__) holds only fixtures/helpers and no it(). Jest treats it as a suite and reports it empty.
How do I fix "must contain at least one test"?
Rename helper files so they do not match, or narrow testMatch/testPathIgnorePatterns.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card