test: keep conservative full-suite shards aggregated

This commit is contained in:
Peter Steinberger
2026-04-10 13:36:03 +01:00
parent 2eb66a1ba9
commit b64a03793c
2 changed files with 60 additions and 4 deletions

View File

@@ -644,6 +644,9 @@ export function buildFullSuiteVitestRunPlans(args, cwd = process.cwd()) {
}
export function shouldUseLocalFullSuiteParallelByDefault(env = process.env) {
if (hasConservativeVitestWorkerBudget(env)) {
return false;
}
return (
env.OPENCLAW_TEST_PROJECTS_SERIAL !== "1" && env.CI !== "true" && env.GITHUB_ACTIONS !== "true"
);
@@ -654,6 +657,13 @@ function parsePositiveInt(value) {
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
}
function hasConservativeVitestWorkerBudget(env) {
const workerBudget = parsePositiveInt(
env.OPENCLAW_VITEST_MAX_WORKERS ?? env.OPENCLAW_TEST_WORKERS,
);
return workerBudget !== null && workerBudget <= 1;
}
export function resolveParallelFullSuiteConcurrency(specCount, env = process.env) {
const override = parsePositiveInt(env.OPENCLAW_TEST_PROJECTS_PARALLEL);
if (override !== null) {
@@ -665,10 +675,7 @@ export function resolveParallelFullSuiteConcurrency(specCount, env = process.env
if (env.CI === "true" || env.GITHUB_ACTIONS === "true") {
return 1;
}
const workerBudget = parsePositiveInt(
env.OPENCLAW_VITEST_MAX_WORKERS ?? env.OPENCLAW_TEST_WORKERS,
);
if (workerBudget !== null && workerBudget <= 1) {
if (hasConservativeVitestWorkerBudget(env)) {
return 1;
}
if (