Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(install): check for Firefox binary, clean up messages #6316

Merged
merged 1 commit into from Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/test-install.sh
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions src/install.ts
Expand Up @@ -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',
Expand Down Expand Up @@ -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);
});
Expand Down Expand Up @@ -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)
Expand Down