Skip to content

Commit

Permalink
Downloading vscode for the tests is flaky, so retry a couple times.
Browse files Browse the repository at this point in the history
  • Loading branch information
rictic committed Sep 30, 2023
1 parent 2a23856 commit 97be451
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion vscode-extension/src/test/scripts/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,33 @@ import * as path from 'path';

import {runTests} from '@vscode/test-electron';

const MAX_TRIES = 3;

/**
* Runs the tests via `run` up to 3 times, because downloading vscode is
* flaky.
*/
async function main() {
for (let i = 0; i < MAX_TRIES - 1; i++) {
try {
await run();
return;
} catch (err) {
console.error('Failed to run tests, retrying...');
}
// wait a few seconds before retrying
await new Promise((resolve) => setTimeout(resolve, 5_000));
}
await run();
}

/**
* Downloads vscode and starts it in extension test mode, pointing it at
* ./uvu-entrypoint
*
* Note that uvu-entrypoint runs in its own process, inside of electron.
*/
async function main() {
async function run() {
const extensionDevelopmentPath = path.resolve(__dirname, '../../../built');
const extensionTestsPath = path.resolve(__dirname, './uvu-entrypoint.js');
await runTests({extensionDevelopmentPath, extensionTestsPath});
Expand Down

0 comments on commit 97be451

Please sign in to comment.