build(docs-infra): upgrade lighthouse to 3.2.1 (#26459)
PR Close #26459
This commit is contained in:

committed by
Miško Hevery

parent
95d0626a1e
commit
1aa8cfbf74
@ -11,10 +11,10 @@
|
||||
*/
|
||||
|
||||
// Imports
|
||||
const chromeLauncher = require('chrome-launcher');
|
||||
const lighthouse = require('lighthouse');
|
||||
const chromeLauncher = require('lighthouse/chrome-launcher');
|
||||
const printer = require('lighthouse/lighthouse-cli/printer');
|
||||
const config = require('lighthouse/lighthouse-core/config/default.js');
|
||||
const config = require('lighthouse/lighthouse-core/config/default-config.js');
|
||||
|
||||
// Constants
|
||||
const CHROME_LAUNCH_OPTS = {};
|
||||
@ -87,20 +87,19 @@ function parseInput(args) {
|
||||
}
|
||||
|
||||
function processResults(results, logFile) {
|
||||
let promise = Promise.resolve();
|
||||
const categories = results.lhr.categories;
|
||||
const report = results.report;
|
||||
|
||||
if (logFile) {
|
||||
console.log(`Saving results in '${logFile}'...`);
|
||||
console.log(`(LightHouse viewer: ${VIEWER_URL})`);
|
||||
return Promise.resolve().
|
||||
then(() => {
|
||||
if (logFile) {
|
||||
console.log(`Saving results in '${logFile}'...`);
|
||||
console.log(`(LightHouse viewer: ${VIEWER_URL})`);
|
||||
|
||||
// Remove the artifacts, which are not necessary for the report.
|
||||
// (Saves ~1,500,000 lines of formatted JSON output \o/)
|
||||
results.artifacts = undefined;
|
||||
|
||||
promise = printer.write(results, 'json', logFile);
|
||||
}
|
||||
|
||||
return promise.then(() => Math.round(results.score));
|
||||
return printer.write(report, printer.OutputMode.json, logFile);
|
||||
}
|
||||
}).
|
||||
then(() => Math.round(categories.pwa.score * 100));
|
||||
}
|
||||
|
||||
function skipHttpsAudits(config) {
|
||||
|
Reference in New Issue
Block a user