Skip to content

Conversation

@janbuchar
Copy link
Contributor

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.

@janbuchar janbuchar added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Feb 10, 2026
@github-actions github-actions bot added this to the 134th sprint - Tooling team milestone Feb 10, 2026
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Feb 10, 2026
});

// Check for local config override
const localConfigPath = resolve(__dirname, './vitest.config.local.mts');
Copy link
Member

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?

Copy link
Member

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?

Copy link
Member

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)

Copy link
Contributor Author

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...

Copy link
Member

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

Copy link
Member

@vladfrangu vladfrangu left a 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

@janbuchar
Copy link
Contributor Author

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.

@janbuchar janbuchar merged commit 98646be into master Feb 10, 2026
9 checks passed
@janbuchar janbuchar deleted the local-vitest-config branch February 10, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants