mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 22:11:12 +00:00
test(ci): share static task context fixtures (#16433)
This commit is contained in:
1 parent
4824a91fa1
commit
9873058a8d
1 file changed
+25
-42
@@ -16,6 +16,25 @@ const producer = fileURLToPath(
|
||||
new URL("../../../scripts/ci/static-check-report.mjs", import.meta.url),
|
||||
);
|
||||
|
||||
const writeTaskContext = (
|
||||
directory: string,
|
||||
taskHashes: Record<string, string>,
|
||||
) =>
|
||||
writeFile(
|
||||
join(directory, "static-task-context.json"),
|
||||
JSON.stringify({
|
||||
version: 1,
|
||||
sourceSha: "a".repeat(40),
|
||||
sourceClean: true,
|
||||
nodeVersion: process.version,
|
||||
npmVersion: "11.16.0",
|
||||
turboVersion: "2.11.7",
|
||||
platform: process.platform,
|
||||
architecture: process.arch,
|
||||
taskHashes,
|
||||
}),
|
||||
);
|
||||
|
||||
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
"archives real lint I/O errors with unavailable source and rule identity",
|
||||
async () => {
|
||||
@@ -38,20 +57,7 @@ it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
message: expect.stringContaining("Permission denied"),
|
||||
},
|
||||
]);
|
||||
await writeFile(
|
||||
join(reports, "static-task-context.json"),
|
||||
JSON.stringify({
|
||||
version: 1,
|
||||
sourceSha: "a".repeat(40),
|
||||
sourceClean: true,
|
||||
nodeVersion: process.version,
|
||||
npmVersion: "11.16.0",
|
||||
turboVersion: "2.11.7",
|
||||
platform: process.platform,
|
||||
architecture: process.arch,
|
||||
taskHashes: { lint: "a".repeat(16) },
|
||||
}),
|
||||
);
|
||||
await writeTaskContext(reports, { lint: "a".repeat(16) });
|
||||
const archive = join(root, "reports.zip");
|
||||
const pack = () =>
|
||||
execute(
|
||||
@@ -96,20 +102,7 @@ it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
|
||||
it("uses the same repository path admission for archived and compared diagnostics", async () => {
|
||||
const root = await createTestTempDirectory("rea-ci-static-paths-");
|
||||
await writeFile(
|
||||
join(root, "static-task-context.json"),
|
||||
JSON.stringify({
|
||||
version: 1,
|
||||
sourceSha: "a".repeat(40),
|
||||
sourceClean: true,
|
||||
nodeVersion: process.version,
|
||||
npmVersion: "11.16.0",
|
||||
turboVersion: "2.11.7",
|
||||
platform: process.platform,
|
||||
architecture: process.arch,
|
||||
taskHashes: { lint: "a".repeat(16) },
|
||||
}),
|
||||
);
|
||||
await writeTaskContext(root, { lint: "a".repeat(16) });
|
||||
const archive = join(root, "reports.zip");
|
||||
for (const path of [
|
||||
"src/space name.ts",
|
||||
@@ -190,20 +183,10 @@ it.each([3.5, 100, 0])(
|
||||
await readFile(join(reports, "jscpd/jscpd-report.json"), "utf8"),
|
||||
),
|
||||
).toMatchObject({ reaCheck: { exitCode: threshold === 0 ? 1 : 0 } });
|
||||
await writeFile(
|
||||
join(reports, "static-task-context.json"),
|
||||
JSON.stringify({
|
||||
version: 1,
|
||||
sourceSha: "a".repeat(40),
|
||||
sourceClean: true,
|
||||
nodeVersion: process.version,
|
||||
npmVersion: "11.16.0",
|
||||
turboVersion: "2.11.7",
|
||||
platform: process.platform,
|
||||
architecture: process.arch,
|
||||
taskHashes: { lint: "a".repeat(16), jscpd: "b".repeat(16) },
|
||||
}),
|
||||
);
|
||||
await writeTaskContext(reports, {
|
||||
lint: "a".repeat(16),
|
||||
jscpd: "b".repeat(16),
|
||||
});
|
||||
const archive = join(root, "reports.zip");
|
||||
await execute(
|
||||
"zip",
|
||||
|
||||
Reference in new issue
Block a user