|
1 | | -import os from "node:os"; |
2 | 1 | import { defineConfig } from "vitest/config"; |
3 | 2 | import { BUNDLED_PLUGIN_E2E_TEST_GLOB } from "./vitest.bundled-plugin-paths.ts"; |
4 | 3 | import baseConfig from "./vitest.config.ts"; |
5 | 4 | import { resolveRepoRootPath } from "./vitest.shared.config.ts"; |
6 | 5 |
|
7 | | -const base = baseConfig as unknown as Record<string, unknown>; |
8 | | -const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true"; |
9 | | -const cpuCount = os.cpus().length; |
10 | | -// Keep e2e runs cheap by default; callers can still override via OPENCLAW_E2E_WORKERS. |
11 | | -const defaultWorkers = isCI ? Math.min(2, Math.max(1, Math.floor(cpuCount * 0.25))) : 1; |
12 | | -const requestedWorkers = Number.parseInt(process.env.OPENCLAW_E2E_WORKERS ?? "", 10); |
13 | | -const e2eWorkers = |
14 | | - Number.isFinite(requestedWorkers) && requestedWorkers > 0 |
| 6 | +type E2EWorkerEnv = { |
| 7 | + OPENCLAW_E2E_WORKERS?: string; |
| 8 | +}; |
| 9 | + |
| 10 | +export function resolveE2EWorkerCount(env: E2EWorkerEnv = process.env): number { |
| 11 | + const requestedWorkers = Number.parseInt(env.OPENCLAW_E2E_WORKERS ?? "", 10); |
| 12 | + return Number.isFinite(requestedWorkers) && requestedWorkers > 0 |
15 | 13 | ? Math.min(16, requestedWorkers) |
16 | | - : defaultWorkers; |
| 14 | + : 1; |
| 15 | +} |
| 16 | + |
| 17 | +const base = baseConfig as unknown as Record<string, unknown>; |
| 18 | +// Keep e2e runs deterministic by default; callers can still opt into parallelism. |
| 19 | +const e2eWorkers = resolveE2EWorkerCount(); |
17 | 20 | const verboseE2E = process.env.OPENCLAW_E2E_VERBOSE === "1"; |
18 | 21 |
|
19 | 22 | const baseTestWithProjects = |
|
0 commit comments