Skip to content

Commit 87ef131

Browse files
authored
Merge branch 'master' into feat/enable-windows-integration-tests
2 parents e686527 + 6370a93 commit 87ef131

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

test/api/TestUtils.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
import * as playwright from 'playwright';
77
import deepEqual = require('deep-equal');
88
import { ITerminalOptions } from 'xterm';
9+
import { deepStrictEqual, fail } from 'assert';
910

10-
export async function pollFor<T>(page: playwright.Page, evalOrFn: string | (() => Promise<T>), val: T, preFn?: () => Promise<void>): Promise<void> {
11+
export async function pollFor<T>(page: playwright.Page, evalOrFn: string | (() => Promise<T>), val: T, preFn?: () => Promise<void>, maxDuration?: number): Promise<void> {
1112
if (preFn) {
1213
await preFn();
1314
}
@@ -18,8 +19,14 @@ export async function pollFor<T>(page: playwright.Page, evalOrFn: string | (() =
1819
}
1920

2021
if (!deepEqual(result, val)) {
22+
if (maxDuration === undefined) {
23+
maxDuration = 2000;
24+
}
25+
if (maxDuration <= 0) {
26+
deepStrictEqual(result, val, 'pollFor max duration exceeded');
27+
}
2128
return new Promise<void>(r => {
22-
setTimeout(() => r(pollFor(page, evalOrFn, val, preFn)), 1);
29+
setTimeout(() => r(pollFor(page, evalOrFn, val, preFn, maxDuration! - 10)), 10);
2330
});
2431
}
2532
}

typings/xterm.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ declare module 'xterm' {
713713
* Adds an event listener for when the bell is triggered.
714714
* @returns an `IDisposable` to stop listening.
715715
*/
716-
onBell: IEvent<void>;
716+
onBell: IEvent<void>;
717717

718718
/**
719719
* Unfocus the terminal.

0 commit comments

Comments
 (0)