feat(scripts): state-sync-guard for pre-commit safety net

This commit is contained in:
2026-05-13 07:54:03 +02:00
parent 56ed918b09
commit 1ebffa68a6
2 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import { describe, it, expect } from "vitest";
import { execSync } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const GUARD = path.join(__dirname, "state-sync-guard.mjs");
describe("state-sync-guard smoke", () => {
it("exits 0 when run against the repo's current state (since main is in sync)", () => {
// Run the guard; if main's _state.json drifts, this test will fail and tell us.
const result = execSync(`node "${GUARD}"`, { encoding: "utf8" });
// No assertion on output; the exit code is 0 if we got here without throwing.
expect(true).toBe(true);
});
});