@@ -54,6 +54,8 @@ export class NextDeployInstance extends NextInstance {
54
54
return
55
55
}
56
56
57
+ let deployStartTime = Date . now ( )
58
+
57
59
this . _isCurrentlyDeploying = true
58
60
59
61
const setupStartTime = Date . now ( )
@@ -72,12 +74,24 @@ export class NextDeployInstance extends NextInstance {
72
74
73
75
const { runtimePackageName, runtimePackageTarballPath } = await packNextRuntime ( )
74
76
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
+
75
85
// install dependencies
76
- await execa ( 'npm' , [ 'i' , runtimePackageTarballPath , '--legacy-peer-deps' ] , {
86
+ const installResPromise = execa ( 'npm' , [ 'i' , runtimePackageTarballPath , '--legacy-peer-deps' ] , {
77
87
cwd : this . testDir ,
78
- stdio : 'inherit' ,
79
88
} )
80
89
90
+ installResPromise . stdout . on ( 'data' , handleOutput )
91
+ installResPromise . stderr . on ( 'data' , handleOutput )
92
+
93
+ await installResPromise
94
+
81
95
if ( fs . existsSync ( nodeModulesBak ) ) {
82
96
// move the contents of the fixture node_modules into the installed modules
83
97
for ( const file of await fs . readdir ( nodeModulesBak ) ) {
@@ -117,7 +131,12 @@ export class NextDeployInstance extends NextInstance {
117
131
118
132
// ensure project is linked
119
133
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
121
140
} catch ( err ) {
122
141
if ( err . message . includes ( "You don't appear to be in a folder that is linked to a site" ) ) {
123
142
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 {
144
163
} ,
145
164
)
146
165
147
- const handleOutput = ( chunk ) => {
148
- this . _deployOutput += chunk
149
- }
150
-
151
166
deployResPromise . stdout . on ( 'data' , handleOutput )
152
167
deployResPromise . stderr . on ( 'data' , handleOutput )
153
168
@@ -184,7 +199,7 @@ export class NextDeployInstance extends NextInstance {
184
199
}
185
200
} catch ( err ) {
186
201
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 } " ` )
188
203
}
189
204
190
205
this . _buildId = (
0 commit comments