diff --git a/test/test-utils/index.ts b/test/test-utils/index.ts index 90e69feb8..d96cf9c37 100644 --- a/test/test-utils/index.ts +++ b/test/test-utils/index.ts @@ -83,6 +83,10 @@ export async function runVitest( NO_COLOR: 'true', ...rest.env, }, + + // Test cases are already run with multiple forks/threads + maxWorkers: 1, + minWorkers: 1, }, { ...viteOverrides, server: { @@ -147,7 +151,7 @@ interface CliOptions extends Partial { earlyReturn?: boolean } -export async function runCli(command: string, _options?: CliOptions | string, ...args: string[]) { +async function runCli(command: 'vitest' | 'vite-node', _options?: CliOptions | string, ...args: string[]) { let options = _options if (typeof _options === 'string') { @@ -155,6 +159,11 @@ export async function runCli(command: string, _options?: CliOptions | string, .. options = undefined } + if (command === 'vitest') { + args.push('--maxWorkers=1') + args.push('--minWorkers=1') + } + const subprocess = x(command, args, options as Options).process! const cli = new Cli({ stdin: subprocess.stdin!,