@@ -48,14 +48,14 @@ describe('cli', () => {
4848 } )
4949
5050 test ( 'prints help' , async ( ) => {
51- let p = $ `node build/cli.js -h`
51+ const p = $ `node build/cli.js -h`
5252 p . stdin . end ( )
53- let help = await p
53+ const help = await p
5454 assert . match ( help . stdout , / z x / )
5555 } )
5656
5757 test ( 'zx prints usage if no param passed' , async ( ) => {
58- let p = $ `node build/cli.js`
58+ const p = $ `node build/cli.js`
5959 p . stdin . end ( )
6060 try {
6161 await p
@@ -67,70 +67,70 @@ describe('cli', () => {
6767 } )
6868
6969 test ( 'starts repl with --repl' , async ( ) => {
70- let p = $ `node build/cli.js --repl`
70+ const p = $ `node build/cli.js --repl`
7171 p . stdin . write ( 'await $`echo f"o"o`\n' )
7272 p . stdin . write ( '"b"+"ar"\n' )
7373 p . stdin . end ( )
74- let out = await p
74+ const out = await p
7575 assert . match ( out . stdout , / f o o / )
7676 assert . match ( out . stdout , / b a r / )
7777 } )
7878
7979 test ( 'starts repl with verbosity off' , async ( ) => {
80- let p = $ `node build/cli.js --repl`
80+ const p = $ `node build/cli.js --repl`
8181 p . stdin . write ( '"verbose" + " is " + $.verbose\n' )
8282 p . stdin . end ( )
83- let out = await p
83+ const out = await p
8484 assert . match ( out . stdout , / v e r b o s e i s f a l s e / )
8585 } )
8686
8787 test ( 'supports `--quiet` flag' , async ( ) => {
88- let p = await $ `node build/cli.js --quiet test/fixtures/markdown.md`
88+ const p = await $ `node build/cli.js --quiet test/fixtures/markdown.md`
8989 assert . ok ( ! p . stderr . includes ( 'ignore' ) , 'ignore was printed' )
9090 assert . ok ( ! p . stderr . includes ( 'hello' ) , 'no hello' )
9191 assert . ok ( p . stdout . includes ( 'world' ) , 'no world' )
9292 } )
9393
9494 test ( 'supports `--shell` flag ' , async ( ) => {
95- let shell = $ . shell
96- let p =
95+ const shell = $ . shell
96+ const p =
9797 await $ `node build/cli.js --verbose --shell=${ shell } <<< '$\`echo \${$.shell}\`'`
9898 assert . ok ( p . stderr . includes ( shell ) )
9999 } )
100100
101101 test ( 'supports `--prefix` flag ' , async ( ) => {
102- let prefix = 'set -e;'
103- let p =
102+ const prefix = 'set -e;'
103+ const p =
104104 await $ `node build/cli.js --verbose --prefix=${ prefix } <<< '$\`echo \${$.prefix}\`'`
105105 assert . ok ( p . stderr . includes ( prefix ) )
106106 } )
107107
108108 test ( 'supports `--postfix` flag ' , async ( ) => {
109- let postfix = '; exit 0'
110- let p =
109+ const postfix = '; exit 0'
110+ const p =
111111 await $ `node build/cli.js --verbose --postfix=${ postfix } <<< '$\`echo \${$.postfix}\`'`
112112 assert . ok ( p . stderr . includes ( postfix ) )
113113 } )
114114
115115 test ( 'supports `--cwd` option ' , async ( ) => {
116- let cwd = path . resolve ( fileURLToPath ( import . meta. url ) , '../../temp' )
116+ const cwd = path . resolve ( fileURLToPath ( import . meta. url ) , '../../temp' )
117117 fs . mkdirSync ( cwd , { recursive : true } )
118- let p =
118+ const p =
119119 await $ `node build/cli.js --verbose --cwd=${ cwd } <<< '$\`echo \${$.cwd}\`'`
120120 assert . ok ( p . stderr . endsWith ( cwd + '\n' ) )
121121 } )
122122
123123 test ( 'scripts from https' , async ( ) => {
124124 const server = $ `cat ${ path . resolve ( 'test/fixtures/echo.http' ) } | nc -l 8080`
125- let out =
125+ const out =
126126 await $ `node build/cli.js --verbose http://127.0.0.1:8080/echo.mjs`
127127 assert . match ( out . stderr , / t e s t / )
128128 await server . kill ( )
129129 } )
130130
131131 test ( 'scripts from https not ok' , async ( ) => {
132132 const server = $ `echo $'HTTP/1.1 500\n\n' | nc -l 8081`
133- let out = await $ `node build/cli.js http://127.0.0.1:8081` . nothrow ( )
133+ const out = await $ `node build/cli.js http://127.0.0.1:8081` . nothrow ( )
134134 assert . match ( out . stderr , / E r r o r : C a n ' t g e t / )
135135 await server . kill ( )
136136 } )
@@ -145,7 +145,7 @@ describe('cli', () => {
145145 } )
146146
147147 test ( 'require() is working from stdin' , async ( ) => {
148- let out =
148+ const out =
149149 await $ `node build/cli.js <<< 'console.log(require("./package.json").name)'`
150150 assert . match ( out . stdout , / z x / )
151151 } )
@@ -167,14 +167,14 @@ describe('cli', () => {
167167 } )
168168
169169 test ( 'markdown scripts are working for CRLF' , async ( ) => {
170- let p = await $ `node build/cli.js test/fixtures/markdown-crlf.md`
170+ const p = await $ `node build/cli.js test/fixtures/markdown-crlf.md`
171171 assert . ok ( p . stdout . includes ( 'Hello, world!' ) )
172172 } )
173173
174174 test ( 'exceptions are caught' , async ( ) => {
175- let out1 = await $ `node build/cli.js <<<${ 'await $`wtf`' } ` . nothrow ( )
175+ const out1 = await $ `node build/cli.js <<<${ 'await $`wtf`' } ` . nothrow ( )
176+ const out2 = await $ `node build/cli.js <<<'throw 42'` . nothrow ( )
176177 assert . match ( out1 . stderr , / E r r o r : / )
177- let out2 = await $ `node build/cli.js <<<'throw 42'` . nothrow ( )
178178 assert . match ( out2 . stderr , / 4 2 / )
179179 } )
180180
@@ -184,7 +184,7 @@ describe('cli', () => {
184184 } )
185185
186186 test ( 'eval works with stdin' , async ( ) => {
187- let p = $ `(printf foo; sleep 0.1; printf bar) | node build/cli.js --eval 'echo(await stdin())'`
187+ const p = $ `(printf foo; sleep 0.1; printf bar) | node build/cli.js --eval 'echo(await stdin())'`
188188 assert . equal ( ( await p ) . stdout , 'foobar\n' )
189189 } )
190190
@@ -231,7 +231,7 @@ describe('cli', () => {
231231 } )
232232
233233 test ( 'exit code can be set' , async ( ) => {
234- let p = await $ `node build/cli.js test/fixtures/exit-code.mjs` . nothrow ( )
234+ const p = await $ `node build/cli.js test/fixtures/exit-code.mjs` . nothrow ( )
235235 assert . equal ( p . exitCode , 42 )
236236 } )
237237
0 commit comments