@@ -129,10 +129,11 @@ export class NextDeployInstance extends NextInstance {
129
129
const deployTitle = process . env . GITHUB_SHA
130
130
? `${ testName } - ${ process . env . GITHUB_SHA } `
131
131
: testName
132
+ const deployAlias = 'vercel-next-e2e'
132
133
133
134
const deployRes = await execa (
134
135
'npx' ,
135
- [ 'netlify' , 'deploy' , '--build' , '--message' , deployTitle ?? '' ] ,
136
+ [ 'netlify' , 'deploy' , '--build' , '--message' , deployTitle ?? '' , '--alias' , deployAlias ] ,
136
137
{
137
138
cwd : this . testDir ,
138
139
reject : false ,
@@ -146,22 +147,23 @@ export class NextDeployInstance extends NextInstance {
146
147
}
147
148
148
149
try {
149
- const [ url ] = new RegExp ( / h t t p s : .+ \. n e t l i f y \. a p p / gm) . exec ( deployRes . stdout ) || [ ]
150
- if ( ! url ) {
151
- throw new Error ( 'Could not extract the URL from the build logs' )
150
+ const deployUrlRegex = new RegExp (
151
+ / h t t p s : \/ \/ a p p \. n e t l i f y \. c o m \/ s i t e s \/ (?< siteName > .+ ) \/ d e p l o y s \/ (?< deployID > [ 0 - 9 a - f ] + ) / gm,
152
+ ) . exec ( deployRes . stdout )
153
+ const [ buildLogsUrl ] = deployUrlRegex || [ ]
154
+ const { deployID, siteName } = deployUrlRegex ?. groups || { }
155
+
156
+ if ( ! deployID ) {
157
+ throw new Error ( 'Could not extract DeployID from the build logs' )
152
158
}
153
- const [ deployID ] = new URL ( url ) . host . split ( '--' )
154
- this . _url = url
159
+
160
+ this . _url = `https:// ${ deployID } -- ${ siteName } .netlify.app/`
155
161
this . _parsedUrl = new URL ( this . _url )
156
162
this . _deployId = deployID
157
163
this . _shouldDeleteDeploy = ! process . env . NEXT_TEST_SKIP_CLEANUP
158
164
this . _cliOutput = deployRes . stdout + deployRes . stderr
159
- require ( 'console' ) . log ( `Deployment URL: ${ this . _url } ` )
160
165
161
- const [ buildLogsUrl ] =
162
- new RegExp ( / h t t p s : \/ \/ a p p \. n e t l i f y \. c o m \/ s i t e s \/ .+ \/ d e p l o y s \/ [ 0 - 9 a - f ] + / gm) . exec (
163
- deployRes . stdout ,
164
- ) || [ ]
166
+ require ( 'console' ) . log ( `Deployment URL: ${ this . _url } ` )
165
167
if ( buildLogsUrl ) {
166
168
require ( 'console' ) . log ( `Logs: ${ buildLogsUrl } ` )
167
169
}
0 commit comments