mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: report install errors properly (#10016)
This commit is contained in:
parent
17f13da7e2
commit
7381229a16
@ -185,8 +185,6 @@ export async function install(
|
|||||||
} finally {
|
} finally {
|
||||||
debugTimeEnd('extract');
|
debugTimeEnd('extract');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
debugInstall(`Error during installation`, err);
|
|
||||||
} finally {
|
} finally {
|
||||||
if (existsSync(archivePath)) {
|
if (existsSync(archivePath)) {
|
||||||
await unlink(archivePath);
|
await unlink(archivePath);
|
||||||
|
@ -102,6 +102,32 @@ describe('Chrome install', () => {
|
|||||||
assert.ok(fs.existsSync(expectedOutputPath));
|
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', () => {
|
describe('with proxy', () => {
|
||||||
const proxyUrl = new URL(`http://localhost:54321`);
|
const proxyUrl = new URL(`http://localhost:54321`);
|
||||||
let proxyServer: http.Server;
|
let proxyServer: http.Server;
|
||||||
|
@ -18,5 +18,5 @@ export const testChromeBuildId = '113.0.5672.0';
|
|||||||
export const testChromiumBuildId = '1083080';
|
export const testChromiumBuildId = '1083080';
|
||||||
// TODO: We can add a Cron job to auto-update on change.
|
// TODO: We can add a Cron job to auto-update on change.
|
||||||
// Firefox keeps only `latest` version of Nightly builds.
|
// 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';
|
export const testChromeDriverBuildId = '112.0.5615.49';
|
||||||
|
Loading…
Reference in New Issue
Block a user