From c8c0c1683d8933bf49b207d7c1fa2d165279ee42 Mon Sep 17 00:00:00 2001 From: quality Date: Tue, 6 Oct 2026 03:20:10 -0400 Subject: [PATCH] test: cover run-sync-step CLI entry in process (argv guard, usage exit 2, exit-code propagation) The prebuild gate from #240 had its entry block (lines 37-42) untested; only the exported helpers were exercised via an injected fake spawn, and the spawn invocation shape was never asserted. Drive the entry in process (vi.mock node:child_process, process.exit stub, vi.resetModules + dynamic import) following check-internal-links.main.test.ts so v8 attributes the coverage to the script. run-sync-step.ts goes 61.5% -> 100% lines. Closes #242 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality --- scripts/run-sync-step.main.test.ts | 144 +++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 scripts/run-sync-step.main.test.ts diff --git a/scripts/run-sync-step.main.test.ts b/scripts/run-sync-step.main.test.ts new file mode 100644 index 0000000..c64eda4 --- /dev/null +++ b/scripts/run-sync-step.main.test.ts @@ -0,0 +1,144 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +// Drives the CLI entry of scripts/run-sync-step.ts IN PROCESS, the way +// `npm run prebuild` invokes it (`tsx scripts/run-sync-step.ts