@@ -36,6 +36,8 @@ export class NextDeployInstance extends NextInstance {
36
36
private _buildId : string
37
37
private _deployId : string
38
38
private _shouldDeleteDeploy : boolean = false
39
+ private _isCurrentlyDeploying : boolean = false
40
+ private _deployOutput : string = ''
39
41
40
42
public get buildId ( ) {
41
43
// get deployment ID via fetch since we can't access
@@ -52,6 +54,8 @@ export class NextDeployInstance extends NextInstance {
52
54
return
53
55
}
54
56
57
+ this . _isCurrentlyDeploying = true
58
+
55
59
const setupStartTime = Date . now ( )
56
60
57
61
// create the test site
@@ -131,7 +135,7 @@ export class NextDeployInstance extends NextInstance {
131
135
: testName
132
136
const deployAlias = 'vercel-next-e2e'
133
137
134
- const deployRes = await execa (
138
+ const deployResPromise = execa (
135
139
'npx' ,
136
140
[ 'netlify' , 'deploy' , '--build' , '--message' , deployTitle ?? '' , '--alias' , deployAlias ] ,
137
141
{
@@ -140,6 +144,15 @@ export class NextDeployInstance extends NextInstance {
140
144
} ,
141
145
)
142
146
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
+
143
156
if ( deployRes . exitCode !== 0 ) {
144
157
throw new Error (
145
158
`Failed to deploy project (${ deployRes . exitCode } ) ${ deployRes . stdout } ${ deployRes . stderr } ` ,
@@ -168,7 +181,7 @@ export class NextDeployInstance extends NextInstance {
168
181
require ( 'console' ) . log ( `Logs: ${ buildLogsUrl } ` )
169
182
}
170
183
} catch ( err ) {
171
- console . error ( err )
184
+ require ( ' console' ) . error ( err )
172
185
throw new Error ( `Failed to parse deploy output: ${ deployRes . stdout } ` )
173
186
}
174
187
@@ -181,6 +194,8 @@ export class NextDeployInstance extends NextInstance {
181
194
182
195
require ( 'console' ) . log ( `Got buildId: ${ this . _buildId } ` )
183
196
require ( 'console' ) . log ( `Setup time: ${ ( Date . now ( ) - setupStartTime ) / 1000.0 } s` )
197
+
198
+ this . _isCurrentlyDeploying = false
184
199
}
185
200
186
201
public async destroy ( ) : Promise < void > {
@@ -205,6 +220,13 @@ export class NextDeployInstance extends NextInstance {
205
220
}
206
221
}
207
222
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
+
208
230
await super . destroy ( )
209
231
}
210
232
0 commit comments