@@ -54,6 +54,8 @@ export class NextDeployInstance extends NextInstance {
5454 return
5555 }
5656
57+ let deployStartTime = Date . now ( )
58+
5759 this . _isCurrentlyDeploying = true
5860
5961 const setupStartTime = Date . now ( )
@@ -72,12 +74,24 @@ export class NextDeployInstance extends NextInstance {
7274
7375 const { runtimePackageName, runtimePackageTarballPath } = await packNextRuntime ( )
7476
77+ const handleOutput = ( chunk ) => {
78+ const timestampPrefix = `[${ new Date ( ) . toISOString ( ) } ] (+${ ( ( Date . now ( ) - deployStartTime ) / 1000 ) . toFixed ( 3 ) } s) `
79+
80+ this . _deployOutput +=
81+ ( this . _deployOutput === '' || this . _deployOutput . endsWith ( '\n' ) ? timestampPrefix : '' ) +
82+ chunk . toString ( ) . replace ( / \n (? = .) / gm, `\n${ timestampPrefix } ` )
83+ }
84+
7585 // install dependencies
76- await execa ( 'npm' , [ 'i' , runtimePackageTarballPath , '--legacy-peer-deps' ] , {
86+ const installResPromise = execa ( 'npm' , [ 'i' , runtimePackageTarballPath , '--legacy-peer-deps' ] , {
7787 cwd : this . testDir ,
78- stdio : 'inherit' ,
7988 } )
8089
90+ installResPromise . stdout . on ( 'data' , handleOutput )
91+ installResPromise . stderr . on ( 'data' , handleOutput )
92+
93+ await installResPromise
94+
8195 if ( fs . existsSync ( nodeModulesBak ) ) {
8296 // move the contents of the fixture node_modules into the installed modules
8397 for ( const file of await fs . readdir ( nodeModulesBak ) ) {
@@ -117,7 +131,12 @@ export class NextDeployInstance extends NextInstance {
117131
118132 // ensure project is linked
119133 try {
120- await execa ( 'npx' , [ 'netlify' , 'status' , '--json' ] )
134+ const netlifyStatusPromise = execa ( 'npx' , [ 'netlify' , 'status' , '--json' ] )
135+
136+ netlifyStatusPromise . stdout . on ( 'data' , handleOutput )
137+ netlifyStatusPromise . stderr . on ( 'data' , handleOutput )
138+
139+ await netlifyStatusPromise
121140 } catch ( err ) {
122141 if ( err . message . includes ( "You don't appear to be in a folder that is linked to a site" ) ) {
123142 throw new Error ( `Site is not linked. Please set "NETLIFY_AUTH_TOKEN" and "NETLIFY_SITE_ID"` )
@@ -144,10 +163,6 @@ export class NextDeployInstance extends NextInstance {
144163 } ,
145164 )
146165
147- const handleOutput = ( chunk ) => {
148- this . _deployOutput += chunk
149- }
150-
151166 deployResPromise . stdout . on ( 'data' , handleOutput )
152167 deployResPromise . stderr . on ( 'data' , handleOutput )
153168
@@ -184,7 +199,7 @@ export class NextDeployInstance extends NextInstance {
184199 }
185200 } catch ( err ) {
186201 require ( 'console' ) . error ( err )
187- throw new Error ( `Failed to parse deploy output: ${ deployRes . stdout } ` )
202+ throw new Error ( `Failed to parse deploy output: " ${ deployRes . stdout } " ` )
188203 }
189204
190205 this . _buildId = (
0 commit comments