-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Automatically inherit common test config in inline projects #7225
Comments
This was brought up when discussing #6913, but we didn't do anything special about inline workspace's I'm not sure why |
Workspace projects don't inherit the parent config, this is mentioned in the documentation and I prefer that behavior personally to keep things consistent and don't have a distinction between glob projects and inline projects.
|
I tested |
The confusing part is that even without A heavy |
Vitest always runs plugins from the root config. https://vitest.dev/guide/workspace.html#configuration
|
I see why this doesn't work, PR incoming: #7232 |
From the standpoint of It's great that the fix for |
You are getting confused here, plugin itself is always applied if the config is resolved. What might not be applied are certain hooks because there were no events that triggered it. For example, it's possible that The root project is always defined, you cannot disable or remove it. The root project holds all information about the root config and can process files by Vite if there are any custom coverage providers, for example. The root project also holds the reference to the root Vite server, and This is just how Vitest works. |
Seeing that |
Clear and concise description of the problem
Project configurations can be repetitive, it would be nice for us and for Vitest to have a clear path towards defining what is common and what is specific to that project in one place. Inline projects are a great tool for that, I'm so thankful they made it into Vitest.
However, extending doesn't quite work as I expected, here I expected the project to inherit
globals: true
:because otherwise any config defined at the root
test
is a noop whenworkspace
exists, right?Next I tried setting
extends: true
on the project to get it to work, but it didn't. I don't really know what it does by default, I suppose it's looking up the directory tree.What did work was configuring
extends: "./vitest.config.ts"
.Suggested solution
I would like not having to configure
extends
on projects, I would like inheritance to just happen. If that makes sense for the direction of v3.Alternative
Type definitions could be altered in a way that prohibits noop root configs in case
workspace
is defined, using a discriminated union.Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: