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:
Matt Bierner
2023-05-15 19:56:25 -07:00
committed by GitHub
parent 919262ff17
commit 09023d824a
2 changed files with 37 additions and 41 deletions

View File

@@ -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));
}