mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:50:43 +00:00
fix(tooling): harden changed checks for sparse worktrees
This commit is contained in:
@@ -370,6 +370,8 @@ describe("scripts/changed-lanes", () => {
|
||||
PATH: "/usr/bin",
|
||||
OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS: CHANGED_CHECK_VITEST_NO_OUTPUT_TIMEOUT_MS,
|
||||
OPENCLAW_VITEST_NO_OUTPUT_RETRY: "0",
|
||||
OPENCLAW_TEST_PROJECTS_SERIAL: "1",
|
||||
OPENCLAW_VITEST_MAX_WORKERS: "1",
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -382,4 +384,16 @@ describe("scripts/changed-lanes", () => {
|
||||
OPENCLAW_VITEST_NO_OUTPUT_RETRY: "1",
|
||||
});
|
||||
});
|
||||
|
||||
it("does not force serial changed-check tests in CI or when workers are explicit", () => {
|
||||
expect(createChangedCheckVitestEnv({ CI: "true" })).not.toHaveProperty(
|
||||
"OPENCLAW_VITEST_MAX_WORKERS",
|
||||
);
|
||||
expect(createChangedCheckVitestEnv({ OPENCLAW_VITEST_MAX_WORKERS: "4" })).toMatchObject({
|
||||
OPENCLAW_VITEST_MAX_WORKERS: "4",
|
||||
});
|
||||
expect(
|
||||
createChangedCheckVitestEnv({ OPENCLAW_TEST_PROJECTS_PARALLEL: "4" }),
|
||||
).not.toHaveProperty("OPENCLAW_TEST_PROJECTS_SERIAL");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { shouldPrepareExtensionPackageBoundaryArtifacts } from "../../scripts/run-oxlint.mjs";
|
||||
import {
|
||||
filterSparseMissingOxlintTargets,
|
||||
shouldPrepareExtensionPackageBoundaryArtifacts,
|
||||
} from "../../scripts/run-oxlint.mjs";
|
||||
|
||||
describe("run-oxlint", () => {
|
||||
it("prepares extension package boundary artifacts for normal lint runs", () => {
|
||||
@@ -30,4 +33,36 @@ describe("run-oxlint", () => {
|
||||
expect(shardedLintRunner).toContain("prepare-extension-package-boundary-artifacts.mjs");
|
||||
expect(shardedLintRunner).toContain('OPENCLAW_OXLINT_SKIP_PREPARE: "1"');
|
||||
});
|
||||
|
||||
it("filters tracked targets missing from sparse checkouts", () => {
|
||||
const result = filterSparseMissingOxlintTargets(
|
||||
["--tsconfig", "tsconfig.oxlint.core.json", "src", "ui", "packages", "--threads=1"],
|
||||
{
|
||||
fileExists: (target: string) => target.endsWith("/src"),
|
||||
isSparseCheckoutEnabled: () => true,
|
||||
isTrackedPath: ({ target }: { target: string }) => target === "ui" || target === "packages",
|
||||
},
|
||||
);
|
||||
|
||||
expect(result).toEqual({
|
||||
args: ["--tsconfig", "tsconfig.oxlint.core.json", "src", "--threads=1"],
|
||||
hadExplicitTargets: true,
|
||||
remainingExplicitTargets: 1,
|
||||
skippedTargets: ["ui", "packages"],
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps missing untracked oxlint targets so typos still fail", () => {
|
||||
const result = filterSparseMissingOxlintTargets(["src", "typo"], {
|
||||
fileExists: (target: string) => target.endsWith("/src"),
|
||||
isSparseCheckoutEnabled: () => true,
|
||||
isTrackedPath: () => false,
|
||||
});
|
||||
|
||||
expect(result).toMatchObject({
|
||||
args: ["src", "typo"],
|
||||
remainingExplicitTargets: 2,
|
||||
skippedTargets: [],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user