Skip to content

Commit 4e41faf

Browse files
committed
update timeout
1 parent 6d1a73c commit 4e41faf

File tree

1 file changed

+4
-4
lines changed
  • dev-packages/node-integration-tests/utils

1 file changed

+4
-4
lines changed

dev-packages/node-integration-tests/utils/runner.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ export function cleanupChildProcesses(): void {
4141
process.on('exit', cleanupChildProcesses);
4242

4343
/** 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> {
4545
let remaining = timeout;
4646
while (fn() === false) {
4747
await new Promise<void>(resolve => setTimeout(resolve, 100));
4848
remaining -= 100;
4949
if (remaining < 0) {
50-
throw new Error('Timed out waiting for server port');
50+
throw new Error(message);
5151
}
5252
}
5353
}
@@ -519,7 +519,7 @@ export function createRunner(...paths: string[]) {
519519

520520
return {
521521
completed: async function (): Promise<void> {
522-
await waitFor(() => isComplete);
522+
await waitFor(() => isComplete, 120_000, 'Timed out waiting for test to complete');
523523

524524
if (completeError) {
525525
throw completeError;
@@ -537,7 +537,7 @@ export function createRunner(...paths: string[]) {
537537
options: { headers?: Record<string, string>; data?: unknown; expectError?: boolean } = {},
538538
): Promise<T | undefined> {
539539
try {
540-
await waitFor(() => scenarioServerPort !== undefined);
540+
await waitFor(() => scenarioServerPort !== undefined, 10_000, 'Timed out waiting for server port');
541541
} catch (e) {
542542
complete(e as Error);
543543
return;

0 commit comments

Comments
 (0)