fix(test): skip heavy-check lock for scoped tooling runs

This commit is contained in:
Vincent Koc
2026-04-12 05:25:14 +01:00
parent 1d1f10ecc2
commit 2069c85b34
3 changed files with 99 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import {
applyParallelVitestCachePaths,
buildFullSuiteVitestRunPlans,
buildVitestRunPlans,
shouldAcquireLocalHeavyCheckLock,
resolveChangedTargetArgs,
} from "../../scripts/test-projects.test-support.mjs";
@@ -195,6 +196,79 @@ describe("scripts/test-projects changed-target routing", () => {
});
});
describe("scripts/test-projects local heavy-check lock", () => {
it("skips the lock for a single scoped serial tooling run", () => {
expect(
shouldAcquireLocalHeavyCheckLock(
[
{
config: "test/vitest/vitest.tooling.config.ts",
includePatterns: ["test/scripts/committer.test.ts"],
watchMode: false,
},
],
{
...process.env,
OPENCLAW_TEST_PROJECTS_SERIAL: "1",
},
),
).toBe(false);
});
it("keeps the lock for non-tooling or non-serial runs", () => {
expect(
shouldAcquireLocalHeavyCheckLock(
[
{
config: "test/vitest/vitest.tooling.config.ts",
includePatterns: ["test/scripts/committer.test.ts"],
watchMode: false,
},
],
{
...process.env,
OPENCLAW_TEST_PROJECTS_SERIAL: "0",
},
),
).toBe(true);
expect(
shouldAcquireLocalHeavyCheckLock(
[
{
config: "test/vitest/vitest.unit.config.ts",
includePatterns: ["src/infra/vitest-config.test.ts"],
watchMode: false,
},
],
{
...process.env,
OPENCLAW_TEST_PROJECTS_SERIAL: "1",
},
),
).toBe(true);
});
it("allows forcing the lock back on", () => {
expect(
shouldAcquireLocalHeavyCheckLock(
[
{
config: "test/vitest/vitest.tooling.config.ts",
includePatterns: ["test/scripts/committer.test.ts"],
watchMode: false,
},
],
{
...process.env,
OPENCLAW_TEST_PROJECTS_FORCE_LOCK: "1",
OPENCLAW_TEST_PROJECTS_SERIAL: "1",
},
),
).toBe(true);
});
});
describe("scripts/test-projects full-suite sharding", () => {
it("splits untargeted runs into fixed core shards and per-extension configs", () => {
const previousParallel = process.env.OPENCLAW_TEST_PROJECTS_PARALLEL;