mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 17:19:01 +01:00
Try promise.race
This commit is contained in:
@@ -367,13 +367,13 @@ suite('vscode API - window', () => {
|
||||
const rightDiff = await createRandomFile();
|
||||
await commands.executeCommand('vscode.diff', leftDiff, rightDiff, 'Diff', { viewColumn: ViewColumn.Three, preview: false });
|
||||
|
||||
// Wait for the tab change event to fire
|
||||
await new Promise<void>((resolve) => {
|
||||
// Wait for the tab change event to fire or 500ms
|
||||
await Promise.race([new Promise<void>((resolve) => {
|
||||
const dispsable = window.onDidChangeTabs(() => {
|
||||
dispsable.dispose();
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}), new Promise(c => setTimeout(c, 500))]);
|
||||
|
||||
const tabs = window.tabs;
|
||||
assert.strictEqual(tabs.length, 5);
|
||||
|
||||
Reference in New Issue
Block a user