From 996e82c7aaa0ed4704011f44e9ff7eb72c5ce0f9 Mon Sep 17 00:00:00 2001 From: Maja Frydrychowicz Date: Mon, 10 Aug 2020 04:22:31 -0400 Subject: [PATCH] test(install): check for Firefox binary, clean up messages (#6316) --- scripts/test-install.sh | 2 +- src/install.ts | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/test-install.sh b/scripts/test-install.sh index c9262104e70b6..e59aa39d00be1 100755 --- a/scripts/test-install.sh +++ b/scripts/test-install.sh @@ -22,7 +22,7 @@ cd $TMPDIR PUPPETEER_PRODUCT=firefox npm install --loglevel silent "${tarball}" node --eval="require('puppeteer')" rm "${tarball}" -ls $TMPDIR/node_modules/puppeteer/.local-firefox/ +ls $TMPDIR/node_modules/puppeteer/.local-firefox/linux-*/firefox/firefox # Again for puppeteer-core cd $ROOTDIR diff --git a/src/install.ts b/src/install.ts index 7604f79e49753..c4fb23eb53c7e 100644 --- a/src/install.ts +++ b/src/install.ts @@ -20,9 +20,6 @@ import ProgressBar from 'progress'; import puppeteer from './index.js'; import { PUPPETEER_REVISIONS } from './revisions.js'; -const firefoxVersions = - 'https://product-details.mozilla.org/1.0/firefox_versions.json'; - const supportedProducts = { chrome: 'Chromium', firefox: 'Firefox Nightly', @@ -54,7 +51,7 @@ export async function downloadBrowser() { ); } else if (product === 'firefox') { puppeteer._preferredRevision = PUPPETEER_REVISIONS.firefox; - return getFirefoxNightlyVersion(browserFetcher.host()).catch((error) => { + return getFirefoxNightlyVersion().catch((error) => { console.error(error); process.exit(1); }); @@ -141,10 +138,15 @@ export async function downloadBrowser() { return `${Math.round(mb * 10) / 10} Mb`; } - function getFirefoxNightlyVersion(host) { + function getFirefoxNightlyVersion() { + const firefoxVersions = + 'https://product-details.mozilla.org/1.0/firefox_versions.json'; + const promise = new Promise((resolve, reject) => { let data = ''; - logPolitely(`Requesting latest Firefox Nightly version from ${host}`); + logPolitely( + `Requesting latest Firefox Nightly version from ${firefoxVersions}` + ); https .get(firefoxVersions, (r) => { if (r.statusCode >= 400)