Skip to content

Commit 3fa7b78

Browse files
authored
test: reduce max thread count when vitest-in-vitest (#7829)
1 parent 4128665 commit 3fa7b78

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/test-utils/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ export async function runVitest(
8383
NO_COLOR: 'true',
8484
...rest.env,
8585
},
86+
87+
// Test cases are already run with multiple forks/threads
88+
maxWorkers: 1,
89+
minWorkers: 1,
8690
}, {
8791
...viteOverrides,
8892
server: {
@@ -147,14 +151,19 @@ interface CliOptions extends Partial<Options> {
147151
earlyReturn?: boolean
148152
}
149153

150-
export async function runCli(command: string, _options?: CliOptions | string, ...args: string[]) {
154+
async function runCli(command: 'vitest' | 'vite-node', _options?: CliOptions | string, ...args: string[]) {
151155
let options = _options
152156

153157
if (typeof _options === 'string') {
154158
args.unshift(_options)
155159
options = undefined
156160
}
157161

162+
if (command === 'vitest') {
163+
args.push('--maxWorkers=1')
164+
args.push('--minWorkers=1')
165+
}
166+
158167
const subprocess = x(command, args, options as Options).process!
159168
const cli = new Cli({
160169
stdin: subprocess.stdin!,

0 commit comments

Comments
 (0)