lighthouse 12.8.1-dev.20250826 → 12.8.1-dev.20250827

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,8 +10,6 @@
10
10
  * Supports skipping and modifiying expectations to match the environment.
11
11
  */
12
12
 
13
- import {cloneDeep} from 'lodash-es';
14
-
15
13
  import smokeTests from '../core-tests.js';
16
14
  import {runSmokehouse, getShardedDefinitions} from '../smokehouse.js';
17
15
 
@@ -21,7 +19,7 @@ import {runSmokehouse, getShardedDefinitions} from '../smokehouse.js';
21
19
  async function smokehouse(options) {
22
20
  const {urlFilterRegex, skip, modify, shardArg, ...smokehouseOptions} = options;
23
21
 
24
- const clonedTests = cloneDeep(smokeTests);
22
+ const clonedTests = structuredClone(smokeTests);
25
23
  const modifiedTests = [];
26
24
  for (const test of clonedTests) {
27
25
  if (urlFilterRegex && !test.expectations.lhr.requestedUrl.match(urlFilterRegex)) {
@@ -14,7 +14,6 @@ import path from 'path';
14
14
  import fs from 'fs';
15
15
  import url from 'url';
16
16
 
17
- import {cloneDeep} from 'lodash-es';
18
17
  import yargs from 'yargs';
19
18
  import * as yargsHelpers from 'yargs/helpers';
20
19
  import log from 'lighthouse-logger';
@@ -92,7 +91,7 @@ function getDefinitionsToRun(allTestDefns, requestedIds, excludedTests) {
92
91
  function pruneExpectedNetworkRequests(testDefns, takeNetworkRequestUrls) {
93
92
  const pruneNetworkRequests = !takeNetworkRequestUrls;
94
93
 
95
- const clonedDefns = cloneDeep(testDefns);
94
+ const clonedDefns = structuredClone(testDefns);
96
95
  for (const {id, expectations, runSerially} of clonedDefns) {
97
96
  if (!runSerially && expectations.networkRequests) {
98
97
  throw new Error(`'${id}' must be set to 'runSerially: true' to assert 'networkRequests'`);
@@ -9,7 +9,6 @@
9
9
  * against the results actually collected from Lighthouse.
10
10
  */
11
11
 
12
- import {cloneDeep} from 'lodash-es';
13
12
  import log from 'lighthouse-logger';
14
13
 
15
14
  import {LocalConsole} from './lib/local-console.js';
@@ -317,7 +316,7 @@ function pruneExpectations(localConsole, lhr, expected, reportOptions) {
317
316
  delete obj._excludeRunner;
318
317
  }
319
318
 
320
- const cloned = cloneDeep(expected);
319
+ const cloned = structuredClone(expected);
321
320
 
322
321
  pruneRecursively(cloned);
323
322
  return cloned;
@@ -46,11 +46,6 @@ class ImageDeliveryInsight extends Audit {
46
46
  */
47
47
  static async audit(artifacts, context) {
48
48
  return adaptInsightToAuditProduct(artifacts, context, 'ImageDelivery', (insight) => {
49
- if (!insight.optimizableImages.length) {
50
- // TODO: show UIStrings.noOptimizableImages?
51
- return;
52
- }
53
-
54
49
  /** @type {LH.Audit.Details.Table['headings']} */
55
50
  const headings = [
56
51
  /* eslint-disable max-len */
@@ -79,7 +79,7 @@ async function adaptInsightToAuditProduct(artifacts, context, insightName, creat
79
79
  details = cbResult;
80
80
  }
81
81
 
82
- if (!details || (details.type === 'table' && details.items.length === 0)) {
82
+ if (!details) {
83
83
  return {
84
84
  scoreDisplayMode: Audit.SCORING_MODES.NOT_APPLICABLE,
85
85
  score: null,
@@ -94,6 +94,17 @@ async function adaptInsightToAuditProduct(artifacts, context, insightName, creat
94
94
  details.debugData.wastedBytes = insight.wastedBytes;
95
95
  }
96
96
 
97
+ // TODO: FontDisplay insight (and maybe others) can return -Infinity savings when
98
+ // passing. That's weird. For now, just delete those.
99
+ if (insight.metricSavings) {
100
+ for (const [metric, value] of Object.entries(insight.metricSavings)) {
101
+ if (!Number.isFinite(value)) {
102
+ // @ts-expect-error
103
+ delete insight.metricSavings[metric];
104
+ }
105
+ }
106
+ }
107
+
97
108
  // This hack is to add metric adorners if an insight category links it to a metric,
98
109
  // but doesn't output a metric savings for that metric.
99
110
  let metricSavings = insight.metricSavings;