message: test(docs-infra): print the browser version in `audit-web-app.js` to help debugging
  This commit updates the `audit-web-app.js` script (used to run PWA and
  a11y tests on angular.io) to also print the version of the browser used
  to run the tests. This can help when debugging a CI failure.
  PR Close
diff: @@ -60,7 +60,14 @@ async function _main(args) {
  try {
  console.log('');
  const startTime = Date.now();
  - const results = await launchChromeAndRunLighthouse(url, lhFlags, lhConfig);
  + const browser = await puppeteer.launch();
  + const browserVersion = await browser.version();
  + const results = await runLighthouse(browser, url, lhFlags, lhConfig);
  +
  + console.log(
  + `\n Browser version: ${browserVersion}` +
  + `\n Lighthouse version: ${results.lhr.lighthouseVersion}`);
  +
  const success = await processResults(results, minScores, logFile);
  console.log(`\n (Completed in ${((Date.now() - startTime) / 1000).toFixed(1)}s.)\n`);
  @@ -76,17 +83,6 @@ function formatScore(score) {
  return `${(score * 100).toFixed(0).padStart(3)}`;
  }
  -async function launchChromeAndRunLighthouse(url, flags, config) {
  - const browser = await puppeteer.launch();
  - flags.port = (new URL(browser.wsEndpoint())).port;
  -
  - try {
  - return await lighthouse(url, flags, config);
  - } finally {
  - await browser.close();
  - }
  -}
  -
  function onError(err) {
  console.error(err);
  console.error('');
  @@ -136,7 +132,6 @@ function parseMinScores(raw) {
  }
  async function processResults(results, minScores, logFile) {
  - const lhVersion = results.lhr.lighthouseVersion;
  const categories = results.lhr.categories;
  const report = results.report;
  @@ -147,7 +142,6 @@ async function processResults(results, minScores, logFile) {
  await printer.write(report, printer.OutputMode.json, logFile);
  }
  - console.log(`\nLighthouse version: ${lhVersion}`);
  console.log('\n Audit results:');
  const maxTitleLen = Math.max(...Object.values(categories).map(({title}) => title.length));
  @@ -165,3 +159,12 @@ async function processResults(results, minScores, logFile) {
  return success;
  }
  +
  +async function runLighthouse(browser, url, flags, config) {
  + try {
  + flags.port = (new URL(browser.wsEndpoint())).port;
  + return await lighthouse(url, flags, config);
  + } finally {
  + await browser.close();
  + }
  +}
  