mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
test: speed up e2e vitest runtime
This commit is contained in:
@@ -4,7 +4,15 @@ import baseConfig from "./vitest.config.ts";
|
||||
|
||||
const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true";
|
||||
const cpuCount = os.cpus().length;
|
||||
const e2eWorkers = isCI ? 2 : Math.min(4, Math.max(1, Math.floor(cpuCount * 0.25)));
|
||||
const defaultWorkers = isCI
|
||||
? Math.min(4, Math.max(2, Math.floor(cpuCount * 0.5)))
|
||||
: Math.min(8, Math.max(4, Math.floor(cpuCount * 0.6)));
|
||||
const requestedWorkers = Number.parseInt(process.env.OPENCLAW_E2E_WORKERS ?? "", 10);
|
||||
const e2eWorkers =
|
||||
Number.isFinite(requestedWorkers) && requestedWorkers > 0
|
||||
? Math.min(16, requestedWorkers)
|
||||
: defaultWorkers;
|
||||
const verboseE2E = process.env.OPENCLAW_E2E_VERBOSE === "1";
|
||||
|
||||
const baseTest = (baseConfig as { test?: { exclude?: string[] } }).test ?? {};
|
||||
const exclude = (baseTest.exclude ?? []).filter((p) => p !== "**/*.e2e.test.ts");
|
||||
@@ -13,7 +21,9 @@ export default defineConfig({
|
||||
...baseConfig,
|
||||
test: {
|
||||
...baseTest,
|
||||
pool: "vmForks",
|
||||
maxWorkers: e2eWorkers,
|
||||
silent: !verboseE2E,
|
||||
include: ["test/**/*.e2e.test.ts", "src/**/*.e2e.test.ts"],
|
||||
exclude,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user