Files
systemic-game-design-course/tools/sync-check.mjs
T
2026-10-28 23:54:55 +01:00

27 lines
885 B
JavaScript

#!/usr/bin/env node
// Verifies Rust tests, TS tests and scenarios.md list identical test names per module.
import { moduleDirs, testNames, scenarioNames } from "./lib.mjs";
const problems = [];
for (const mod of moduleDirs()) {
const sets = {
rust: testNames(mod.path, "rust"),
ts: testNames(mod.path, "ts"),
scenarios: scenarioNames(mod.path),
};
if (Object.values(sets).every((s) => s.length === 0)) continue;
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(`module ${mod.num}-${mod.slug}: ${name} missing from ${where}`);
}
}
}
}
if (problems.length) {
console.error("sync-check: mismatches\n" + problems.map((p) => " " + p).join("\n"));
process.exit(1);
}
console.log("sync-check: ok");