Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion test/run-options.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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"]);

Expand Down
Loading