@@ -19,7 +19,7 @@ export type NextTestOptions = {
1919
2020export function createNextTest ( {
2121 path,
22- timeout = ms ( "2 minutes" ) ,
22+ timeout = ms ( "5 minutes" ) ,
2323 port = 3000 ,
2424 dependencies,
2525 showStdout = false ,
@@ -36,23 +36,25 @@ export function createNextTest({
3636 } )
3737
3838 test . setTimeout ( timeout )
39- // baseTest.setTimeout(timeout)
39+
40+ const idOr = ( id ?: string ) => id === undefined ? '' : `${ id } : ` ;
4041
4142 // Start Next.js dev server
4243 test . beforeAll ( async ( { } , testInfo ) => {
4344 testInfo . setTimeout ( timeout )
4445 tempTestPath = await createTempTestFolder ( path )
45- if ( id ) {
46- console . log ( id , "CREATED TEMP FOLDER" )
46+
47+ if ( debug ) {
48+ console . log ( `${ idOr ( id ) } Created temp folder` )
4749 }
4850
4951 // Patch dependencies
5052 mergePackageJson ( tempTestPath , { dependencies } ) ;
5153
5254 // Run install
5355 await pnpmInstall ( tempTestPath , showStdout )
54- if ( id ) {
55- console . log ( id , "RAN PNPM INSTALL" )
56+ if ( debug ) {
57+ console . log ( ` ${ idOr ( id ) } Finished "pnpm install"` )
5658 }
5759
5860 // Start dev server
@@ -64,13 +66,13 @@ export function createNextTest({
6466 }
6567 } )
6668
67- if ( id ) {
68- console . log ( id , "STARTED SERVER" )
69+ if ( debug ) {
70+ console . log ( ` ${ idOr ( id ) } Started server` )
6971 }
7072
7173 if ( true ) {
72- serverProcess . stdout ?. on ( 'data' , ( data : Buffer | string ) => console . log ( id , data . toString ( ) ) )
73- serverProcess . stderr ?. on ( 'data' , ( data : Buffer | string ) => console . error ( id , data . toString ( ) ) )
74+ serverProcess . stdout ?. on ( 'data' , ( data : Buffer | string ) => console . log ( idOr ( id ) , data . toString ( ) ) )
75+ serverProcess . stderr ?. on ( 'data' , ( data : Buffer | string ) => console . error ( idOr ( id ) , data . toString ( ) ) )
7476 }
7577
7678 await new Promise < undefined > ( resolve => {
@@ -80,8 +82,9 @@ export function createNextTest({
8082 }
8183 } ) ;
8284 } ) ;
83- if ( id ) {
84- console . log ( id , "SERVER READY" )
85+
86+ if ( debug ) {
87+ console . log ( `${ idOr ( id ) } Server ready` )
8588 }
8689 } )
8790
0 commit comments