Describe the bug
When:
beforeEach/beforeAll is present in a setup file
- the setup file is referenced in
setupFiles without extension
- the configuration contains
isolate: false and maxWorkers: 1 (which I'm using to speed up the tests)
then the callback runs only for one test file (apparently one that happens to be executed first) instead of for all files.
In the repro, observe the console output: beforeEach is printed only once instead of 2 times.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-bw2va5tg?file=vite.config.js
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 22.22.3 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
vitest: 4.1.11 => 4.1.11
Used Package Manager
npm
Validations
Describe the bug
When:
beforeEach/beforeAllis present in a setup filesetupFileswithout extensionisolate: falseandmaxWorkers: 1(which I'm using to speed up the tests)then the callback runs only for one test file (apparently one that happens to be executed first) instead of for all files.
In the repro, observe the console output:
beforeEachis printed only once instead of 2 times.Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-bw2va5tg?file=vite.config.js
System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 22.22.3 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.8.2 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: vitest: 4.1.11 => 4.1.11Used Package Manager
npm
Validations