43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { spawnSync } from "node:child_process";
|
|
import { resolve } from "node:path";
|
|
import { discoverLegacyPages } from "../src/features/housekeeping/migration/discover-legacy-pages";
|
|
import { HOUSEKEEPING_MIGRATION_MATRIX } from "../src/features/housekeeping/migration/matrix";
|
|
import { validateMigrationEntries } from "../src/features/housekeeping/migration/validate-matrix";
|
|
|
|
const discovered = discoverLegacyPages();
|
|
const issues = validateMigrationEntries(
|
|
discovered,
|
|
HOUSEKEEPING_MIGRATION_MATRIX,
|
|
);
|
|
|
|
const parityTest = spawnSync(
|
|
process.execPath,
|
|
[
|
|
resolve(process.cwd(), "node_modules/vitest/vitest.mjs"),
|
|
"run",
|
|
"--coverage.enabled=false",
|
|
"src/features/housekeeping/cutover/parity.test.ts",
|
|
],
|
|
{ cwd: process.cwd(), encoding: "utf8" },
|
|
);
|
|
const parityPassed = parityTest.status === 0;
|
|
|
|
if (issues.length > 0 || !parityPassed) {
|
|
for (const issue of issues) console.error(issue);
|
|
if (!parityPassed) {
|
|
process.stderr.write(parityTest.stdout);
|
|
process.stderr.write(parityTest.stderr);
|
|
}
|
|
process.exitCode = 1;
|
|
} else {
|
|
console.log(
|
|
`Housekeeping migration matrix: ${HOUSEKEEPING_MIGRATION_MATRIX.length}/${discovered.length} valid`,
|
|
);
|
|
const removed = HOUSEKEEPING_MIGRATION_MATRIX.filter(
|
|
(row) => row.status === "REMOVED",
|
|
).length;
|
|
console.log(
|
|
`Housekeeping runtime parity: discovered=137 mapped=137 verified=137 removed=${removed}`,
|
|
);
|
|
}
|