Workspace configuration works only with inline configuration
Describe the bug
Hi there, I'm having an issue with workspace configuration in my project. Basically, it runs all the tests only when configurations are defined inline, while it runs only the first matched when defined with the glob pattern.
In the reproduction I've defined the vitest.workspace.ts with both configurations (the glob pattern one is commented) so you can check this properly.
Reproduction
https://stackblitz.com/edit/stackblitz-starters-qrhqud?file=vitest.workspace.ts
System Info
System:
OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
Memory: 4.10 GB / 15.34 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 16.20.0 - ~/.nvm/versions/node/v16.20.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.20.0/bin/yarn
npm: 9.7.1 - ~/.nvm/versions/node/v16.20.0/bin/npm
bun: 1.0.3 - ~/.bun/bin/bun
Browsers:
Chrome: 119.0.6045.159
npmPackages:
@vitest/coverage-v8: ^0.34.5 => 0.34.6
@vitest/ui: ^0.34.6 => 0.34.6
vitest: ^0.34.5 => 0.34.6
Used Package Manager
yarn
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Vitest uses only a single config per folder at the moment, it filters others out.
Thanks for the quick reply @sheremet-va, did I miss this point in the documentation or is not highlighted at all?
It's not highlighted, and looks like a bug to be honest.
Also encountered this when I tried to add a config file for unit tests and one for integration tests in the same folder. But simple enough to move to a subfolder for my integration tests as a workaround.
I think the initial idea was to filter out vite.config if there is a vitest.config in the same folder. Instead of the current solution, we should just remove vite.config if there is already a vitest.config in the folder.
@sheremet-va yes, the correct implementation I expect would filter out the vite(st).config keeping all the others matching the glob pattern.