fix(test): keep local Vitest checks serialized

This commit is contained in:
Vincent Koc
2026-04-25 03:05:28 -07:00
parent 5e0cca5e24
commit 814409a3b3
8 changed files with 144 additions and 72 deletions

View File

@@ -58,6 +58,38 @@ describe("scripts/run-vitest", () => {
});
});
it("reenables local check policy for local Vitest children", () => {
expect(
resolveVitestSpawnParams(
{
OPENCLAW_LOCAL_CHECK: "0",
PATH: "/usr/bin",
},
"darwin",
).env,
).toMatchObject({
OPENCLAW_LOCAL_CHECK: "1",
PATH: "/usr/bin",
});
});
it("preserves explicit local-check disablement in CI", () => {
expect(
resolveVitestSpawnParams(
{
CI: "true",
OPENCLAW_LOCAL_CHECK: "0",
PATH: "/usr/bin",
},
"linux",
).env,
).toMatchObject({
CI: "true",
OPENCLAW_LOCAL_CHECK: "0",
PATH: "/usr/bin",
});
});
it("caps native Rust worker pools for serial Vitest runs", () => {
expect(
resolveVitestSpawnParams(

View File

@@ -1,11 +1,37 @@
import { describe, expect, it } from "vitest";
import {
resolveLocalVitestEnv,
resolveLocalFullSuiteProfile,
resolveLocalVitestScheduling,
shouldUseLargeLocalFullSuiteProfile,
} from "../../scripts/lib/vitest-local-scheduling.mjs";
describe("vitest local full-suite profile", () => {
it("forces local Vitest runs back onto local-check policy", () => {
expect(resolveLocalVitestEnv({ OPENCLAW_LOCAL_CHECK: "0", PATH: "/usr/bin" })).toEqual({
OPENCLAW_LOCAL_CHECK: "1",
PATH: "/usr/bin",
});
expect(resolveLocalVitestEnv({ OPENCLAW_LOCAL_CHECK: "false", PATH: "/usr/bin" })).toEqual({
OPENCLAW_LOCAL_CHECK: "1",
PATH: "/usr/bin",
});
});
it("keeps local-check disablement for CI Vitest runs", () => {
expect(
resolveLocalVitestEnv({
CI: "true",
OPENCLAW_LOCAL_CHECK: "0",
PATH: "/usr/bin",
}),
).toEqual({
CI: "true",
OPENCLAW_LOCAL_CHECK: "0",
PATH: "/usr/bin",
});
});
it("selects the large local profile on roomy hosts that are not throttled", () => {
const env = {};
const hostInfo = {