verify-references ran a bare `npx vitest run` in the staged reference, which fetched an unrelated vitest that could not load the reference config. It now installs the reference's devDependencies first. sync-check also checks each module's expansion/tests against ### headings in expansion/README.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
#!/usr/bin/env node
|
|
// Verifies Rust tests, TS tests and scenarios.md list identical test names per module.
|
|
// A module's Expansion Drop (expansion/tests/{rust,ts}, scenarios as `### test_…`
|
|
// headings in expansion/README.md) is checked the same way, as a separate set.
|
|
import { join } from "node:path";
|
|
import { moduleDirs, testNames, scenarioNames } from "./lib.mjs";
|
|
|
|
const problems = [];
|
|
function check(label, path, scenarioFile) {
|
|
const sets = {
|
|
rust: testNames(path, "rust"),
|
|
ts: testNames(path, "ts"),
|
|
scenarios: scenarioNames(path, scenarioFile),
|
|
};
|
|
if (Object.values(sets).every((s) => s.length === 0)) return;
|
|
const all = new Set(Object.values(sets).flat());
|
|
for (const name of [...all].sort()) {
|
|
for (const [where, names] of Object.entries(sets)) {
|
|
if (!names.includes(name)) problems.push(`${label}: ${name} missing from ${where}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
for (const mod of moduleDirs()) {
|
|
const label = `module ${mod.num}-${mod.slug}`;
|
|
check(label, mod.path, "scenarios.md");
|
|
check(`${label} expansion`, join(mod.path, "expansion"), "README.md");
|
|
}
|
|
if (problems.length) {
|
|
console.error("sync-check: mismatches\n" + problems.map((p) => " " + p).join("\n"));
|
|
process.exit(1);
|
|
}
|
|
console.log("sync-check: ok");
|