fix: report install errors properly (#10016)

This commit is contained in:
Alex Rudenko 2023-04-13 10:20:02 +02:00 committed by GitHub
parent 17f13da7e2
commit 7381229a16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 3 deletions

View File

@ -185,8 +185,6 @@ export async function install(
} finally {
debugTimeEnd('extract');
}
} catch (err) {
debugInstall(`Error during installation`, err);
} finally {
if (existsSync(archivePath)) {
await unlink(archivePath);

View File

@ -102,6 +102,32 @@ describe('Chrome install', () => {
assert.ok(fs.existsSync(expectedOutputPath));
});
it('throws on invalid URL', async function () {
const expectedOutputPath = path.join(
tmpDir,
'chrome',
`${BrowserPlatform.LINUX}-${testChromeBuildId}`
);
assert.strictEqual(fs.existsSync(expectedOutputPath), false);
async function installThatThrows(): Promise<unknown> {
try {
await install({
cacheDir: tmpDir,
browser: Browser.CHROME,
platform: BrowserPlatform.LINUX,
buildId: testChromeBuildId,
baseUrl: 'https://127.0.0.1',
});
return undefined;
} catch (err) {
return err;
}
}
assert.ok(await installThatThrows());
assert.strictEqual(fs.existsSync(expectedOutputPath), false);
});
describe('with proxy', () => {
const proxyUrl = new URL(`http://localhost:54321`);
let proxyServer: http.Server;

View File

@ -18,5 +18,5 @@ export const testChromeBuildId = '113.0.5672.0';
export const testChromiumBuildId = '1083080';
// TODO: We can add a Cron job to auto-update on change.
// Firefox keeps only `latest` version of Nightly builds.
export const testFirefoxBuildId = '113.0a1';
export const testFirefoxBuildId = '114.0a1';
export const testChromeDriverBuildId = '112.0.5615.49';