|
3 | 3 |
|
4 | 4 | import os from "node:os"; |
5 | 5 |
|
6 | | -const DEFAULT_LOCAL_FULL_SUITE_PARALLELISM = 4; |
7 | | -const LARGE_LOCAL_FULL_SUITE_PARALLELISM = 10; |
8 | | -const DEFAULT_LOCAL_FULL_SUITE_VITEST_WORKERS = 1; |
9 | | -const LARGE_LOCAL_FULL_SUITE_VITEST_WORKERS = 2; |
| 6 | +const MAX_LOCAL_FULL_SUITE_PARALLELISM = 10; |
10 | 7 |
|
11 | 8 | const clamp = (value, min, max) => Math.max(min, Math.min(max, value)); |
12 | 9 |
|
@@ -189,42 +186,12 @@ export function resolveLocalVitestScheduling( |
189 | 186 | }; |
190 | 187 | } |
191 | 188 |
|
192 | | -export function shouldUseLargeLocalFullSuiteProfile( |
193 | | - env = process.env, |
194 | | - system = detectVitestHostInfo(), |
195 | | -) { |
196 | | - if (isCiLikeEnv(env)) { |
197 | | - return false; |
198 | | - } |
199 | | - const scheduling = resolveLocalVitestScheduling(env, system, "threads"); |
200 | | - return scheduling.maxWorkers >= 5 && !scheduling.throttledBySystem; |
201 | | -} |
202 | | - |
203 | 189 | export function resolveLocalFullSuiteProfile(env = process.env, system = detectVitestHostInfo()) { |
204 | | - if (!isSystemThrottleDisabled(env)) { |
205 | | - const memoryPressureLimit = resolveMemoryPressureWorkerLimit(system); |
206 | | - if (memoryPressureLimit === 1) { |
207 | | - return { |
208 | | - shardParallelism: 1, |
209 | | - vitestMaxWorkers: 1, |
210 | | - }; |
211 | | - } |
212 | | - if (memoryPressureLimit === 2) { |
213 | | - return { |
214 | | - shardParallelism: 2, |
215 | | - vitestMaxWorkers: 1, |
216 | | - }; |
217 | | - } |
218 | | - } |
219 | | - |
220 | | - if (shouldUseLargeLocalFullSuiteProfile(env, system)) { |
221 | | - return { |
222 | | - shardParallelism: LARGE_LOCAL_FULL_SUITE_PARALLELISM, |
223 | | - vitestMaxWorkers: LARGE_LOCAL_FULL_SUITE_VITEST_WORKERS, |
224 | | - }; |
225 | | - } |
| 190 | + const scheduling = resolveLocalVitestScheduling(env, system, "threads"); |
226 | 191 | return { |
227 | | - shardParallelism: DEFAULT_LOCAL_FULL_SUITE_PARALLELISM, |
228 | | - vitestMaxWorkers: DEFAULT_LOCAL_FULL_SUITE_VITEST_WORKERS, |
| 192 | + // Each shard is a separate Vitest process with its own module graph. Spend the |
| 193 | + // host worker budget once across shards instead of multiplying it inside them. |
| 194 | + shardParallelism: Math.min(scheduling.maxWorkers, MAX_LOCAL_FULL_SUITE_PARALLELISM), |
| 195 | + vitestMaxWorkers: 1, |
229 | 196 | }; |
230 | 197 | } |
0 commit comments