@@ -3,7 +3,7 @@ import { closeSync, mkdtempSync, openSync, readFileSync, writeFileSync } from "n
33import { fileURLToPath } from "node:url" ;
44import { tmpdir } from "node:os" ;
55import { join } from "node:path" ;
6- import { spawn } from "node:child_process" ;
6+ import { spawn , spawnSync } from "node:child_process" ;
77import test from "node:test" ;
88
99const BIN = fileURLToPath ( new URL ( "../bin/moshcode.mjs" , import . meta. url ) ) ;
@@ -75,6 +75,17 @@ test("run - reads the script from stdin", async () => {
7575 assert . match ( result . stdout , / f r o m s t d i n / ) ;
7676} ) ;
7777
78+ test ( "run accepts - before --dry-run" , ( ) => {
79+ const result = spawnSync ( process . execPath , [ BIN , "run" , "-" , "--dry-run" ] , {
80+ encoding : "utf8" ,
81+ input : 'say("from stdin");\n' ,
82+ } ) ;
83+
84+ assert . equal ( result . status , 0 ) ;
85+ assert . equal ( result . stderr , "" ) ;
86+ assert . match ( result . stdout , / f r o m s t d i n / ) ;
87+ } ) ;
88+
7889test ( "run accepts equals-form max option" , async ( ) => {
7990 const result = await run ( [ "--max=1" , "--dry-run" ] ) ;
8091
0 commit comments