mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 16:18:58 +01:00
Try to fix flaky paste tests (#182574)
These tests fail occasionally in CI, seemingly only on linux. This tries to fix this by: - Adding retries - Switching back to use `teardown` to disposed of things. `usingDisposable` may not clean up properly if the test times out
This commit is contained in:
@@ -62,17 +62,6 @@ export function disposeAll(disposables: vscode.Disposable[]) {
|
||||
vscode.Disposable.from(...disposables).dispose();
|
||||
}
|
||||
|
||||
export function usingDisposables<R>(fn: (this: Mocha.Context, store: vscode.Disposable[]) => Promise<R>) {
|
||||
return async function (this: Mocha.Context): Promise<R> {
|
||||
const disposables: vscode.Disposable[] = [];
|
||||
try {
|
||||
return await fn.call(this, disposables);
|
||||
} finally {
|
||||
disposeAll(disposables);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function delay(ms: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user