@@ -301,9 +301,10 @@ export async function appBuildTests(config: { moduleName?: string, cwd?: string,
301
301
302
302
const logger = log . contextLogger ( 'UIUX' )
303
303
const BUILD_TIMEOUT = 180_000
304
- const { portOptions } = getModifiedCommands ( config . commands )
304
+ const { portOptions, commands } = getModifiedCommands ( config . commands )
305
305
306
- const checkRunCommand = async ( runCommand : string ) => {
306
+ const checkRunCommand = async ( runCommand : string , opts : { portCommand ?: string } = { } ) => {
307
+ const { portCommand = '' } = opts
307
308
const command = [ `npm -w ${ moduleName } exec -- fiction run ${ runCommand } --exit` , ...portOptions ] . join ( ' ' )
308
309
309
310
try {
@@ -312,6 +313,23 @@ export async function appBuildTests(config: { moduleName?: string, cwd?: string,
312
313
envVars : { IS_TEST : '1' , TEST_ENV : 'unit' } ,
313
314
timeout : BUILD_TIMEOUT ,
314
315
resolveText : '[ready]' ,
316
+ beforeResolve : async ( ) => {
317
+ const url = commands . find ( _ => _ . command === runCommand || ( portCommand && _ . command === portCommand ) ) ?. url . value
318
+ try {
319
+ logger . info ( `RUN CHECK START` , { data : { command, url } } )
320
+
321
+ if ( ! url )
322
+ throw new Error ( 'no url' )
323
+
324
+ await fetch ( url )
325
+
326
+ logger . info ( 'RUN CHECK DONE' , { data : { url } } )
327
+ }
328
+ catch ( error ) {
329
+ logger . error ( 'FETCH PROBLEM' , { error, data : { commands, runCommand, url } } )
330
+ throw error
331
+ }
332
+ } ,
315
333
} )
316
334
317
335
expect ( r . stdout ) . toContain ( '[ready]' )
@@ -346,7 +364,7 @@ export async function appBuildTests(config: { moduleName?: string, cwd?: string,
346
364
} , BUILD_TIMEOUT )
347
365
348
366
it ( `RUNS DEV: ${ moduleName } ` , async ( ) => {
349
- await checkRunCommand ( 'dev' )
367
+ await checkRunCommand ( 'dev' , { portCommand : 'app' } )
350
368
} , BUILD_TIMEOUT )
351
369
352
370
it ( `LOADS WITHOUT ERROR: ${ moduleName } ` , async ( ) => {
0 commit comments