-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v3] workspace in config file not working #7325
Comments
This is not a bug. Vitest runs tests with |
If nested workspace are not working, how should I configure them to make them function properly? The documentation doesn't provide a clear solution. |
Every setup is unique. In you example you need to configure these options in the root config/workspace file. // vitest.workspace.ts
import { defineWorkspace } from 'vitest/config'
export default defineWorkspace([
'packages/server',
{
extends: 'packages/client/vitest.config.ts',
root: './packages/client',
test: { environment: 'node', name: 'node' },
},
{
extends: 'packages/client/vitest.config.ts',
root: './packages/client',
test: { environment: 'jsdom', name: 'jsdom' },
},
]) Just remember that Vitest will respect only one |
It does seem like a useful feature to allow inline workspaces for first level projects though. Maybe we can support it |
And the The part in the docs is not very clear (https://vitest.dev/guide/workspace) Should we put them in the root of the workspace in a |
First of all, thank you for your reply, but I don't think this configuration is good. This adds an additional Additionally, the documentation here is not clear https://vitest.dev/config/#environmentmatchglobs, it's just that both @pdanpdan and I made a mistake. I believe there will be more people making the same mistake.
Will this feature be considered for support in the 3.x version? I have already upgraded |
Describe the bug
configure different environments for different files in a single
vitest.config.ts
file.The configuration file is as follows:
environmentMatchGlobs
works, see linkSince environmentMatchGlobs has been deprecated, is there a way to set different environments for different files within a single
vitest.config.ts
file without adding additional configuration files?Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-szru14k5?file=packages/client/vitest.config.ts,packages/client/test/test.ts,packages/client/test/basic.test.tsx&initialPath=__vitest__/
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: