From c645415f8845af87942799a94ac0b43280fe542d Mon Sep 17 00:00:00 2001 From: aiirvizionz Date: Sun, 9 Aug 2026 18:35:52 -0600 Subject: [PATCH] fix(cli): accept stdin script marker --- test/run-options.test.mjs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/run-options.test.mjs b/test/run-options.test.mjs index 04004e2..633ddfb 100644 --- a/test/run-options.test.mjs +++ b/test/run-options.test.mjs @@ -3,7 +3,7 @@ import { closeSync, mkdtempSync, openSync, readFileSync, writeFileSync } from "n import { fileURLToPath } from "node:url"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { spawn } from "node:child_process"; +import { spawn, spawnSync } from "node:child_process"; import test from "node:test"; const BIN = fileURLToPath(new URL("../bin/moshcode.mjs", import.meta.url)); @@ -75,6 +75,17 @@ test("run - reads the script from stdin", async () => { assert.match(result.stdout, /from stdin/); }); +test("run accepts - before --dry-run", () => { + const result = spawnSync(process.execPath, [BIN, "run", "-", "--dry-run"], { + encoding: "utf8", + input: 'say("from stdin");\n', + }); + + assert.equal(result.status, 0); + assert.equal(result.stderr, ""); + assert.match(result.stdout, /from stdin/); +}); + test("run accepts equals-form max option", async () => { const result = await run(["--max=1", "--dry-run"]);