@@ -129,10 +129,11 @@ export class NextDeployInstance extends NextInstance {
129129 const deployTitle = process . env . GITHUB_SHA
130130 ? `${ testName } - ${ process . env . GITHUB_SHA } `
131131 : testName
132+ const deployAlias = 'vercel-next-e2e'
132133
133134 const deployRes = await execa (
134135 'npx' ,
135- [ 'netlify' , 'deploy' , '--build' , '--message' , deployTitle ?? '' ] ,
136+ [ 'netlify' , 'deploy' , '--build' , '--message' , deployTitle ?? '' , '--alias' , deployAlias ] ,
136137 {
137138 cwd : this . testDir ,
138139 reject : false ,
@@ -146,22 +147,23 @@ export class NextDeployInstance extends NextInstance {
146147 }
147148
148149 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' )
152158 }
153- const [ deployID ] = new URL ( url ) . host . split ( '--' )
154- this . _url = url
159+
160+ this . _url = `https:// ${ deployID } -- ${ siteName } .netlify.app/`
155161 this . _parsedUrl = new URL ( this . _url )
156162 this . _deployId = deployID
157163 this . _shouldDeleteDeploy = ! process . env . NEXT_TEST_SKIP_CLEANUP
158164 this . _cliOutput = deployRes . stdout + deployRes . stderr
159- require ( 'console' ) . log ( `Deployment URL: ${ this . _url } ` )
160165
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 } ` )
165167 if ( buildLogsUrl ) {
166168 require ( 'console' ) . log ( `Logs: ${ buildLogsUrl } ` )
167169 }
0 commit comments