Skip to content

Commit 1224dd4

Browse files
committed
Make sure REPL starts with verbosity off
1 parent 1593598 commit 1224dd4

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ const hook = createHook({
5959
})
6060
hook.enable()
6161

62-
const defaults: Options = {
62+
export const defaults: Options = {
6363
[processCwd]: process.cwd(),
64-
verbose: (global as any).ZX_VERBOSE ?? true,
64+
verbose: true,
6565
env: process.env,
6666
shell: true,
6767
prefix: '',

src/repl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import os from 'node:os'
1717
import path from 'node:path'
1818
import repl from 'node:repl'
1919
import { inspect } from 'node:util'
20-
import { ProcessOutput } from './core.js'
20+
import { ProcessOutput, defaults } from './core.js'
2121

2222
export function startRepl() {
23-
;(global as any).ZX_VERBOSE = false
23+
defaults.verbose = false
2424
const r = repl.start({
2525
prompt: chalk.greenBright.bold('❯ '),
2626
useGlobal: true,

test/cli.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ test('starts repl with -i', async () => {
6262
assert.match(out.stdout, 'bar')
6363
})
6464

65+
test('starts repl with verbosity off', async () => {
66+
let p = $`node build/cli.js -i`
67+
p.stdin.write('"verbose" + " is " + $.verbose\n')
68+
p.stdin.end()
69+
let out = await p
70+
assert.match(out.stdout, 'verbose is false')
71+
})
72+
6573
test('supports `--experimental` flag', async () => {
6674
let out = await $`echo 'echo("test")' | node build/cli.js --experimental`
6775
assert.match(out.stdout, 'test')

0 commit comments

Comments
 (0)