@@ -36,6 +36,8 @@ export class NextDeployInstance extends NextInstance {
3636 private _buildId : string
3737 private _deployId : string
3838 private _shouldDeleteDeploy : boolean = false
39+ private _isCurrentlyDeploying : boolean = false
40+ private _deployOutput : string = ''
3941
4042 public get buildId ( ) {
4143 // get deployment ID via fetch since we can't access
@@ -52,6 +54,8 @@ export class NextDeployInstance extends NextInstance {
5254 return
5355 }
5456
57+ this . _isCurrentlyDeploying = true
58+
5559 const setupStartTime = Date . now ( )
5660
5761 // create the test site
@@ -131,7 +135,7 @@ export class NextDeployInstance extends NextInstance {
131135 : testName
132136 const deployAlias = 'vercel-next-e2e'
133137
134- const deployRes = await execa (
138+ const deployResPromise = execa (
135139 'npx' ,
136140 [ 'netlify' , 'deploy' , '--build' , '--message' , deployTitle ?? '' , '--alias' , deployAlias ] ,
137141 {
@@ -140,6 +144,15 @@ export class NextDeployInstance extends NextInstance {
140144 } ,
141145 )
142146
147+ const handleOutput = ( chunk ) => {
148+ this . _deployOutput += chunk
149+ }
150+
151+ deployResPromise . stdout . on ( 'data' , handleOutput )
152+ deployResPromise . stderr . on ( 'data' , handleOutput )
153+
154+ const deployRes = await deployResPromise
155+
143156 if ( deployRes . exitCode !== 0 ) {
144157 throw new Error (
145158 `Failed to deploy project (${ deployRes . exitCode } ) ${ deployRes . stdout } ${ deployRes . stderr } ` ,
@@ -168,7 +181,7 @@ export class NextDeployInstance extends NextInstance {
168181 require ( 'console' ) . log ( `Logs: ${ buildLogsUrl } ` )
169182 }
170183 } catch ( err ) {
171- console . error ( err )
184+ require ( ' console' ) . error ( err )
172185 throw new Error ( `Failed to parse deploy output: ${ deployRes . stdout } ` )
173186 }
174187
@@ -181,6 +194,8 @@ export class NextDeployInstance extends NextInstance {
181194
182195 require ( 'console' ) . log ( `Got buildId: ${ this . _buildId } ` )
183196 require ( 'console' ) . log ( `Setup time: ${ ( Date . now ( ) - setupStartTime ) / 1000.0 } s` )
197+
198+ this . _isCurrentlyDeploying = false
184199 }
185200
186201 public async destroy ( ) : Promise < void > {
@@ -205,6 +220,13 @@ export class NextDeployInstance extends NextInstance {
205220 }
206221 }
207222
223+ if ( this . _isCurrentlyDeploying ) {
224+ require ( 'console' ) . log ( 'Destroying before deployment finished.' )
225+ if ( this . _deployOutput ) {
226+ require ( 'console' ) . log ( `Deploy logs so far:\n\n${ this . _deployOutput } \n\n` )
227+ }
228+ }
229+
208230 await super . destroy ( )
209231 }
210232
0 commit comments