-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore: add support for a local vitest config file #3401
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
Conversation
| }); | ||
|
|
||
| // Check for local config override | ||
| const localConfigPath = resolve(__dirname, './vitest.config.local.mts'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does __dirname work nowadays in ESM projects? the file is .mts...
I guess this could be import.meta.resolve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably works in vite(st) environments since they handle the conversion automatically... That said, doesn't import() support new URL() too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc it actually requires URLs, and fails on windows if you dont provide one (paths work on linux/mac as a side effect)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same pattern is used 10 lines above in the alias section, do you want me to rectify this everywhere? Not sure if it's worth the inflated diff...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah, lets leave it, it just caught my attention
vladfrangu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fwiw I'd also be ok with setting some limits on local, like 4 threads max
Yeah, I figured it's easier to let everyone configure it (or leave the default) than to agree on the right value. |
Motivation: My CPU has 6 normal cores and 8 slow ones, so when vitest tries to utilize all of them, it makes my laptop unusable. So I need a way to customize the vitest config, and this is what worked for me.