File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
dev-packages/node-integration-tests/utils Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,13 @@ export function cleanupChildProcesses(): void {
41
41
process . on ( 'exit' , cleanupChildProcesses ) ;
42
42
43
43
/** Promise only resolves when fn returns true */
44
- async function waitFor ( fn : ( ) => boolean , timeout = 10_000 ) : Promise < void > {
44
+ async function waitFor ( fn : ( ) => boolean , timeout = 10_000 , message = 'Timed out waiting' ) : Promise < void > {
45
45
let remaining = timeout ;
46
46
while ( fn ( ) === false ) {
47
47
await new Promise < void > ( resolve => setTimeout ( resolve , 100 ) ) ;
48
48
remaining -= 100 ;
49
49
if ( remaining < 0 ) {
50
- throw new Error ( 'Timed out waiting for server port' ) ;
50
+ throw new Error ( message ) ;
51
51
}
52
52
}
53
53
}
@@ -519,7 +519,7 @@ export function createRunner(...paths: string[]) {
519
519
520
520
return {
521
521
completed : async function ( ) : Promise < void > {
522
- await waitFor ( ( ) => isComplete ) ;
522
+ await waitFor ( ( ) => isComplete , 120_000 , 'Timed out waiting for test to complete' ) ;
523
523
524
524
if ( completeError ) {
525
525
throw completeError ;
@@ -537,7 +537,7 @@ export function createRunner(...paths: string[]) {
537
537
options : { headers ?: Record < string , string > ; data ?: unknown ; expectError ?: boolean } = { } ,
538
538
) : Promise < T | undefined > {
539
539
try {
540
- await waitFor ( ( ) => scenarioServerPort !== undefined ) ;
540
+ await waitFor ( ( ) => scenarioServerPort !== undefined , 10_000 , 'Timed out waiting for server port' ) ;
541
541
} catch ( e ) {
542
542
complete ( e as Error ) ;
543
543
return ;
You can’t perform that action at this time.
0 commit comments