mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:50:43 +00:00
Rely on the lint wrapper to prepare extension package-boundary artifacts during pnpm check instead of invoking the same prep script again at the end. Add a script regression so the duplicate check path does not return.
30 lines
1.4 KiB
TypeScript
30 lines
1.4 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { describe, expect, it } from "vitest";
|
|
import { shouldPrepareExtensionPackageBoundaryArtifacts } from "../../scripts/run-oxlint.mjs";
|
|
|
|
describe("run-oxlint", () => {
|
|
it("prepares extension package boundary artifacts for normal lint runs", () => {
|
|
expect(shouldPrepareExtensionPackageBoundaryArtifacts([])).toBe(true);
|
|
expect(shouldPrepareExtensionPackageBoundaryArtifacts(["src/index.ts"])).toBe(true);
|
|
expect(shouldPrepareExtensionPackageBoundaryArtifacts(["--type-aware"])).toBe(true);
|
|
});
|
|
|
|
it("skips artifact preparation for metadata-only oxlint commands", () => {
|
|
expect(shouldPrepareExtensionPackageBoundaryArtifacts(["--help"])).toBe(false);
|
|
expect(shouldPrepareExtensionPackageBoundaryArtifacts(["--version"])).toBe(false);
|
|
expect(shouldPrepareExtensionPackageBoundaryArtifacts(["--print-config"])).toBe(false);
|
|
expect(shouldPrepareExtensionPackageBoundaryArtifacts(["--rules"])).toBe(false);
|
|
});
|
|
|
|
it("does not run package-boundary artifact prep twice in pnpm check", () => {
|
|
const packageJson = JSON.parse(readFileSync("package.json", "utf8")) as {
|
|
scripts: Record<string, string>;
|
|
};
|
|
|
|
expect(packageJson.scripts.check).toContain("pnpm lint");
|
|
expect(packageJson.scripts.check).not.toContain(
|
|
"node scripts/prepare-extension-package-boundary-artifacts.mjs",
|
|
);
|
|
});
|
|
});
|