test(FN-000): address follow-up review feedback
This commit is contained in:
@@ -180,12 +180,20 @@ describe("PR checks workflow (.github/workflows/pr-checks.yml)", () => {
|
||||
|
||||
it("keeps build coverage as an explicit PR gate", () => {
|
||||
const buildSteps = workflow.jobs?.build?.steps ?? [];
|
||||
expect(buildSteps.some((step: any) => step.name === "Build" && step.run === "pnpm build")).toBe(true);
|
||||
expect(
|
||||
buildSteps.some(
|
||||
(step: any) => step.name === "Build" && typeof step.run === "string" && step.run.includes("pnpm build"),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("does not spend PR action minutes on a pre-test workspace build", () => {
|
||||
const testSteps = workflow.jobs?.["test-shards"]?.steps ?? [];
|
||||
expect(testSteps.some((step: any) => step.name === "Build" || step.run === "pnpm build")).toBe(false);
|
||||
expect(
|
||||
testSteps.some(
|
||||
(step: any) => step.name === "Build" || (typeof step.run === "string" && step.run.includes("pnpm build")),
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@ function loadRootPackageJson(): any {
|
||||
return JSON.parse(readFileSync(path, "utf-8"));
|
||||
}
|
||||
|
||||
function hasProjectArg(script: string | undefined, project: string): boolean {
|
||||
const parts = script?.trim().split(/\s+/) ?? [];
|
||||
return parts.some((part, index) => part === "--project" && parts[index + 1] === project);
|
||||
}
|
||||
|
||||
describe("CLI package.json publishing config", () => {
|
||||
const pkg = loadPackageJson("cli");
|
||||
|
||||
@@ -249,10 +254,18 @@ describe("Workspace bootstrap script contract", () => {
|
||||
});
|
||||
|
||||
it("keeps dashboard's default test lane curated with explicit deep coverage", () => {
|
||||
expect(dashboardPkg.scripts?.test).toContain("--project dashboard-app-quality");
|
||||
expect(dashboardPkg.scripts?.test).toContain("--project dashboard-api-quality");
|
||||
expect(dashboardPkg.scripts?.["test:deep"]).toContain("--project dashboard-app");
|
||||
expect(dashboardPkg.scripts?.["test:deep"]).toContain("--project dashboard-api");
|
||||
const defaultTest = dashboardPkg.scripts?.test;
|
||||
const deepTest = dashboardPkg.scripts?.["test:deep"];
|
||||
|
||||
expect(hasProjectArg(defaultTest, "dashboard-app-quality")).toBe(true);
|
||||
expect(hasProjectArg(defaultTest, "dashboard-api-quality")).toBe(true);
|
||||
expect(hasProjectArg(defaultTest, "dashboard-app")).toBe(false);
|
||||
expect(hasProjectArg(defaultTest, "dashboard-api")).toBe(false);
|
||||
|
||||
expect(hasProjectArg(deepTest, "dashboard-app")).toBe(true);
|
||||
expect(hasProjectArg(deepTest, "dashboard-api")).toBe(true);
|
||||
expect(hasProjectArg(deepTest, "dashboard-app-quality")).toBe(false);
|
||||
expect(hasProjectArg(deepTest, "dashboard-api-quality")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -67,16 +67,6 @@ const DEFAULT_TEST_SUBPROCESS_TIMEOUT_MS = Math.max(
|
||||
const BLOCKED_TEST_CLI_PATTERN =
|
||||
/(^|[\s"'\\/])(?:claude|droid|paperclipai|hermes|openclaw)(?:\.(?:cmd|bat|ps1|exe))?(?=$|[\s"'\\/])/i;
|
||||
|
||||
const originalEmitWarning = process.emitWarning.bind(process);
|
||||
process.emitWarning = ((warning: string | Error, ...args: unknown[]) => {
|
||||
const message = typeof warning === "string" ? warning : warning?.message ?? "";
|
||||
const type = typeof args[0] === "string" ? args[0] : (args[0] as { type?: string } | undefined)?.type;
|
||||
if (type === "ExperimentalWarning" && message.includes("SQLite is an experimental feature")) {
|
||||
return;
|
||||
}
|
||||
return (originalEmitWarning as (...a: unknown[]) => void)(warning, ...args);
|
||||
}) as typeof process.emitWarning;
|
||||
|
||||
const originalCwd = process.cwd.bind(process);
|
||||
|
||||
function ensureValidCwd(): string {
|
||||
|
||||
@@ -18,6 +18,5 @@ export default defineConfig({
|
||||
globalSetup: [fileURLToPath(new URL("../../packages/core/src/__test-utils__/vitest-teardown.ts", import.meta.url))],
|
||||
pool: "threads",
|
||||
maxWorkers,
|
||||
poolOptions: { threads: { minThreads: 1, maxThreads: maxWorkers } },
|
||||
},
|
||||
});
|
||||
|
||||
@@ -54,12 +54,7 @@ function hasSharedIsolation(config) {
|
||||
}
|
||||
|
||||
function hasSharedWorkerBudget(config) {
|
||||
return (
|
||||
/computeMaxWorkers/.test(config) &&
|
||||
/\bmaxWorkers\b/.test(config) &&
|
||||
/\bpoolOptions\b/.test(config) &&
|
||||
/\bmax(?:Threads|Forks)\s*:\s*maxWorkers\b/.test(config)
|
||||
);
|
||||
return /computeMaxWorkers/.test(config) && /\bmaxWorkers\b/.test(config);
|
||||
}
|
||||
|
||||
test("workspace packages with test scripts use shared Vitest governance", () => {
|
||||
@@ -89,7 +84,7 @@ test("workspace packages with test scripts use shared Vitest governance", () =>
|
||||
failures.push(`${manifest.name}: missing shared vitest setup/teardown isolation`);
|
||||
}
|
||||
if (!hasSharedWorkerBudget(config)) {
|
||||
failures.push(`${manifest.name}: missing shared computeMaxWorkers/maxWorkers poolOptions budget`);
|
||||
failures.push(`${manifest.name}: missing shared computeMaxWorkers/maxWorkers budget`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user