diff --git a/vitest.config.ts b/vitest.config.ts index e9e99ba344..e87048ba27 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -2,6 +2,8 @@ // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. +import os from 'node:os'; + import { defineConfig } from 'vitest/config'; export default defineConfig({ @@ -47,6 +49,19 @@ export default defineConfig({ NODE_ENV: 'test', }, + pool: 'forks', + poolOptions: { + forks: { + minForks: 1, + maxForks: ((cpuCount) => + Math.floor( + cpuCount <= 32 + ? cpuCount / 2 + : 16 + (cpuCount - 32) / 6, + ))(os.availableParallelism()), + }, + }, + projects: [ 'examples/*/vitest.config.ts', 'packages/react/*/vitest.config.ts',