From 43a63cb20d5e0bc129a11477a26913c78d47a6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20Tanr=C4=B1verdi?= <10054568+xgame92@users.noreply.github.com> Date: Sat, 5 Dec 2026 18:33:18 +0000 Subject: [PATCH] test(cli): cover every packed command in the release smoke The packed-tarball rehearsal already ran some command help, but doctor track, doctor id and update id were not covered. Keep the command matrix explicit and make the smoke prove help is written only to stderr with the exact usage line, while the invalid-option answer stays structured JSON on stdout. --- packages/cli/scripts/release.mjs | 27 ++++++++++++++++++++++++--- packages/cli/test/release.test.ts | 13 +++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/packages/cli/scripts/release.mjs b/packages/cli/scripts/release.mjs index 183232e..f50716e 100644 --- a/packages/cli/scripts/release.mjs +++ b/packages/cli/scripts/release.mjs @@ -230,6 +230,16 @@ export function compareVersions(a, b) { return 0; } +export const PACKED_SMOKE_COMMANDS = [ + "deploy track", + "deploy id", + "doctor track", + "doctor id", + "update track", + "update id", + "connect id track", +]; + /** Why a release stopped, said to whoever ran it without a stack. */ class Stop extends Error {} @@ -388,7 +398,7 @@ async function main() { env, }); if (said !== version) stop(`The packed command says it is ${said}, not ${version}.`); - for (const command of ["deploy track", "deploy id", "update track", "connect id track"]) { + for (const command of PACKED_SMOKE_COMMANDS) { const help = spawnSync( process.execPath, [npx, "--yes", spec, ...command.split(" "), "--help"], @@ -398,7 +408,12 @@ async function main() { encoding: "utf8", }, ); - if (help.status !== 0 || !help.stderr?.startsWith(`Usage: gateweave ${command} [options]`)) { + const first = help.stderr?.split(/\r?\n/, 1)[0]; + if ( + help.status !== 0 || + help.stdout !== "" || + first !== `Usage: gateweave ${command} [options]` + ) { stop(`The packed command did not show help for ${command}.`); } } @@ -413,7 +428,13 @@ async function main() { } catch { stop("The packed command did not return JSON for an invalid option."); } - if (invalid.status !== 2 || failure?.ok !== false || failure.code !== "usage") { + if ( + invalid.status !== 2 || + invalid.stderr !== "" || + failure?.ok !== false || + failure.code !== "usage" || + typeof failure.reason !== "string" + ) { stop("The packed command did not report an invalid option as a usage error."); } console.log( diff --git a/packages/cli/test/release.test.ts b/packages/cli/test/release.test.ts index 0953e1b..50fa4a4 100644 --- a/packages/cli/test/release.test.ts +++ b/packages/cli/test/release.test.ts @@ -4,6 +4,7 @@ import { checkPackage, compareNpmRelease, compareVersions, + PACKED_SMOKE_COMMANDS, readTar, releaseKeys, sha256sums, @@ -139,6 +140,18 @@ test("compareVersions orders versions as semver does", () => { assert.equal(compareVersions("1.2.3", "1.2.3"), 0); }); +test("the packed smoke covers every shipped command's help", () => { + assert.deepEqual(PACKED_SMOKE_COMMANDS, [ + "deploy track", + "deploy id", + "doctor track", + "doctor id", + "update track", + "update id", + "connect id track", + ]); +}); + test("a release lives under its version, with sums sha256sum checks", () => { assert.equal(tarballName("0.1.0"), "gateweave-0.1.0.tgz"); assert.deepEqual(releaseKeys("0.1.0"), {