@@ -46,6 +46,18 @@ export const cliFixture = envFixture.extend<{cli: CLIProcess}>({
4646 const spawnedProcesses : SpawnedProcess [ ] = [ ]
4747 const cliLog = createLogger ( 'cli' )
4848
49+ // When DEBUG=1, tee the subprocess streams to the parent so the CLI's
50+ // info/success boxes and progress messages appear live, while still
51+ // letting execa buffer and return the captured output.
52+ const runExeca = ( bin : string , args : string [ ] , execaOpts : ExecaOptions ) => {
53+ const subprocess = execa ( 'node' , [ bin , ...args ] , execaOpts )
54+ if ( process . env . DEBUG === '1' ) {
55+ subprocess . stdout ?. pipe ( process . stdout , { end : false } )
56+ subprocess . stderr ?. pipe ( process . stderr , { end : false } )
57+ }
58+ return subprocess
59+ }
60+
4961 const cli : CLIProcess = {
5062 async exec ( args , opts = { } ) {
5163 const timeout = opts . timeout ?? CLI_TIMEOUT . medium
@@ -56,9 +68,10 @@ export const cliFixture = envFixture.extend<{cli: CLIProcess}>({
5668 reject : false ,
5769 }
5870
59- cliLog . log ( env , `exec: node ${ executables . cli } ${ args . join ( ' ' ) } ` )
71+ cliLog . log ( env , `exec: node ${ executables . cli } ` )
72+ cliLog . log ( env , args . join ( ' ' ) )
6073
61- const result = await execa ( 'node' , [ executables . cli , ... args ] , execaOpts )
74+ const result = await runExeca ( executables . cli , args , execaOpts )
6275
6376 return {
6477 stdout : result . stdout ?? '' ,
@@ -76,9 +89,10 @@ export const cliFixture = envFixture.extend<{cli: CLIProcess}>({
7689 reject : false ,
7790 }
7891
79- cliLog . log ( env , `exec: node ${ executables . createApp } ${ args . join ( ' ' ) } ` )
92+ cliLog . log ( env , `exec: node ${ executables . createApp } ` )
93+ cliLog . log ( env , `app init ${ args . join ( ' ' ) } ` )
8094
81- const result = await execa ( 'node' , [ executables . createApp , ... args ] , execaOpts )
95+ const result = await runExeca ( executables . createApp , args , execaOpts )
8296
8397 return {
8498 stdout : result . stdout ?? '' ,
@@ -98,7 +112,8 @@ export const cliFixture = envFixture.extend<{cli: CLIProcess}>({
98112 }
99113 }
100114
101- cliLog . log ( env , `spawn: node ${ executables . cli } ${ args . join ( ' ' ) } ` )
115+ cliLog . log ( env , `spawn: node ${ executables . cli } ` )
116+ cliLog . log ( env , args . join ( ' ' ) )
102117
103118 const ptyProcess = nodePty . spawn ( 'node' , [ executables . cli , ...args ] , {
104119 name : 'xterm-color' ,
0 commit comments