lighthouse 10.3.0 → 10.4.0-dev.20230711

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.
Files changed (126) hide show
  1. package/cli/test/smokehouse/frontends/smokehouse-bin.js +38 -22
  2. package/cli/test/smokehouse/lighthouse-runners/bundle.d.ts +1 -2
  3. package/cli/test/smokehouse/lighthouse-runners/bundle.js +11 -24
  4. package/cli/test/smokehouse/lighthouse-runners/cli.d.ts +1 -2
  5. package/cli/test/smokehouse/lighthouse-runners/cli.js +3 -7
  6. package/cli/test/smokehouse/lighthouse-runners/devtools.d.ts +1 -2
  7. package/cli/test/smokehouse/lighthouse-runners/devtools.js +1 -11
  8. package/cli/test/smokehouse/readme.md +0 -2
  9. package/cli/test/smokehouse/report-assert.d.ts +1 -2
  10. package/cli/test/smokehouse/report-assert.js +2 -19
  11. package/cli/test/smokehouse/smokehouse.js +3 -32
  12. package/core/audits/accessibility/aria-dialog-name.d.ts +10 -0
  13. package/core/audits/accessibility/aria-dialog-name.js +45 -0
  14. package/core/audits/accessibility/aria-text.d.ts +10 -0
  15. package/core/audits/accessibility/aria-text.js +44 -0
  16. package/core/audits/accessibility/empty-heading.d.ts +10 -0
  17. package/core/audits/accessibility/empty-heading.js +45 -0
  18. package/core/audits/accessibility/identical-links-same-purpose.d.ts +10 -0
  19. package/core/audits/accessibility/identical-links-same-purpose.js +45 -0
  20. package/core/audits/accessibility/landmark-one-main.d.ts +10 -0
  21. package/core/audits/accessibility/landmark-one-main.js +44 -0
  22. package/core/audits/accessibility/link-in-text-block.d.ts +10 -0
  23. package/core/audits/accessibility/link-in-text-block.js +44 -0
  24. package/core/audits/accessibility/select-name.d.ts +10 -0
  25. package/core/audits/accessibility/select-name.js +44 -0
  26. package/core/audits/accessibility/target-size.d.ts +10 -0
  27. package/core/audits/accessibility/target-size.js +45 -0
  28. package/core/audits/audit.d.ts +6 -0
  29. package/core/audits/audit.js +12 -0
  30. package/core/audits/byte-efficiency/byte-efficiency-audit.d.ts +22 -6
  31. package/core/audits/byte-efficiency/byte-efficiency-audit.js +97 -25
  32. package/core/audits/byte-efficiency/render-blocking-resources.js +1 -0
  33. package/core/audits/long-tasks.d.ts +48 -0
  34. package/core/audits/long-tasks.js +146 -19
  35. package/core/audits/non-composited-animations.js +7 -0
  36. package/core/audits/prioritize-lcp-image.js +2 -1
  37. package/core/audits/redirects.js +4 -0
  38. package/core/audits/seo/link-text.js +10 -0
  39. package/core/audits/unsized-images.js +3 -0
  40. package/core/audits/viewport.js +11 -0
  41. package/core/audits/work-during-interaction.js +13 -2
  42. package/core/computed/js-bundles.js +1 -1
  43. package/core/computed/metrics/tbt-utils.d.ts +26 -0
  44. package/core/computed/metrics/tbt-utils.js +48 -28
  45. package/core/computed/metrics/total-blocking-time.js +1 -1
  46. package/core/computed/tbt-impact-tasks.d.ts +54 -0
  47. package/core/computed/tbt-impact-tasks.js +221 -0
  48. package/core/config/default-config.js +17 -0
  49. package/core/config/filters.d.ts +9 -9
  50. package/core/config/filters.js +7 -7
  51. package/core/config/validation.js +12 -0
  52. package/core/gather/base-gatherer.d.ts +1 -3
  53. package/core/gather/base-gatherer.js +1 -3
  54. package/core/gather/gatherers/accessibility.js +8 -3
  55. package/core/gather/gatherers/seo/font-size.d.ts +0 -1
  56. package/core/gather/gatherers/seo/font-size.js +0 -1
  57. package/core/gather/gatherers/source-maps.js +3 -2
  58. package/core/lib/cdt/SDK.d.ts +1 -1
  59. package/core/lib/cdt/SDK.js +2 -2
  60. package/core/lib/dependency-graph/simulator/simulator.js +3 -1
  61. package/core/lib/lh-error.d.ts +14 -2
  62. package/core/lib/lh-error.js +7 -1
  63. package/core/lib/navigation-error.d.ts +2 -2
  64. package/core/lib/navigation-error.js +1 -1
  65. package/core/lib/network-recorder.js +1 -0
  66. package/core/lib/stack-packs.js +4 -0
  67. package/dist/report/bundle.esm.js +2 -1
  68. package/dist/report/flow.js +9 -9
  69. package/dist/report/standalone.js +2 -2
  70. package/package.json +5 -5
  71. package/report/assets/styles.css +5 -1
  72. package/report/renderer/category-renderer.js +1 -0
  73. package/report/renderer/components.js +1 -1
  74. package/shared/localization/locales/ar-XB.json +233 -2
  75. package/shared/localization/locales/ar.json +233 -2
  76. package/shared/localization/locales/bg.json +233 -2
  77. package/shared/localization/locales/ca.json +233 -2
  78. package/shared/localization/locales/cs.json +246 -15
  79. package/shared/localization/locales/da.json +239 -8
  80. package/shared/localization/locales/de.json +238 -7
  81. package/shared/localization/locales/el.json +234 -3
  82. package/shared/localization/locales/en-GB.json +233 -2
  83. package/shared/localization/locales/en-US.json +87 -0
  84. package/shared/localization/locales/en-XA.json +233 -2
  85. package/shared/localization/locales/en-XL.json +87 -0
  86. package/shared/localization/locales/es-419.json +233 -2
  87. package/shared/localization/locales/es.json +233 -2
  88. package/shared/localization/locales/fi.json +233 -2
  89. package/shared/localization/locales/fil.json +236 -5
  90. package/shared/localization/locales/fr.json +235 -4
  91. package/shared/localization/locales/he.json +233 -2
  92. package/shared/localization/locales/hi.json +236 -5
  93. package/shared/localization/locales/hr.json +234 -3
  94. package/shared/localization/locales/hu.json +233 -2
  95. package/shared/localization/locales/id.json +233 -2
  96. package/shared/localization/locales/it.json +234 -3
  97. package/shared/localization/locales/ja.json +233 -2
  98. package/shared/localization/locales/ko.json +233 -2
  99. package/shared/localization/locales/lt.json +233 -2
  100. package/shared/localization/locales/lv.json +250 -19
  101. package/shared/localization/locales/nl.json +233 -2
  102. package/shared/localization/locales/no.json +235 -4
  103. package/shared/localization/locales/pl.json +233 -2
  104. package/shared/localization/locales/pt-PT.json +233 -2
  105. package/shared/localization/locales/pt.json +234 -3
  106. package/shared/localization/locales/ro.json +233 -2
  107. package/shared/localization/locales/ru.json +233 -2
  108. package/shared/localization/locales/sk.json +233 -2
  109. package/shared/localization/locales/sl.json +233 -2
  110. package/shared/localization/locales/sr-Latn.json +233 -2
  111. package/shared/localization/locales/sr.json +233 -2
  112. package/shared/localization/locales/sv.json +233 -2
  113. package/shared/localization/locales/ta.json +233 -2
  114. package/shared/localization/locales/te.json +233 -2
  115. package/shared/localization/locales/th.json +233 -2
  116. package/shared/localization/locales/tr.json +233 -2
  117. package/shared/localization/locales/uk.json +233 -2
  118. package/shared/localization/locales/vi.json +233 -2
  119. package/shared/localization/locales/zh-HK.json +233 -2
  120. package/shared/localization/locales/zh-TW.json +235 -4
  121. package/shared/localization/locales/zh.json +239 -8
  122. package/tsconfig.json +1 -1
  123. package/types/artifacts.d.ts +9 -2
  124. package/types/internal/smokehouse.d.ts +1 -3
  125. package/core/audits/metrics/first-contentful-paint-3g.d.ts +0 -15
  126. package/core/audits/metrics/first-contentful-paint-3g.js +0 -69
