Skip to content

Commit

Permalink
build: follow-up fixes for AIO lighthouse checks
Browse files Browse the repository at this point in the history
Looks like the latest versions of Lighthouse and puppeteer
are not compatible with our Chromium version from dev-infra.

This commit reverts the updates, and fixes the jobs.
  • Loading branch information
devversion committed Mar 27, 2024
1 parent 9aff43b commit 35c63ea
Show file tree
Hide file tree
Showing 3 changed files with 481 additions and 333 deletions.
4 changes: 2 additions & 2 deletions aio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"light-server": "^2.9.1",
"lighthouse": "^11.0.0",
"lighthouse": "~9.0.0",
"lighthouse-logger": "^2.0.0",
"lodash": "^4.17.21",
"lunr": "^2.3.9",
"npm-run-all": "^4.1.5",
"patch-package": "^7.0.0",
"protractor": "~7.0.0",
"puppeteer-core": "22.5.0",
"puppeteer-core": "~21.3.8",
"rehype-slug": "^4.0.1",
"remark": "^12.0.0",
"remark-html": "^13.0.0",
Expand Down
9 changes: 6 additions & 3 deletions aio/scripts/audit-web-app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

// Imports
import lighthouse from 'lighthouse';
import * as printer from 'lighthouse/cli/printer.js';
import * as printer from 'lighthouse/lighthouse-cli/printer.js';
import logger from 'lighthouse-logger';
import puppeteer from 'puppeteer-core';
import path from 'path';
Expand Down Expand Up @@ -60,6 +60,7 @@ async function _main(args) {

console.log(`Running web-app audits for '${url}'...`);
console.log(` Audit categories: ${lhFlags.onlyCategories.join(', ')}`);
console.log(process.env.CHROME_BIN);

logger.setLevel(lhFlags.logLevel);

Expand All @@ -68,9 +69,11 @@ async function _main(args) {
const startTime = Date.now();
const browser = await puppeteer.launch({
executablePath: path.resolve(process.env.CHROME_BIN),
args: ['--no-sandbox', '--headless']
args: ['--no-sandbox', '--headless'],
});
console.log('launched');
const browserVersion = await browser.version();
console.log(browserVersion);
const results = await runLighthouse(browser, url, lhFlags, lhConfig);

console.log(
Expand Down Expand Up @@ -171,7 +174,7 @@ async function processResults(results, minScores, logFile) {

async function runLighthouse(browser, url, flags, config) {
try {
flags.logLevel = 'silent';
flags.logLevel = 'verbose';
flags.port = (new URL(browser.wsEndpoint())).port;
return await lighthouse(url, flags, config);
} finally {
Expand Down

0 comments on commit 35c63ea

Please sign in to comment.