From ecc75988c876ee01b43d0f838a8a8afe3135449c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Mon, 16 Sep 2024 09:15:16 +0200 Subject: [PATCH] Increase timeout to stabilize e2e tests on MacOS x64 --- packages/e2e-tests/test/test-shell.ts | 66 +++++++++++++++------------ 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/packages/e2e-tests/test/test-shell.ts b/packages/e2e-tests/test/test-shell.ts index 4474b07a7..8b8f5e809 100644 --- a/packages/e2e-tests/test/test-shell.ts +++ b/packages/e2e-tests/test/test-shell.ts @@ -175,39 +175,45 @@ export class TestShell { } async waitForPrompt(start = 0): Promise { - await eventually(() => { - const output = this._output.slice(start); - const lines = output.split('\n'); - const found = !!lines - .filter((l) => PROMPT_PATTERN.exec(l)) // a line that is the prompt must at least match the pattern - .find((l) => { - // in some situations the prompt occurs multiple times in the line (but only in tests!) - const prompts = l - .trim() - .replace(/>$/g, '') - .split('>') - .map((m) => m.trim()); - // if there are multiple prompt parts they must all equal - if (prompts.length > 1) { - for (const p of prompts) { - if (p !== prompts[0]) { - return false; + await eventually( + () => { + const output = this._output.slice(start); + const lines = output.split('\n'); + const found = !!lines + .filter((l) => PROMPT_PATTERN.exec(l)) // a line that is the prompt must at least match the pattern + .find((l) => { + // in some situations the prompt occurs multiple times in the line (but only in tests!) + const prompts = l + .trim() + .replace(/>$/g, '') + .split('>') + .map((m) => m.trim()); + // if there are multiple prompt parts they must all equal + if (prompts.length > 1) { + for (const p of prompts) { + if (p !== prompts[0]) { + return false; + } } } - } - return true; - }); - if (!found) { - throw new assert.AssertionError({ - message: 'expected prompt', - expected: PROMPT_PATTERN.toString(), - actual: - this._output.slice(0, start) + - '[prompt search starts here]' + - output, - }); + return true; + }); + if (!found) { + throw new assert.AssertionError({ + message: 'expected prompt', + expected: PROMPT_PATTERN.toString(), + actual: + this._output.slice(0, start) + + '[prompt search starts here]' + + output, + }); + } + }, + { + // Increased timeout to account for slow startup on MacOS x64 hosts + timeout: 20_000, } - }); + ); } waitForExit(): Promise {