@@ -25,6 +25,8 @@ import {runSmokehouse, getShardedDefinitions} from '../smokehouse.js';
25
25
  import {updateTestDefnFormat} from './back-compat-util.js';
26
26
  import {LH_ROOT} from '../../../../root.js';
27
27
  import exclusions from '../config/exclusions.js';
28
+ import {saveArtifacts} from '../../../../core/lib/asset-saver.js';
29
+ import {saveLhr} from '../../../../core/lib/asset-saver.js';
28
30
 
29
31
  const coreTestDefnsPath =
30
32
  path.join(LH_ROOT, 'cli/test/smokehouse/core-tests.js');
@@ -134,11 +136,6 @@ async function begin() {
134
136
  default: false,
135
137
  describe: 'Save test artifacts and output verbose logs',
136
138
  },
137
- 'legacy-navigation': {
138
- type: 'boolean',
139
- default: false,
140
- describe: 'Use the legacy navigation runner',
141
- },
142
139
  'jobs': {
143
140
  type: 'number',
144
141
  alias: 'j',
@@ -216,7 +213,6 @@ async function begin() {
216
213
  jobs,
217
214
  retries,
218
215
  isDebug: argv.debug,
219
- useLegacyNavigation: argv.legacyNavigation,
220
216
  lighthouseRunner: runLighthouse,
221
217
  takeNetworkRequestUrls,
222
218
  setup,
@@ -227,27 +223,47 @@ async function begin() {
227
223
  servers?.forEach(s => s.close());
228
224
  }
229
225
 
226
+ let smokehouseOutputDir;
227
+ let testResultsToOutput;
230
228
  if (!smokehouseResult.success) {
231
- const failedTestResults = smokehouseResult.testResults.filter(r => r.failed);
232
-
233
- // For CI, save failed runs to directory to be uploaded.
234
- if (process.env.CI) {
235
- const failuresDir = `${LH_ROOT}/.tmp/smokehouse-ci-failures`;
236
- fs.mkdirSync(failuresDir, {recursive: true});
237
-
238
- for (const testResult of failedTestResults) {
239
- for (let i = 0; i < testResult.runs.length; i++) {
240
- const run = testResult.runs[i];
241
- fs.writeFileSync(`${failuresDir}/${testResult.id}-${i}.json`, JSON.stringify({
242
- ...run,
243
- lighthouseLog: run.lighthouseLog.split('\n'),
244
- assertionLog: run.assertionLog.split('\n'),
245
- }, null, 2));
229
+ // Save failed runs to directory. In CI, this is uploaded as an artifact.
230
+ smokehouseOutputDir = `${LH_ROOT}/.tmp/smokehouse-failures`;
231
+ testResultsToOutput = smokehouseResult.testResults.filter(r => r.failed);
232
+ } else if (!process.env.CI) {
233
+ // Otherwise, only write to disk in debug mode.
234
+ smokehouseOutputDir = `${LH_ROOT}/.tmp/smokehouse-output`;
235
+ testResultsToOutput = smokehouseResult.testResults;
236
+ }
237
+
238
+ if (smokehouseOutputDir && testResultsToOutput) {
239
+ fs.rmSync(smokehouseOutputDir, {recursive: true, force: true});
240
+ fs.mkdirSync(smokehouseOutputDir);
241
+
242
+ for (const testResult of testResultsToOutput) {
243
+ for (let i = 0; i < testResult.runs.length; i++) {
244
+ const runDir = `${smokehouseOutputDir}/${i}/${testResult.id}`;
245
+ fs.mkdirSync(runDir, {recursive: true});
246
+
247
+ const run = testResult.runs[i];
248
+ await saveArtifacts(run.artifacts, runDir);
249
+ await saveLhr(run.lhr, runDir);
250
+ fs.writeFileSync(`${runDir}/assertionLog.txt`, run.assertionLog);
251
+ fs.writeFileSync(`${runDir}/lighthouseLog.txt`, run.lighthouseLog);
252
+ if (run.networkRequests) {
253
+ fs.writeFileSync(`${runDir}/networkRequests.txt`, run.networkRequests.join('\n'));
254
+ }
255
+ const config = testDefns.find(test => test.id === testResult.id)?.config;
256
+ if (config) {
257
+ fs.writeFileSync(`${runDir}/config.json`, JSON.stringify(config, null, 2));
246
258
  }
247
259
  }
248
260
  }
249
261
 
250
- const cmd = `yarn smoke ${failedTestResults.map(r => r.id).join(' ')}`;
262
+ console.log(`smokehouse artifacts written to ${smokehouseOutputDir}`);
263
+ }
264
+
265
+ if (!smokehouseResult.success && testResultsToOutput) {
266
+ const cmd = `yarn smoke ${testResultsToOutput.map(r => r.id).join(' ')}`;
251
267
  console.log(`rerun failures: ${cmd}`);
252
268
  }
253
269
 
@@ -2,12 +2,11 @@
2
2
  * Launch Chrome and do a full Lighthouse run via the Lighthouse DevTools bundle.
3
3
  * @param {string} url
4
4
  * @param {LH.Config=} config
5
- * @param {{isDebug?: boolean, useLegacyNavigation?: boolean}=} testRunnerOptions
5
+ * @param {{isDebug?: boolean}=} testRunnerOptions
6
6
  * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
7
7
  */
8
8
  export function runLighthouse(url: string, config?: LH.Config | undefined, testRunnerOptions?: {
9
9
  isDebug?: boolean;
10
- useLegacyNavigation?: boolean;
11
10
  } | undefined): Promise<{
12
11
  lhr: LH.Result;
13
12
  artifacts: LH.Artifacts;
@@ -19,7 +19,6 @@ import {once} from 'events';
19
19
  import puppeteer from 'puppeteer-core';
20
20
  import ChromeLauncher from 'chrome-launcher';
21
21
 
22
- import {CriConnection} from '../../../../core/legacy/gather/connections/cri.js';
23
22
  import {LH_ROOT} from '../../../../root.js';
24
23
  import {loadArtifacts, saveArtifacts} from '../../../../core/lib/asset-saver.js';
25
24
 
@@ -39,7 +38,7 @@ if (!isMainThread && parentPort) {
39
38
  parentPort?.postMessage({type: 'result', value});
40
39
  } catch (err) {
41
40
  console.error(err);
42
- parentPort?.postMessage({type: 'error', value: err});
41
+ parentPort?.postMessage({type: 'error', value: err.toString()});
43
42
  }
44
43
  })();
45
44
  }
@@ -47,7 +46,7 @@ if (!isMainThread && parentPort) {
47
46
  /**
48
47
  * @param {string} url
49
48
  * @param {LH.Config|undefined} config
50
- * @param {{isDebug?: boolean, useLegacyNavigation?: boolean}} testRunnerOptions
49
+ * @param {{isDebug?: boolean}} testRunnerOptions
51
50
  * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts}>}
52
51
  */
53
52
  async function runBundledLighthouse(url, config, testRunnerOptions) {
@@ -72,28 +71,18 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
72
71
  // @ts-expect-error - not worth giving test global an actual type.
73
72
  const lighthouse = global.runBundledLighthouse;
74
73
 
75
- /** @type {import('../../../../core/index.js')['legacyNavigation']} */
76
- // @ts-expect-error - not worth giving test global an actual type.
77
- const legacyNavigation = global.runBundledLighthouseLegacyNavigation;
78
-
79
74
  // Launch and connect to Chrome.
80
75
  const launchedChrome = await ChromeLauncher.launch();
81
76
  const port = launchedChrome.port;
82
77
 
83
78
  // Run Lighthouse.
84
79
  try {
85
- const logLevel = testRunnerOptions.isDebug ? 'info' : undefined;
86
- let runnerResult;
87
- if (testRunnerOptions.useLegacyNavigation) {
88
- const connection = new CriConnection(port);
89
- runnerResult =
90
- await legacyNavigation(url, {port, logLevel}, config, connection);
91
- } else {
92
- // Puppeteer is not included in the bundle, we must create the page here.
93
- const browser = await puppeteer.connect({browserURL: `http://localhost:${port}`});
94
- const page = await browser.newPage();
95
- runnerResult = await lighthouse(url, {port, logLevel}, config, page);
96
- }
80
+ const logLevel = testRunnerOptions.isDebug ? 'verbose' : 'info';
81
+
82
+ // Puppeteer is not included in the bundle, we must create the page here.
83
+ const browser = await puppeteer.connect({browserURL: `http://localhost:${port}`});
84
+ const page = await browser.newPage();
85
+ const runnerResult = await lighthouse(url, {port, logLevel}, config, page);
97
86
  if (!runnerResult) throw new Error('No runnerResult');
98
87
 
99
88
  return {
@@ -110,7 +99,7 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
110
99
  * Launch Chrome and do a full Lighthouse run via the Lighthouse DevTools bundle.
111
100
  * @param {string} url
112
101
  * @param {LH.Config=} config
113
- * @param {{isDebug?: boolean, useLegacyNavigation?: boolean}=} testRunnerOptions
102
+ * @param {{isDebug?: boolean}=} testRunnerOptions
114
103
  * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
115
104
  */
116
105
  async function runLighthouse(url, config, testRunnerOptions = {}) {
@@ -124,12 +113,10 @@ async function runLighthouse(url, config, testRunnerOptions = {}) {
124
113
  worker.stdout.setEncoding('utf8');
125
114
  worker.stderr.setEncoding('utf8');
126
115
  worker.stdout.addListener('data', (data) => {
127
- process.stdout.write(data);
128
- logs.push(`STDOUT: ${data}`);
116
+ logs.push(`[STDOUT] ${data}`);
129
117
  });
130
118
  worker.stderr.addListener('data', (data) => {
131
- process.stderr.write(data);
132
- logs.push(`STDERR: ${data}`);
119
+ logs.push(`[STDERR] ${data}`);
133
120
  });
134
121
  const [workerResponse] = await once(worker, 'message');
135
122
  const log = logs.join('') + '\n';
@@ -3,12 +3,11 @@
3
3
  * Launch Chrome and do a full Lighthouse run via the Lighthouse CLI.
4
4
  * @param {string} url
5
5
  * @param {LH.Config=} config
6
- * @param {{isDebug?: boolean, useFraggleRock?: boolean}=} testRunnerOptions
6
+ * @param {{isDebug?: boolean}=} testRunnerOptions
7
7
  * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
8
8
  */
9
9
  export function runLighthouse(url: string, config?: LH.Config | undefined, testRunnerOptions?: {
10
10
  isDebug?: boolean | undefined;
11
- useFraggleRock?: boolean | undefined;
12
11
  } | undefined): Promise<{
13
12
  lhr: LH.Result;
14
13
  artifacts: LH.Artifacts;
@@ -28,7 +28,7 @@ const execFileAsync = promisify(execFile);
28
28
  * Launch Chrome and do a full Lighthouse run via the Lighthouse CLI.
29
29
  * @param {string} url
30
30
  * @param {LH.Config=} config
31
- * @param {{isDebug?: boolean, useFraggleRock?: boolean}=} testRunnerOptions
31
+ * @param {{isDebug?: boolean}=} testRunnerOptions
32
32
  * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
33
33
  */
34
34
  async function runLighthouse(url, config, testRunnerOptions = {}) {
@@ -46,11 +46,11 @@ async function runLighthouse(url, config, testRunnerOptions = {}) {
46
46
  * @param {string} url
47
47
  * @param {string} tmpPath
48
48
  * @param {LH.Config=} config
49
- * @param {{isDebug?: boolean, useLegacyNavigation?: boolean}=} options
49
+ * @param {{isDebug?: boolean}=} options
50
50
  * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
51
51
  */
52
52
  async function internalRun(url, tmpPath, config, options) {
53
- const {isDebug = false, useLegacyNavigation = false} = options || {};
53
+ const {isDebug = false} = options || {};
54
54
  const localConsole = new LocalConsole();
55
55
 
56
56
  const outputPath = `${tmpPath}/smokehouse.report.json`;
@@ -67,10 +67,6 @@ async function internalRun(url, tmpPath, config, options) {
67
67
  '--quiet',
68
68
  ];
69
69
 
70
- if (useLegacyNavigation) {
71
- args.push('--legacy-navigation');
72
- }
73
-
74
70
  // Config can be optionally provided.
75
71
  if (config) {
76
72
  const configPath = `${tmpPath}/config.json`;
@@ -5,12 +5,11 @@
5
5
  * CHROME_PATH determines which Chrome is used–otherwise the default is puppeteer's chrome binary.
6
6
  * @param {string} url
7
7
  * @param {LH.Config=} config
8
- * @param {{isDebug?: boolean, useLegacyNavigation?: boolean}=} testRunnerOptions
8
+ * @param {{isDebug?: boolean}=} testRunnerOptions
9
9
  * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
10
10
  */
11
11
  export function runLighthouse(url: string, config?: LH.Config | undefined, testRunnerOptions?: {
12
12
  isDebug?: boolean;
13
- useLegacyNavigation?: boolean;
14
13
  } | undefined): Promise<{
15
14
  lhr: LH.Result;
16
15
  artifacts: LH.Artifacts;
@@ -8,8 +8,6 @@
8
8
  * @fileoverview A runner that launches Chrome and executes Lighthouse via DevTools.
9
9
  */
10
10
 
11
- import fs from 'fs';
12
- import os from 'os';
13
11
  import {execFileSync} from 'child_process';
14
12
 
15
13
  import {LH_ROOT} from '../../../../root.js';
@@ -42,7 +40,7 @@ async function setup() {
42
40
  * CHROME_PATH determines which Chrome is used–otherwise the default is puppeteer's chrome binary.
43
41
  * @param {string} url
44
42
  * @param {LH.Config=} config
45
- * @param {{isDebug?: boolean, useLegacyNavigation?: boolean}=} testRunnerOptions
43
+ * @param {{isDebug?: boolean}=} testRunnerOptions
46
44
  * @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
47
45
  */
48
46
  async function runLighthouse(url, config, testRunnerOptions = {}) {
@@ -52,16 +50,8 @@ async function runLighthouse(url, config, testRunnerOptions = {}) {
52
50
  const {lhr, artifacts, logs} = await testUrlFromDevtools(url, {
53
51
  config,
54
52
  chromeFlags,
55
- useLegacyNavigation: testRunnerOptions.useLegacyNavigation,
56
53
  });
57
54
 
58
- if (testRunnerOptions.isDebug) {
59
- const outputDir = fs.mkdtempSync(os.tmpdir() + '/lh-smoke-cdt-runner-');
60
- fs.writeFileSync(`${outputDir}/lhr.json`, JSON.stringify(lhr));
61
- fs.writeFileSync(`${outputDir}/artifacts.json`, JSON.stringify(artifacts));
62
- console.log(`${url} results saved at ${outputDir}`);
63
- }
64
-
65
55
  const log = logs.join('') + '\n';
66
56
  return {lhr, artifacts, log};
67
57
  }
@@ -118,8 +118,6 @@ All pruning checks:
118
118
 
119
119
  - `_minChromiumVersion`
120
120
  - `_maxChromiumVersion`
121
- - `_legacyOnly`
122
- - `_fraggleRockOnly`
123
121
  - `_runner` (set to same value provided to CLI --runner flag, ex: `'devtools'`)
124
122
  - `_excludeRunner` (set to same value provided to CLI --runner flag, ex: `'devtools'`)
125
123
 
@@ -16,7 +16,7 @@ export type Comparison = {
16
16
  * summary. Returns count of passed and failed tests.
17
17
  * @param {{lhr: LH.Result, artifacts: LH.Artifacts, networkRequests?: string[]}} actual
18
18
  * @param {Smokehouse.ExpectedRunnerResult} expected
19
- * @param {{runner?: string, isDebug?: boolean, useLegacyNavigation?: boolean}=} reportOptions
19
+ * @param {{runner?: string, isDebug?: boolean}=} reportOptions
20
20
  * @return {{passed: number, failed: number, log: string}}
21
21
  */
22
22
  export function getAssertionReport(actual: {
@@ -26,7 +26,6 @@ export function getAssertionReport(actual: {
26
26
  }, expected: Smokehouse.ExpectedRunnerResult, reportOptions?: {
27
27
  runner?: string;
28
28
  isDebug?: boolean;
29
- useLegacyNavigation?: boolean;
30
29
  } | undefined): {
31
30
  passed: number;
32
31
  failed: number;
@@ -237,11 +237,9 @@ function makeComparison(name, actualResult, expectedResult) {
237
237
  * @param {LocalConsole} localConsole
238
238
  * @param {LH.Result} lhr
239
239
  * @param {Smokehouse.ExpectedRunnerResult} expected
240
- * @param {{runner?: string, useLegacyNavigation?: boolean}=} reportOptions
240
+ * @param {{runner?: string}=} reportOptions
241
241
  */
242
242
  function pruneExpectations(localConsole, lhr, expected, reportOptions) {
243
- const isLegacyNavigation = reportOptions?.useLegacyNavigation;
244
-
245
243
  /**
246
244
  * Lazily compute the Chrome version because some reports are explicitly asserting error conditions.
247
245
  * @returns {string}
@@ -295,19 +293,6 @@ function pruneExpectations(localConsole, lhr, expected, reportOptions) {
295
293
  `Actual Chromium version: ${getChromeVersionString()}`,
296
294
  ].join(' '));
297
295
  remove(key);
298
- } else if (value._legacyOnly && !isLegacyNavigation) {
299
- localConsole.log([
300
- `[${key}] marked legacy only but run is Fraggle Rock, pruning expectation:`,
301
- JSON.stringify(value, null, 2),
302
- ].join(' '));
303
- remove(key);
304
- } else if (value._fraggleRockOnly && isLegacyNavigation) {
305
- localConsole.log([
306
- `[${key}] marked Fraggle Rock only but run is legacy, pruning expectation:`,
307
- JSON.stringify(value, null, 2),
308
- `Actual channel: ${lhr.configSettings.channel}`,
309
- ].join(' '));
310
- remove(key);
311
296
  } else if (value._runner && reportOptions?.runner !== value._runner) {
312
297
  localConsole.log([
313
298
  `[${key}] is only for runner ${value._runner}, pruning expectation:`,
@@ -325,8 +310,6 @@ function pruneExpectations(localConsole, lhr, expected, reportOptions) {
325
310
  }
326
311
  }
327
312
 
328
- delete obj._legacyOnly;
329
- delete obj._fraggleRockOnly;
330
313
  delete obj._skipInBundled;
331
314
  delete obj._minChromiumVersion;
332
315
  delete obj._maxChromiumVersion;
@@ -483,7 +466,7 @@ function reportAssertion(localConsole, assertion) {
483
466
  * summary. Returns count of passed and failed tests.
484
467
  * @param {{lhr: LH.Result, artifacts: LH.Artifacts, networkRequests?: string[]}} actual
485
468
  * @param {Smokehouse.ExpectedRunnerResult} expected
486
- * @param {{runner?: string, isDebug?: boolean, useLegacyNavigation?: boolean}=} reportOptions
469
+ * @param {{runner?: string, isDebug?: boolean}=} reportOptions
487
470
  * @return {{passed: number, failed: number, log: string}}
488
471
  */
489
472
  function getAssertionReport(actual, expected, reportOptions = {}) {
@@ -53,7 +53,6 @@ const DEFAULT_RETRIES = 0;
53
53
  async function runSmokehouse(smokeTestDefns, smokehouseOptions) {
54
54
  const {
55
55
  isDebug,
56
- useLegacyNavigation,
57
56
  jobs = DEFAULT_CONCURRENT_RUNS,
58
57
  retries = DEFAULT_RETRIES,
59
58
  lighthouseRunner = Object.assign(cliLighthouseRunner, {runnerName: 'cli'}),
@@ -76,7 +75,6 @@ async function runSmokehouse(smokeTestDefns, smokehouseOptions) {
76
75
 
77
76
  const testOptions = {
78
77
  isDebug,
79
- useLegacyNavigation,
80
78
  retries,
81
79
  lighthouseRunner,
82
80
  takeNetworkRequestUrls,
@@ -133,39 +131,18 @@ function purpleify(str) {
133
131
  return `${log.purple}${str}${log.reset}`;
134
132
  }
135
133
 
136
- /**
137
- * @param {LH.Config=} config
138
- * @return {LH.Config|undefined}
139
- */
140
- function convertToLegacyConfig(config) {
141
- if (!config) return config;
142
-
143
- return {
144
- ...config,
145
- passes: [{
146
- passName: 'defaultPass',
147
- pauseAfterFcpMs: config.settings?.pauseAfterFcpMs,
148
- pauseAfterLoadMs: config.settings?.pauseAfterLoadMs,
149
- networkQuietThresholdMs: config.settings?.networkQuietThresholdMs,
150
- cpuQuietThresholdMs: config.settings?.cpuQuietThresholdMs,
151
- blankPage: config.settings?.blankPage,
152
- }],
153
- };
154
- }
155
-
156
134
  /**
157
135
  * Run Lighthouse in the selected runner.
158
136
  * @param {Smokehouse.TestDfn} smokeTestDefn
159
- * @param {{isDebug?: boolean, useLegacyNavigation?: boolean, retries: number, lighthouseRunner: Smokehouse.LighthouseRunner, takeNetworkRequestUrls?: () => string[]}} testOptions
137
+ * @param {{isDebug?: boolean, retries: number, lighthouseRunner: Smokehouse.LighthouseRunner, takeNetworkRequestUrls?: () => string[]}} testOptions
160
138
  * @return {Promise<SmokehouseResult>}
161
139
  */
162
140
  async function runSmokeTest(smokeTestDefn, testOptions) {
163
- const {id, expectations} = smokeTestDefn;
141
+ const {id, expectations, config} = smokeTestDefn;
164
142
  const {
165
143
  lighthouseRunner,
166
144
  retries,
167
145
  isDebug,
168
- useLegacyNavigation,
169
146
  takeNetworkRequestUrls,
170
147
  } = testOptions;
171
148
  const requestedUrl = expectations.lhr.requestedUrl;
@@ -184,15 +161,10 @@ async function runSmokeTest(smokeTestDefn, testOptions) {
184
161
  bufferedConsole.log(` Retrying run (${i} out of ${retries} retries)…`);
185
162
  }
186
163
 
187
- let config = smokeTestDefn.config;
188
- if (useLegacyNavigation) {
189
- config = convertToLegacyConfig(config);
190
- }
191
-
192
164
  // Run Lighthouse.
193
165
  try {
194
166
  result = {
195
- ...await lighthouseRunner(requestedUrl, config, {isDebug, useLegacyNavigation}),
167
+ ...await lighthouseRunner(requestedUrl, config, {isDebug}),
196
168
  networkRequests: takeNetworkRequestUrls ? takeNetworkRequestUrls() : undefined,
197
169
  };
198
170
 
@@ -213,7 +185,6 @@ async function runSmokeTest(smokeTestDefn, testOptions) {
213
185
  report = getAssertionReport(result, expectations, {
214
186
  runner: lighthouseRunner.runnerName,
215
187
  isDebug,
216
- useLegacyNavigation,
217
188
  });
218
189
 
219
190
  runs.push({
@@ -0,0 +1,10 @@
1
+ export default AriaDialogName;
2
+ declare class AriaDialogName extends AxeAudit {
3
+ }
4
+ export namespace UIStrings {
5
+ const title: string;
6
+ const failureTitle: string;
7
+ const description: string;
8
+ }
9
+ import AxeAudit from './axe-audit.js';
10
+ //# sourceMappingURL=aria-dialog-name.d.ts.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license Copyright 2023 The Lighthouse Authors. All Rights Reserved.
3
+ * 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
4
+ * 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.
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Ensures every ARIA dialog element has a discernable, accessible name.
9
+ * See base class in axe-audit.js for audit() implementation.
10
+ */
11
+
12
+ import AxeAudit from './axe-audit.js';
13
+ import * as i18n from '../../lib/i18n/i18n.js';
14
+
15
+ const UIStrings = {
16
+ /** Title of an accessibility audit that evaluates if ARIA dialog elements have an accessible name. This title is descriptive of the successful state and is shown to users when no user action is required. */
17
+ title: 'Elements with `role="dialog"` or `role="alertdialog"` have accessible names.',
18
+ /** Title of an accessibility audit that evaluates if ARIA dialog elements do not have accessible names. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
19
+ failureTitle: 'Elements with `role="dialog"` or `role="alertdialog"` do not have accessible ' +
20
+ 'names.',
21
+ /** Description of a Lighthouse audit that tells the user *why* they should have accessible names for ARIA dialog elements. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
22
+ description: 'ARIA dialog elements without accessible names may prevent screen readers users ' +
23
+ 'from discerning the purpose of these elements. ' +
24
+ '[Learn how to make ARIA dialog elements more accessible](https://dequeuniversity.com/rules/axe/4.7/aria-dialog-name).',
25
+ };
26
+
27
+ const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
28
+
29
+ class AriaDialogName extends AxeAudit {
30
+ /**
31
+ * @return {LH.Audit.Meta}
32
+ */
33
+ static get meta() {
34
+ return {
35
+ id: 'aria-dialog-name',
36
+ title: str_(UIStrings.title),
37
+ failureTitle: str_(UIStrings.failureTitle),
38
+ description: str_(UIStrings.description),
39
+ requiredArtifacts: ['Accessibility'],
40
+ };
41
+ }
42
+ }
43
+
44
+ export default AriaDialogName;
45
+ export {UIStrings};
@@ -0,0 +1,10 @@
1
+ export default AriaText;
2
+ declare class AriaText extends AxeAudit {
3
+ }
4
+ export namespace UIStrings {
5
+ const title: string;
6
+ const failureTitle: string;
7
+ const description: string;
8
+ }
9
+ import AxeAudit from './axe-audit.js';
10
+ //# sourceMappingURL=aria-text.d.ts.map
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license Copyright 2023 The Lighthouse Authors. All Rights Reserved.
3
+ * 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
4
+ * 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.
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Ensures all elements with `role=text` have no focusable descendents.
9
+ * See base class in axe-audit.js for audit() implementation.
10
+ */
11
+
12
+ import AxeAudit from './axe-audit.js';
13
+ import * as i18n from '../../lib/i18n/i18n.js';
14
+
15
+ const UIStrings = {
16
+ /** Title of an accesibility audit that evaluates if elements with `role=text` have no focusable descendents. This title is descriptive of the successful state and is shown to users when no user action is required. */
17
+ title: 'Elements with the `role=text` attribute do not have focusable descendents.',
18
+ /** Title of an accesibility audit that evaluates if elements with `role=text` have focusable descendents. This title is descriptive of the successful state and is shown to users when no user action is required. */
19
+ failureTitle: 'Elements with the `role=text` attribute do have focusable descendents.',
20
+ /** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
21
+ description: 'Adding `role=text` around a text node split by markup enables VoiceOver to treat ' +
22
+ 'it as one phrase, but the element\'s focusable descendents will not be announced. ' +
23
+ '[Learn more about the `role=text` attribute](https://dequeuniversity.com/rules/axe/4.7/aria-text).',
24
+ };
25
+
26
+ const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
27
+
28
+ class AriaText extends AxeAudit {
29
+ /**
30
+ * @return {LH.Audit.Meta}
31
+ */
32
+ static get meta() {
33
+ return {
34
+ id: 'aria-text',
35
+ title: str_(UIStrings.title),
36
+ failureTitle: str_(UIStrings.failureTitle),
37
+ description: str_(UIStrings.description),
38
+ requiredArtifacts: ['Accessibility'],
39
+ };
40
+ }
41
+ }
42
+
43
+ export default AriaText;
44
+ export {UIStrings};
@@ -0,0 +1,10 @@
1
+ export default EmptyHeading;
2
+ declare class EmptyHeading extends AxeAudit {
3
+ }
4
+ export namespace UIStrings {
5
+ const title: string;
6
+ const failureTitle: string;
7
+ const description: string;
8
+ }
9
+ import AxeAudit from './axe-audit.js';
10
+ //# sourceMappingURL=empty-heading.d.ts.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license Copyright 2023 The Lighthouse Authors. All Rights Reserved.
3
+ * 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
4
+ * 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.
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Ensures that headings are not empty.
9
+ * See base class in axe-audit.js for audit() implementation.
10
+ */
11
+
12
+ import AxeAudit from './axe-audit.js';
13
+ import * as i18n from '../../lib/i18n/i18n.js';
14
+
15
+ const UIStrings = {
16
+ /** Title of an accesibility audit that checks if all heading elements have content. This title is descriptive of the successful state and is shown to users when no user action is required. */
17
+ title: 'All heading elements contain content.',
18
+ /** Title of an accesibility audit that checks if all heading elements have content. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
19
+ failureTitle: 'Heading elements do not contain content.',
20
+ /** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
21
+ description: 'A heading with no content or inaccessible text prevent screen reader users from ' +
22
+ 'accessing information on the page\'s structure. ' +
23
+ '[Learn more about headings](https://dequeuniversity.com/rules/axe/4.7/empty-heading).',
24
+ };
25
+
26
+ const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
27
+
28
+ class EmptyHeading extends AxeAudit {
29
+ /**
30
+ * @return {LH.Audit.Meta}
31
+ */
32
+ static get meta() {
33
+ return {
34
+ id: 'empty-heading',
35
+ title: str_(UIStrings.title),
36
+ failureTitle: str_(UIStrings.failureTitle),
37
+ description: str_(UIStrings.description),
38
+ scoreDisplayMode: AxeAudit.SCORING_MODES.INFORMATIVE,
39
+ requiredArtifacts: ['Accessibility'],
40
+ };
41
+ }
42
+ }
43
+
44
+ export default EmptyHeading;
45
+ export {UIStrings};
@@ -0,0 +1,10 @@
1
+ export default IdenticalLinksSamePurpose;
2
+ declare class IdenticalLinksSamePurpose extends AxeAudit {
3
+ }
4
+ export namespace UIStrings {
5
+ const title: string;
6
+ const failureTitle: string;
7
+ const description: string;
8
+ }
9
+ import AxeAudit from './axe-audit.js';
10
+ //# sourceMappingURL=identical-links-same-purpose.d.ts.map