Three abstract testing stations show an empty tray, a blocked blue capsule and a completed tray Three abstract testing stations show an empty tray, a blocked blue capsule and a completed tray

Vitest No Test Files: Check Whether Setup Failed First

Our pinned local comparison separates deliberate empty discovery, a harmless global setup failure and a passing control. Keep the full log and exit code together.

A Vitest global setup error can stop a run before any test body executes. Do not assume that a no-tests summary always means your file glob is wrong. Preserve the full output and find the first actionable error before changing discovery settings or weakening the command’s failure behavior.

We ran three small local fixtures with pinned Vitest 5.1.1 and 5.1.2. Both versions reported our harmless setup marker and exited 1 for the setup-error fixture. Only 5.1.1 also printed the misleading no-test-files phrase in that case. The intentional empty fixture and passing control remained distinct.

Vitest global setup error: what the release fixes

The Vitest 5.1.2 release, dated 25 November, lists a fix for reporting global setup errors instead of no test files. The linked upstream pull request explains that reporters could finish before the error reached state. Its correction records the error before the run ends.

That is a diagnostic-reporting change, not a promise that upgrading repairs a failing setup function. Our setup still throws deliberately in both versions. The useful difference is which evidence the runner presents alongside that failure. Keep the underlying exception and its location in view instead of judging the run by its shortest summary.

Three fixtures, one controlled distinction at a time

FixtureFiles in fixtureSetup behaviorPurpose
Empty by design0No global setupCheck deliberate discovery absence
Setup error1Throws EDITORIAL_SETUP_SENTINELCheck failure before test execution
Passing control1No global setupCheck one addition assertion
The file count describes the constructed fixture, not a claimed discovery count from the failed run. The setup sentinel is a harmless local exception; no application service is contacted.

The empty case points to an intentionally empty include path. The setup-error case includes a valid test file but adds a global setup function that throws. The passing control uses that same test file without the failing setup. This arrangement avoids treating three unrelated failures as though they had one cause.

Each pinned runtime used Node v22.23.1 and Vite 8.4.0, with one worker and the verbose reporter. We retained the commands and complete logs. An initial preceding-version installation lacked its Vite peer and failed at startup; that attempt was excluded from the comparison after the dependency was supplied and all cases were rerun.

Observed results from the pinned local runs

Version / fixtureExitSetup markerNo-test-files phraseOne test passed
5.1.1 / empty1absentpresentno
5.1.1 / setup_error1presentpresentno
5.1.1 / passing0absentabsentyes
5.1.2 / empty1absentpresentno
5.1.2 / setup_error1presentabsentno
5.1.2 / passing0absentabsentyes
Six local runs after runtime setup. Phrase checks inspect the full retained output. These are observations for this harness, not guarantees for every reporter, configuration or platform.
In the local setup-error fixture, Vitest 5.1.1 prints both the setup marker and no-test-files phrase; 5.1.2 prints the setup marker without that phrase. Both exit with code 1
Binary indicators describe phrase presence in one fixture log per version. They are not error counts, prevalence percentages or execution-time measurements.

The passing control exits 0 and reports one passed test in both versions. The deliberately empty case exits 1 and retains the no-test-files phrase in both. Therefore, the changed setup-error output should not be generalized into a claim that the phrase disappeared from the tool or that every empty run is a setup problem.

Read setup separately from test execution

The globalSetup reference places global setup before test workers and gives it a separate global scope. It also says setup runs only when at least one test is queued. The lifecycle guide separates initialization, setup, workers and test execution. Use those phases to locate the failure.

A file existing on disk is not proof that its assertions ran. In the setup-error fixture, the valid test is present, but our marker interrupts the earlier setup phase. Record that as a setup failure. Do not relabel the unexecuted assertion as a passed test or assume its behavior has been checked.

Diagnostic classification separates no matching file, incomplete setup and a test body that ran
Use the earliest actionable evidence to choose the next check. An empty fixture, setup failure and passing test require different explanations.

Reproduce safely in a disposable folder

The starter ZIP includes only small synthetic fixture files, commands and our logs. Install the stated pinned versions in a disposable directory and run each config separately. Keep the exit code with the output. Do not point the example at production databases, credentials or a client application’s services.

// global-setup.js
export default function () {
  throw new Error('EDITORIAL_SETUP_SENTINEL')
}

// setup_error.config.mjs
export default {
  test: {
    include: ['pass.test.js'],
    globalSetup: './global-setup.js'
  }
}

If your own run fails earlier during configuration or package loading, resolve that startup failure before comparing diagnostics. Retain the failed attempt as evidence, then rerun the same fixtures after the repair. Changing the test content and runtime at once would make the comparison harder to interpret.

Download the evidence and starter project

Download the synthetic starter project and retained logs (ZIP)

For related diagnostic habits, see our coverage-upload checklist and CSV schema fixture. A visible summary and the underlying evidence should be checked separately.

Method and limitations

Executed on 27 November 2026 on macOS using the recorded Node, Vite and Vitest versions. Each case was run once per version after runtime setup. The fixture is intentionally tiny and uses no browser mode, external services or real application code. We did not benchmark performance, establish error prevalence or test every diagnostic path. Reproduce the relevant case in your own permitted environment before drawing a broader conclusion.

Suggested citation: Learn Coding USA, “Vitest No Test Files: Check Whether Setup Failed First”, 27 November 2026. Retain the local-harness and version qualifications when reusing the chart.

Tech Consulting Tailored to Your Coding Journey

Get expert guidance in coding with a personalized consultation. Receive unique, actionable insights delivered in 1-3 business days.

Get Started