@@ -81,19 +81,20 @@ const promises = fixtures.map((fixture) =>
8181 await rm ( join ( cwd , 'package-lock.json' ) , { force : true } )
8282 }
8383
84- const addPrefix = new Transform ( {
85- transform ( chunk , encoding , callback ) {
86- this . push ( chunk . toString ( ) . replace ( / \n / gm, `\n[${ fixture } ] ` ) )
87- callback ( )
88- } ,
89- flush ( callback ) {
90- // final transform might create non-terminated line with a prefix
91- // so this is just to make sure we end with a newline so further writes
92- // to same destination stream start on a new line for better readability
93- this . push ( '\n' )
94- callback ( )
95- } ,
96- } )
84+ const addPrefix = ( ) =>
85+ new Transform ( {
86+ transform ( chunk , encoding , callback ) {
87+ this . push ( chunk . toString ( ) . replace ( / \n / gm, `\n[${ fixture } ] ` ) )
88+ callback ( )
89+ } ,
90+ flush ( callback ) {
91+ // final transform might create non-terminated line with a prefix
92+ // so this is just to make sure we end with a newline so further writes
93+ // to same destination stream start on a new line for better readability
94+ this . push ( '\n' )
95+ callback ( )
96+ } ,
97+ } )
9798
9899 console . log ( `[${ fixture } ] Running \`${ cmd } \`...` )
99100 const output = execaCommand ( cmd , {
@@ -102,13 +103,13 @@ const promises = fixtures.map((fixture) =>
102103 env : { ...process . env , FORCE_COLOR : '1' } ,
103104 } )
104105 if ( process . env . DEBUG ) {
105- output . stdout ?. pipe ( addPrefix ) . pipe ( process . stdout )
106+ output . stdout ?. pipe ( addPrefix ( ) ) . pipe ( process . stdout )
106107 }
107- output . stderr ?. pipe ( addPrefix ) . pipe ( process . stderr )
108+ output . stderr ?. pipe ( addPrefix ( ) ) . pipe ( process . stderr )
108109 return output . finally ( async ( ) => {
109110 const npmListPromise = execaCommand ( `npm list next` , { cwd, stdio : 'pipe' } )
110- npmListPromise . stdout ?. pipe ( addPrefix ) . pipe ( process . stdout )
111- npmListPromise . stderr ?. pipe ( addPrefix ) . pipe ( process . stderr )
111+ npmListPromise . stdout ?. pipe ( addPrefix ( ) ) . pipe ( process . stdout )
112+ npmListPromise . stderr ?. pipe ( addPrefix ( ) ) . pipe ( process . stderr )
112113 await npmListPromise
113114
114115 await setNextVersionInFixture ( cwd , 'latest' , {
0 commit comments