@@ -237,22 +237,16 @@ export class Logger {
237237 this . log ( PAD + c . gray ( `Running tests with seed "${ seed } "` ) )
238238 }
239239
240- if ( this . ctx . config . ui ) {
241- const host = this . ctx . config . api ?. host || 'localhost'
242- const port = this . ctx . vite . config . server . port
243- const url = new URL ( this . ctx . config . uiBase , `http://${ host } :${ port } ` )
244- url . searchParams . set ( 'token' , this . ctx . config . api . token )
245-
246- this . log ( PAD + c . dim ( c . green ( `UI started at ${ url } ` ) ) )
247- }
248- // browser mode always has `api.port`, but only listens on startup for `api`/`ui`
249- else if ( this . ctx . config . api ?. port && this . ctx . config . _apiRequested ) {
250- const resolvedUrls = this . ctx . vite . resolvedUrls
251- // workaround for https://github.com/vitejs/vite/issues/15438, it was fixed in vite 5.1
252- const fallbackUrl = `http://${ this . ctx . config . api . host || 'localhost' } :${ this . ctx . config . api . port } `
253- const origin = resolvedUrls ?. local [ 0 ] ?? resolvedUrls ?. network [ 0 ] ?? fallbackUrl
254-
255- this . log ( PAD + c . dim ( c . green ( `API started at ${ new URL ( '/' , origin ) } ` ) ) )
240+ const resolvedUrls = this . ctx . vite . resolvedUrls
241+ const origin = resolvedUrls ?. local [ 0 ] ?? resolvedUrls ?. network [ 0 ]
242+ if ( origin && this . ctx . config . _apiRequested ) {
243+ if ( this . ctx . config . ui ) {
244+ const url = new URL ( this . ctx . config . uiBase , origin )
245+ url . searchParams . set ( 'token' , this . ctx . config . api . token )
246+ this . log ( PAD + c . dim ( c . green ( `UI started at ${ url } ` ) ) )
247+ } else {
248+ this . log ( PAD + c . dim ( c . green ( `API started at ${ new URL ( '/' , origin ) } ` ) ) )
249+ }
256250 }
257251
258252 if ( this . ctx . coverageProvider ) {
0 commit comments