Files
rea/tests/process-global/curatedWindowsLane.test.ts
Ysopwnable b743bd20a0 fix(hopper): verify lease cleanup and repair the macOS test lane (#1111)
* fix(hopper): distinguish shared lease roots from leaked sessions

* fix(ci): follow the moved process CLI regression tests
2026-10-09 02:41:34 +08:00

76 lines
2.2 KiB
TypeScript

import { access, readFile } from "node:fs/promises";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { parse } from "yaml";
import { z } from "zod";
const WORKFLOW = join(".github", "workflows", "ci.yml");
const workflowSchema = z.object({
jobs: z.record(
z.string(),
z.object({
steps: z.array(z.object({ run: z.string().optional() })).optional(),
}),
),
});
const explicitPaths = async (
lane: "windows" | "focused",
): Promise<string[]> => {
const workflow = workflowSchema.parse(
parse(await readFile(WORKFLOW, "utf8")),
);
const runs =
lane === "windows"
? (workflow.jobs["windows-curated"]?.steps
?.map((step) => step.run)
.filter((value) => value?.includes("npx vitest run")) ?? [])
: Object.values(workflow.jobs)
.flatMap((job) => job.steps ?? [])
.map((step) => step.run)
.filter((value) =>
value?.trim().startsWith("npm run test:focused -- "),
);
expect(
runs.length,
`expected explicit ${lane} CI test invocations`,
).toBeGreaterThan(0);
return [
...new Set(
runs.flatMap(
(run) =>
run?.split(/\s+/).filter((token) => token.endsWith(".test.ts")) ?? [],
),
),
].sort();
};
const exists = async (path: string): Promise<boolean> =>
access(path).then(
() => true,
() => false,
);
describe("curated Windows test lane", () => {
it("references only test files that exist", async () => {
const paths = await explicitPaths("windows");
expect(paths.length).toBeGreaterThan(0);
const missing = await Promise.all(
paths.map(async (path) => ((await exists(path)) ? undefined : path)),
);
expect(missing.filter((path) => path !== undefined)).toEqual([]);
}, 10_000);
});
it("keeps every explicit focused CI test path executable after file moves", async () => {
const paths = await explicitPaths("focused");
expect(paths.length).toBeGreaterThan(0);
const missing = await Promise.all(
paths.map(async (path) => ((await exists(path)) ? undefined : path)),
);
expect(missing.filter((path) => path !== undefined)).toEqual([]);
}, 10_000);