-
-
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
feat: add maxConcurrency
option
#1483
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
It's better to release this with the next minor bump. |
I am waiting for you to review |
Is there a way to set this globally?
We have a problem where vitest hogs too much CPU and ends up suffocating database operations (which is hosted on the same machine). I am not clear on how to tell Vitest to at most parallelize 80% CPU worth of threads. |
Found it: + import os from 'node:os';
import path from 'node:path';
import { defineConfig } from 'vitest/config';
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
test: {
deps: {
interopDefault: true,
},
+ maxThreads: Math.ceil(os.cpus().length * 0.5),
mockReset: true,
outputFile: './src/__generated__/vitest/results.xml',
reporters: ['verbose', 'junit'],
testTimeout: 60_000,
},
}); |
On a related note, I am not sure if defaulting to 100% of the CPUs is a great idea. It diminishes test stability. |
Closes #1212