Skip to content

Commit

Permalink
fix: check if chrome or chromium is installed before trying to run
Browse files Browse the repository at this point in the history
  • Loading branch information
TGiles committed Mar 20, 2022
1 parent f1df224 commit 2524887
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lighthouse_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,27 @@ const _setupCrawlerEvents = (domainRoot, simpleCrawler, isDomainRootAnArray, url
return simpleCrawler;
};

/**
* Determines if the chrome-launcher package can find an installed Chromium/Chrome executable.
*
*/
const determineIfChromeIsInstalled = () => {
try {
chromeLauncher.getChromePath();
}
catch (e) {
console.error("You need to install Chromium or Chrome in order to use auto-lighthouse.");
throw e;
}
}

/**
* Main function.
* This kicks off the Lighthouse Runner process
* @param {commander} program - An instance of a Commander.js program
*/
function main(program) {
determineIfChromeIsInstalled();
let domainRoot;
let simpleCrawler;
let programOptions = (program.opts === undefined) ? program : program.opts();
Expand Down

0 comments on commit 2524887

Please sign in to comment.