Skip to content

Commit

Permalink
Increase timeout to stabilize e2e tests on MacOS x64
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Sep 16, 2024
1 parent a520eb1 commit ecc7598
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions packages/e2e-tests/test/test-shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,39 +175,45 @@ export class TestShell {
}

async waitForPrompt(start = 0): Promise<void> {
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<number> {
Expand Down

0 comments on commit ecc7598

Please sign in to comment.