From d8882a76d39af2117cf9ac8a4b0c7dfe3b9e155d Mon Sep 17 00:00:00 2001 From: bc-vlad-dlogush <83779098+bc-vlad-dlogush@users.noreply.github.com> Date: Wed, 12 Apr 2023 16:51:25 +0300 Subject: [PATCH] fix(storefront): BCTHEME-1326 Running Lighthouse npm script fails in terminal (#2345) --- CHANGELOG.md | 1 + lighthouse-config.js | 51 +++++++------------------------------------- package.json | 2 +- 3 files changed, 10 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16c44becd8..8834fd9cf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Draft +- Running Lighthouse npm script fails in terminal [#2345](https://github.com/bigcommerce/cornerstone/pull/2345) - Removed accelerated checkout integration [#2341](https://github.com/bigcommerce/cornerstone/pull/2341) ## 6.10.0 (03-23-2023) diff --git a/lighthouse-config.js b/lighthouse-config.js index acb2a0a4bd..5c58648713 100644 --- a/lighthouse-config.js +++ b/lighthouse-config.js @@ -1,46 +1,11 @@ -const throttling = { - disabled: { - rttMs: 0, - throughputKbps: 0, - requestLatencyMs: 0, - downloadThroughputKbps: 0, - uploadThroughputKbps: 0, - cpuSlowdownMultiplier: 0, - } -}; +/** + * @license Copyright 2018 The Lighthouse Authors. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + */ +/** @type {LH.Config} */ module.exports = { - settings: { - output: 'json', - maxWaitForLoad: 45 * 1000, - throttlingMethod: 'provided', - throttling: throttling.disabled, - auditMode: false, - gatherMode: false, - disableStorageReset: false, - disableDeviceEmulation: true, - emulatedFormFactor: 'none', - blockedUrlPatterns: null, - additionalTraceCategories: null, - extraHeaders: null, - onlyAudits: null, - onlyCategories: null, - skipAudits: null, - }, - passes: [ - { - passName: 'defaultPass', - recordTrace: true, - useThrottling: false, - pauseAfterLoadMs: 1000, - networkQuietThresholdMs: 1000, - cpuQuietThresholdMs: 1000, - gatherers: [], - }, - ], - audits: [ - 'time-to-first-byte', - 'metrics/first-meaningful-paint', - 'metrics/interactive', - ], + extends: 'lighthouse:default', + settings: {}, }; diff --git a/package.json b/package.json index 6d1983a2ac..62f1c4c717 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "scripts": { "build": "npx webpack --config webpack.prod.js", "buildDev": "npx webpack --config webpack.dev.js", - "lighthouse": "npx lighthouse --config-path=lighthouse-config.js --quiet --output json --chrome-flags=\"--headless\" $URL | jq '.audits | map_values(.rawValue)'", + "lighthouse": "npx lighthouse --config-path=lighthouse-config.js --quiet --output html --chrome-flags=\"--headless\" $URL", "test": "npx jest", "stylelint": "npx stylelint **/*.scss", "stylelint:fix": "npx stylelint --fix **/*.scss"