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
| Fixture | Files in fixture | Setup behavior | Purpose |
|---|---|---|---|
| Empty by design | 0 | No global setup | Check deliberate discovery absence |
| Setup error | 1 | Throws EDITORIAL_SETUP_SENTINEL | Check failure before test execution |
| Passing control | 1 | No global setup | Check one addition assertion |
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 / fixture | Exit | Setup marker | No-test-files phrase | One test passed |
|---|---|---|---|---|
| 5.1.1 / empty | 1 | absent | present | no |
| 5.1.1 / setup_error | 1 | present | present | no |
| 5.1.1 / passing | 0 | absent | absent | yes |
| 5.1.2 / empty | 1 | absent | present | no |
| 5.1.2 / setup_error | 1 | present | absent | no |
| 5.1.2 / passing | 0 | absent | absent | yes |

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.

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
- Six observed fixture results (CSV)
- Three fixture definitions (CSV)
- Runtime and command register (CSV)
- Primary sources (CSV)
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
