lighthouse 10.4.0 → 11.0.0
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.
- package/CONTRIBUTING.md +1 -1
- package/cli/cli-flags.d.ts +1 -6
- package/cli/cli-flags.js +0 -5
- package/cli/run.js +3 -10
- package/cli/sentry-prompt.js +4 -2
- package/cli/test/smokehouse/core-tests.js +0 -2
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +24 -14
- package/cli/test/smokehouse/lighthouse-runners/bundle.d.ts +1 -2
- package/cli/test/smokehouse/lighthouse-runners/bundle.js +12 -21
- package/cli/test/smokehouse/lighthouse-runners/cli.d.ts +1 -3
- package/cli/test/smokehouse/lighthouse-runners/cli.js +3 -7
- package/cli/test/smokehouse/lighthouse-runners/devtools.d.ts +1 -5
- package/cli/test/smokehouse/lighthouse-runners/devtools.js +1 -12
- package/cli/test/smokehouse/readme.md +0 -2
- package/cli/test/smokehouse/report-assert.d.ts +1 -3
- package/cli/test/smokehouse/report-assert.js +2 -19
- package/cli/test/smokehouse/smokehouse.js +3 -32
- package/core/audits/accessibility/aria-allowed-role.d.ts +10 -0
- package/core/audits/accessibility/aria-allowed-role.js +46 -0
- package/core/audits/accessibility/image-redundant-alt.d.ts +10 -0
- package/core/audits/accessibility/image-redundant-alt.js +45 -0
- package/core/audits/accessibility/label-content-name-mismatch.d.ts +10 -0
- package/core/audits/accessibility/label-content-name-mismatch.js +44 -0
- package/core/audits/accessibility/skip-link.d.ts +10 -0
- package/core/audits/accessibility/skip-link.js +43 -0
- package/core/audits/accessibility/table-duplicate-name.d.ts +10 -0
- package/core/audits/accessibility/table-duplicate-name.js +44 -0
- package/core/audits/accessibility/target-size.js +1 -1
- package/core/audits/byte-efficiency/duplicated-javascript.js +2 -2
- package/core/audits/byte-efficiency/render-blocking-resources.js +1 -0
- package/core/audits/dobetterweb/uses-http2.d.ts +18 -1
- package/core/audits/dobetterweb/uses-http2.js +62 -16
- package/core/audits/installable-manifest.d.ts +1 -5
- package/core/audits/installable-manifest.js +2 -7
- package/core/audits/largest-contentful-paint-element.d.ts +0 -6
- package/core/audits/largest-contentful-paint-element.js +13 -15
- package/core/audits/metrics/{experimental-interaction-to-next-paint.d.ts → interaction-to-next-paint.d.ts} +3 -3
- package/core/audits/metrics/{experimental-interaction-to-next-paint.js → interaction-to-next-paint.js} +3 -3
- package/core/audits/uses-rel-preconnect.js +23 -8
- package/core/audits/work-during-interaction.js +2 -2
- package/core/computed/processed-navigation.d.ts +1 -1
- package/core/config/config-helpers.d.ts +3 -3
- package/core/config/config-helpers.js +5 -12
- package/core/config/config.js +1 -7
- package/core/config/constants.d.ts +0 -2
- package/core/config/constants.js +2 -18
- package/core/config/default-config.js +59 -53
- package/core/config/filters.js +1 -1
- package/core/config/validation.d.ts +7 -12
- package/core/config/validation.js +16 -26
- package/core/gather/base-artifacts.d.ts +4 -4
- package/core/gather/base-artifacts.js +2 -6
- package/core/gather/base-gatherer.d.ts +12 -37
- package/core/gather/base-gatherer.js +7 -54
- package/core/gather/driver/dom.d.ts +4 -4
- package/core/gather/driver/dom.js +2 -2
- package/core/gather/driver/environment.d.ts +4 -4
- package/core/gather/driver/environment.js +2 -2
- package/core/gather/driver/execution-context.d.ts +12 -3
- package/core/gather/driver/execution-context.js +34 -3
- package/core/gather/driver/navigation.d.ts +2 -2
- package/core/gather/driver/navigation.js +2 -5
- package/core/gather/driver/network-monitor.d.ts +7 -6
- package/core/gather/driver/network-monitor.js +4 -4
- package/core/gather/driver/network.d.ts +2 -2
- package/core/gather/driver/network.js +1 -1
- package/core/gather/driver/prepare.d.ts +10 -10
- package/core/gather/driver/prepare.js +10 -10
- package/core/gather/driver/service-workers.d.ts +4 -4
- package/core/gather/driver/service-workers.js +2 -2
- package/core/gather/driver/storage.d.ts +6 -6
- package/core/gather/driver/storage.js +3 -3
- package/core/gather/driver/target-manager.d.ts +6 -5
- package/core/gather/driver/target-manager.js +3 -3
- package/core/gather/driver/wait-for-condition.d.ts +14 -14
- package/core/gather/driver/wait-for-condition.js +8 -8
- package/core/gather/driver.d.ts +9 -6
- package/core/gather/driver.js +14 -4
- package/core/gather/fetcher.d.ts +3 -3
- package/core/gather/fetcher.js +1 -1
- package/core/gather/gatherers/accessibility.d.ts +4 -4
- package/core/gather/gatherers/accessibility.js +8 -3
- package/core/gather/gatherers/anchor-elements.d.ts +4 -4
- package/core/gather/gatherers/anchor-elements.js +4 -4
- package/core/gather/gatherers/bf-cache-failures.d.ts +8 -14
- package/core/gather/gatherers/bf-cache-failures.js +5 -14
- package/core/gather/gatherers/cache-contents.d.ts +4 -4
- package/core/gather/gatherers/cache-contents.js +3 -3
- package/core/gather/gatherers/console-messages.d.ts +6 -6
- package/core/gather/gatherers/console-messages.js +4 -4
- package/core/gather/gatherers/css-usage.d.ts +14 -14
- package/core/gather/gatherers/css-usage.js +9 -9
- package/core/gather/gatherers/devtools-log-compat.d.ts +5 -5
- package/core/gather/gatherers/devtools-log-compat.js +4 -4
- package/core/gather/gatherers/devtools-log.d.ts +6 -6
- package/core/gather/gatherers/devtools-log.js +4 -4
- package/core/gather/gatherers/dobetterweb/doctype.d.ts +4 -4
- package/core/gather/gatherers/dobetterweb/doctype.js +3 -3
- package/core/gather/gatherers/dobetterweb/domstats.d.ts +4 -4
- package/core/gather/gatherers/dobetterweb/domstats.js +3 -3
- package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +10 -22
- package/core/gather/gatherers/dobetterweb/optimized-images.js +10 -27
- package/core/gather/gatherers/dobetterweb/response-compression.d.ts +6 -12
- package/core/gather/gatherers/dobetterweb/response-compression.js +14 -21
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +8 -14
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +5 -14
- package/core/gather/gatherers/full-page-screenshot.d.ts +10 -10
- package/core/gather/gatherers/full-page-screenshot.js +7 -10
- package/core/gather/gatherers/global-listeners.d.ts +4 -4
- package/core/gather/gatherers/global-listeners.js +3 -3
- package/core/gather/gatherers/iframe-elements.d.ts +4 -4
- package/core/gather/gatherers/iframe-elements.js +3 -3
- package/core/gather/gatherers/image-elements.d.ts +10 -10
- package/core/gather/gatherers/image-elements.js +6 -6
- package/core/gather/gatherers/inputs.d.ts +4 -4
- package/core/gather/gatherers/inputs.js +3 -3
- package/core/gather/gatherers/inspector-issues.d.ts +8 -19
- package/core/gather/gatherers/inspector-issues.js +9 -26
- package/core/gather/gatherers/installability-errors.d.ts +6 -6
- package/core/gather/gatherers/installability-errors.js +4 -4
- package/core/gather/gatherers/js-usage.d.ts +6 -6
- package/core/gather/gatherers/js-usage.js +4 -4
- package/core/gather/gatherers/link-elements.d.ts +8 -20
- package/core/gather/gatherers/link-elements.js +7 -24
- package/core/gather/gatherers/main-document-content.d.ts +4 -16
- package/core/gather/gatherers/main-document-content.js +5 -23
- package/core/gather/gatherers/meta-elements.d.ts +4 -4
- package/core/gather/gatherers/meta-elements.js +3 -3
- package/core/gather/gatherers/network-user-agent.d.ts +5 -5
- package/core/gather/gatherers/network-user-agent.js +4 -4
- package/core/gather/gatherers/script-elements.d.ts +6 -11
- package/core/gather/gatherers/script-elements.js +4 -13
- package/core/gather/gatherers/scripts.d.ts +7 -6
- package/core/gather/gatherers/scripts.js +7 -9
- package/core/gather/gatherers/seo/embedded-content.d.ts +4 -4
- package/core/gather/gatherers/seo/embedded-content.js +3 -3
- package/core/gather/gatherers/seo/font-size.d.ts +6 -6
- package/core/gather/gatherers/seo/font-size.js +5 -5
- package/core/gather/gatherers/seo/robots-txt.d.ts +4 -4
- package/core/gather/gatherers/seo/robots-txt.js +3 -3
- package/core/gather/gatherers/seo/tap-targets.d.ts +8 -8
- package/core/gather/gatherers/seo/tap-targets.js +5 -5
- package/core/gather/gatherers/service-worker.d.ts +4 -10
- package/core/gather/gatherers/service-worker.js +3 -15
- package/core/gather/gatherers/source-maps.d.ts +11 -23
- package/core/gather/gatherers/source-maps.js +22 -53
- package/core/gather/gatherers/stacks.d.ts +7 -7
- package/core/gather/gatherers/stacks.js +6 -6
- package/core/gather/gatherers/trace-compat.d.ts +5 -5
- package/core/gather/gatherers/trace-compat.js +4 -4
- package/core/gather/gatherers/trace-elements.d.ts +13 -25
- package/core/gather/gatherers/trace-elements.js +19 -32
- package/core/gather/gatherers/trace.d.ts +8 -8
- package/core/gather/gatherers/trace.js +5 -5
- package/core/gather/gatherers/viewport-dimensions.d.ts +4 -4
- package/core/gather/gatherers/viewport-dimensions.js +3 -3
- package/core/gather/gatherers/web-app-manifest.d.ts +8 -8
- package/core/gather/gatherers/web-app-manifest.js +5 -5
- package/core/gather/navigation-runner.d.ts +9 -9
- package/core/gather/navigation-runner.js +14 -8
- package/core/gather/runner-helpers.d.ts +3 -3
- package/core/gather/runner-helpers.js +12 -4
- package/core/gather/session.d.ts +2 -2
- package/core/gather/session.js +1 -1
- package/core/gather/snapshot-runner.d.ts +2 -2
- package/core/gather/snapshot-runner.js +1 -1
- package/core/gather/timespan-runner.d.ts +2 -2
- package/core/gather/timespan-runner.js +1 -1
- package/core/index.cjs +0 -7
- package/core/index.d.ts +0 -15
- package/core/index.js +2 -40
- package/core/lib/asset-saver.js +14 -4
- package/core/lib/axe.js +1 -1
- package/core/lib/dependency-graph/simulator/network-analyzer.d.ts +28 -12
- package/core/lib/dependency-graph/simulator/network-analyzer.js +128 -100
- package/core/lib/emulation.d.ts +14 -14
- package/core/lib/emulation.js +7 -7
- package/core/lib/navigation-error.js +5 -0
- package/core/lib/network-recorder.d.ts +2 -1
- package/core/lib/network-recorder.js +1 -0
- package/core/lib/network-request.js +12 -3
- package/core/lib/page-functions.d.ts +10 -2
- package/core/lib/page-functions.js +85 -8
- package/core/lib/sentry.js +9 -2
- package/core/lib/stack-packs.js +4 -0
- package/core/runner.d.ts +8 -30
- package/core/runner.js +8 -39
- package/core/user-flow.d.ts +4 -4
- package/core/user-flow.js +2 -2
- package/dist/report/bundle.esm.js +2221 -5832
- package/dist/report/flow.js +2631 -235
- package/dist/report/standalone.js +2586 -234
- package/flow-report/src/i18n/i18n.d.ts +2 -2
- package/package.json +17 -24
- package/readme.md +3 -1
- package/report/assets/templates.html +3 -1
- package/report/renderer/category-renderer.d.ts +3 -2
- package/report/renderer/category-renderer.js +8 -4
- package/report/renderer/components.js +11 -5
- package/report/renderer/pwa-category-renderer.js +1 -1
- package/report/renderer/report-ui-features.js +9 -6
- package/report/renderer/report-utils.d.ts +1 -1
- package/report/renderer/report-utils.js +2 -2
- package/report/renderer/topbar-features.js +3 -0
- package/shared/localization/locales/ar-XB.json +185 -44
- package/shared/localization/locales/ar.json +185 -44
- package/shared/localization/locales/bg.json +185 -44
- package/shared/localization/locales/ca.json +190 -49
- package/shared/localization/locales/cs.json +185 -44
- package/shared/localization/locales/da.json +185 -44
- package/shared/localization/locales/de.json +185 -44
- package/shared/localization/locales/el.json +185 -44
- package/shared/localization/locales/en-GB.json +185 -44
- package/shared/localization/locales/en-US.json +99 -45
- package/shared/localization/locales/en-XA.json +185 -44
- package/shared/localization/locales/en-XL.json +99 -45
- package/shared/localization/locales/es-419.json +185 -44
- package/shared/localization/locales/es.json +185 -44
- package/shared/localization/locales/fi.json +185 -44
- package/shared/localization/locales/fil.json +185 -44
- package/shared/localization/locales/fr.json +185 -44
- package/shared/localization/locales/he.json +186 -45
- package/shared/localization/locales/hi.json +185 -44
- package/shared/localization/locales/hr.json +185 -44
- package/shared/localization/locales/hu.json +185 -44
- package/shared/localization/locales/id.json +185 -44
- package/shared/localization/locales/it.json +185 -44
- package/shared/localization/locales/ja.json +185 -44
- package/shared/localization/locales/ko.json +185 -44
- package/shared/localization/locales/lt.json +185 -44
- package/shared/localization/locales/lv.json +185 -44
- package/shared/localization/locales/nl.json +185 -44
- package/shared/localization/locales/no.json +185 -44
- package/shared/localization/locales/pl.json +185 -44
- package/shared/localization/locales/pt-PT.json +185 -44
- package/shared/localization/locales/pt.json +190 -49
- package/shared/localization/locales/ro.json +185 -44
- package/shared/localization/locales/ru.json +185 -44
- package/shared/localization/locales/sk.json +185 -44
- package/shared/localization/locales/sl.json +185 -44
- package/shared/localization/locales/sr-Latn.json +185 -44
- package/shared/localization/locales/sr.json +185 -44
- package/shared/localization/locales/sv.json +185 -44
- package/shared/localization/locales/ta.json +185 -44
- package/shared/localization/locales/te.json +185 -44
- package/shared/localization/locales/th.json +185 -44
- package/shared/localization/locales/tr.json +185 -44
- package/shared/localization/locales/uk.json +185 -44
- package/shared/localization/locales/vi.json +185 -44
- package/shared/localization/locales/zh-HK.json +185 -44
- package/shared/localization/locales/zh-TW.json +185 -44
- package/shared/localization/locales/zh.json +185 -44
- package/third-party/esbuild-plugins-polyfills/LICENSE +3 -0
- package/third-party/esbuild-plugins-polyfills/README.md +7 -0
- package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.d.ts +9 -0
- package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.js +129 -0
- package/tsconfig.json +2 -1
- package/types/artifacts.d.ts +16 -45
- package/types/config.d.ts +10 -52
- package/types/externs.d.ts +0 -2
- package/types/gatherer.d.ts +24 -47
- package/types/internal/rxjs.d.ts +26 -0
- package/types/internal/smokehouse.d.ts +1 -3
- package/types/lh.d.ts +0 -2
- package/types/lhr/settings.d.ts +1 -1
- package/core/audits/metrics/first-contentful-paint-3g.d.ts +0 -15
- package/core/audits/metrics/first-contentful-paint-3g.js +0 -69
- package/core/audits/resource-summary.d.ts +0 -16
- package/core/audits/resource-summary.js +0 -104
- package/core/audits/service-worker.d.ts +0 -46
- package/core/audits/service-worker.js +0 -182
- package/core/gather/gatherers/gatherer.d.ts +0 -46
- package/core/gather/gatherers/gatherer.js +0 -58
- package/core/legacy/config/config.d.ts +0 -107
- package/core/legacy/config/config.js +0 -566
- package/core/legacy/config/legacy-default-config.d.ts +0 -4
- package/core/legacy/config/legacy-default-config.js +0 -87
- package/core/legacy/gather/connections/connection.d.ts +0 -77
- package/core/legacy/gather/connections/connection.js +0 -196
- package/core/legacy/gather/connections/cri.d.ts +0 -27
- package/core/legacy/gather/connections/cri.js +0 -162
- package/core/legacy/gather/connections/raw.d.ts +0 -20
- package/core/legacy/gather/connections/raw.js +0 -57
- package/core/legacy/gather/driver.d.ts +0 -216
- package/core/legacy/gather/driver.js +0 -480
- package/core/legacy/gather/gather-runner.d.ts +0 -166
- package/core/legacy/gather/gather-runner.js +0 -590
- package/types/internal/lighthouse-logger.d.ts +0 -34
package/CONTRIBUTING.md
CHANGED
|
@@ -85,7 +85,7 @@ A PR adding or changing a gatherer almost always needs to include the following:
|
|
|
85
85
|
yarn update:sample-artifacts ScriptElements
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
This command works for updating `yarn update:sample-artifacts
|
|
88
|
+
This command works for updating `yarn update:sample-artifacts DevtoolsLog` or `Trace` as well, but the resulting `sample_v2.json` churn may be extensive and you might be better off editing manually.
|
|
89
89
|
|
|
90
90
|
1. Run `yarn update:sample-json` to update the [sample Lighthouse result JSON](core/test/results/sample_v2.json) kept in the repo for testing. This will also pull any strings needed for localization into the correct files.
|
|
91
91
|
|
package/cli/cli-flags.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export function getYargsParser(manualArgv?: string | undefined): yargs.Argv<yarg
|
|
|
24
24
|
default: boolean;
|
|
25
25
|
describe: string;
|
|
26
26
|
};
|
|
27
|
-
}>, "port" | "screenEmulation" | "emulatedUserAgent" | "hostname" | "preset" | "save-assets" | "list-all-audits" | "list-locales" | "list-trace-categories" | "debug-navigation" | "
|
|
27
|
+
}>, "port" | "screenEmulation" | "emulatedUserAgent" | "hostname" | "preset" | "save-assets" | "list-all-audits" | "list-locales" | "list-trace-categories" | "debug-navigation" | "additional-trace-categories" | "config-path" | "chrome-flags" | "form-factor" | "max-wait-for-load" | "enable-error-reporting" | "gather-mode" | "audit-mode" | "only-audits" | "only-categories" | "skip-audits" | "budget-path" | "disable-full-page-screenshot"> & yargs.InferredOptionTypes<{
|
|
28
28
|
'save-assets': {
|
|
29
29
|
type: "boolean";
|
|
30
30
|
default: boolean;
|
|
@@ -49,11 +49,6 @@ export function getYargsParser(manualArgv?: string | undefined): yargs.Argv<yarg
|
|
|
49
49
|
type: "boolean";
|
|
50
50
|
describe: string;
|
|
51
51
|
};
|
|
52
|
-
'legacy-navigation': {
|
|
53
|
-
type: "boolean";
|
|
54
|
-
default: boolean;
|
|
55
|
-
describe: string;
|
|
56
|
-
};
|
|
57
52
|
'additional-trace-categories': {
|
|
58
53
|
type: "string";
|
|
59
54
|
describe: string;
|
package/cli/cli-flags.js
CHANGED
|
@@ -117,11 +117,6 @@ function getYargsParser(manualArgv) {
|
|
|
117
117
|
type: 'boolean',
|
|
118
118
|
describe: 'Pause after page load to wait for permission to continue the run, evaluate `continueLighthouseRun` in the console to continue.',
|
|
119
119
|
},
|
|
120
|
-
'legacy-navigation': {
|
|
121
|
-
type: 'boolean',
|
|
122
|
-
default: false,
|
|
123
|
-
describe: '[DEPRECATED] Use the legacy navigation runner to gather results. Only use this if you are using a pre-10.0 custom Lighthouse config, or if Lighthouse unexpectedly fails after updating to 10.0. Please file a bug if you need this flag for Lighthouse to work.',
|
|
124
|
-
},
|
|
125
120
|
'additional-trace-categories': {
|
|
126
121
|
type: 'string',
|
|
127
122
|
describe: 'Additional categories to capture with the trace (comma-delimited).',
|
package/cli/run.js
CHANGED
|
@@ -16,7 +16,7 @@ import log from 'lighthouse-logger';
|
|
|
16
16
|
import open from 'open';
|
|
17
17
|
|
|
18
18
|
import * as Printer from './printer.js';
|
|
19
|
-
import lighthouse
|
|
19
|
+
import lighthouse from '../core/index.js';
|
|
20
20
|
import {getLhrFilenamePrefix} from '../report/generator/file-namer.js';
|
|
21
21
|
import * as assetSaver from '../core/lib/asset-saver.js';
|
|
22
22
|
import UrlUtils from '../core/lib/url-utils.js';
|
|
@@ -238,16 +238,9 @@ async function runLighthouse(url, flags, config) {
|
|
|
238
238
|
flags.port = launchedChrome.port;
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
|
|
242
|
-
log.warn('CLI', 'Legacy navigation CLI is deprecated');
|
|
243
|
-
flags.channel = 'legacy-navigation-cli';
|
|
244
|
-
} else if (!flags.channel) {
|
|
245
|
-
flags.channel = 'cli';
|
|
246
|
-
}
|
|
241
|
+
flags.channel = 'cli';
|
|
247
242
|
|
|
248
|
-
const runnerResult = flags
|
|
249
|
-
await legacyNavigation(url, flags, config) :
|
|
250
|
-
await lighthouse(url, flags, config);
|
|
243
|
+
const runnerResult = await lighthouse(url, flags, config);
|
|
251
244
|
|
|
252
245
|
// If in gatherMode only, there will be no runnerResult.
|
|
253
246
|
if (runnerResult) {
|
package/cli/sentry-prompt.js
CHANGED
|
@@ -10,10 +10,12 @@ import log from 'lighthouse-logger';
|
|
|
10
10
|
|
|
11
11
|
const MAXIMUM_WAIT_TIME = 20 * 1000;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/* eslint-disable max-len */
|
|
14
14
|
const MESSAGE = `${log.reset}We're constantly trying to improve Lighthouse and its reliability.\n ` +
|
|
15
15
|
`${log.reset}Learn more: https://github.com/GoogleChrome/lighthouse/blob/main/docs/error-reporting.md \n ` +
|
|
16
|
-
` ${log.bold}May we anonymously report runtime exceptions to improve the tool over time?${log.reset}
|
|
16
|
+
` ${log.bold}May we anonymously report runtime exceptions to improve the tool over time?${log.reset}\n ` +
|
|
17
|
+
`We'll remember your choice, but you can also use the flag --[no-]enable-error-reporting`;
|
|
18
|
+
/* eslint-enable max-len */
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* @return {Promise<boolean>}
|
|
@@ -33,7 +33,6 @@ import metricsTrickyTtiLateFcp from './test-definitions/metrics-tricky-tti-late-
|
|
|
33
33
|
import offlineOnlineOnly from './test-definitions/offline-online-only.js';
|
|
34
34
|
import offlineReady from './test-definitions/offline-ready.js';
|
|
35
35
|
import offlineSwBroken from './test-definitions/offline-sw-broken.js';
|
|
36
|
-
import offlineSwSlow from './test-definitions/offline-sw-slow.js';
|
|
37
36
|
import oopifRequests from './test-definitions/oopif-requests.js';
|
|
38
37
|
import oopifScripts from './test-definitions/oopif-scripts.js';
|
|
39
38
|
import perfBudgets from './test-definitions/perf-budgets.js';
|
|
@@ -97,7 +96,6 @@ const smokeTests = [
|
|
|
97
96
|
offlineOnlineOnly,
|
|
98
97
|
offlineReady,
|
|
99
98
|
offlineSwBroken,
|
|
100
|
-
offlineSwSlow,
|
|
101
99
|
oopifRequests,
|
|
102
100
|
oopifScripts,
|
|
103
101
|
perfBudgets,
|
|
@@ -136,11 +136,6 @@ async function begin() {
|
|
|
136
136
|
default: false,
|
|
137
137
|
describe: 'Save test artifacts and output verbose logs',
|
|
138
138
|
},
|
|
139
|
-
'legacy-navigation': {
|
|
140
|
-
type: 'boolean',
|
|
141
|
-
default: false,
|
|
142
|
-
describe: 'Use the legacy navigation runner',
|
|
143
|
-
},
|
|
144
139
|
'jobs': {
|
|
145
140
|
type: 'number',
|
|
146
141
|
alias: 'j',
|
|
@@ -218,7 +213,6 @@ async function begin() {
|
|
|
218
213
|
jobs,
|
|
219
214
|
retries,
|
|
220
215
|
isDebug: argv.debug,
|
|
221
|
-
useLegacyNavigation: argv.legacyNavigation,
|
|
222
216
|
lighthouseRunner: runLighthouse,
|
|
223
217
|
takeNetworkRequestUrls,
|
|
224
218
|
setup,
|
|
@@ -229,17 +223,25 @@ async function begin() {
|
|
|
229
223
|
servers?.forEach(s => s.close());
|
|
230
224
|
}
|
|
231
225
|
|
|
226
|
+
let smokehouseOutputDir;
|
|
227
|
+
let testResultsToOutput;
|
|
232
228
|
if (!smokehouseResult.success) {
|
|
233
|
-
const failedTestResults = smokehouseResult.testResults.filter(r => r.failed);
|
|
234
|
-
|
|
235
229
|
// Save failed runs to directory. In CI, this is uploaded as an artifact.
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
+
}
|
|
239
237
|
|
|
240
|
-
|
|
238
|
+
if (smokehouseOutputDir && testResultsToOutput) {
|
|
239
|
+
fs.rmSync(smokehouseOutputDir, {recursive: true, force: true});
|
|
240
|
+
fs.mkdirSync(smokehouseOutputDir, {recursive: true});
|
|
241
|
+
|
|
242
|
+
for (const testResult of testResultsToOutput) {
|
|
241
243
|
for (let i = 0; i < testResult.runs.length; i++) {
|
|
242
|
-
const runDir = `${
|
|
244
|
+
const runDir = `${smokehouseOutputDir}/${i}/${testResult.id}`;
|
|
243
245
|
fs.mkdirSync(runDir, {recursive: true});
|
|
244
246
|
|
|
245
247
|
const run = testResult.runs[i];
|
|
@@ -250,10 +252,18 @@ async function begin() {
|
|
|
250
252
|
if (run.networkRequests) {
|
|
251
253
|
fs.writeFileSync(`${runDir}/networkRequests.txt`, run.networkRequests.join('\n'));
|
|
252
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));
|
|
258
|
+
}
|
|
253
259
|
}
|
|
254
260
|
}
|
|
255
261
|
|
|
256
|
-
|
|
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(' ')}`;
|
|
257
267
|
console.log(`rerun failures: ${cmd}`);
|
|
258
268
|
}
|
|
259
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
|
|
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;
|
|
@@ -17,9 +17,8 @@ import {Worker, isMainThread, parentPort, workerData} from 'worker_threads';
|
|
|
17
17
|
import {once} from 'events';
|
|
18
18
|
|
|
19
19
|
import puppeteer from 'puppeteer-core';
|
|
20
|
-
import ChromeLauncher from 'chrome-launcher';
|
|
20
|
+
import * as 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
|
|
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) {
|
|
@@ -57,6 +56,7 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
|
|
|
57
56
|
|
|
58
57
|
const originalBuffer = global.Buffer;
|
|
59
58
|
const originalRequire = global.require;
|
|
59
|
+
const originalProcess = global.process;
|
|
60
60
|
if (typeof globalThis === 'undefined') {
|
|
61
61
|
// @ts-expect-error - exposing for loading of dt-bundle.
|
|
62
62
|
global.globalThis = global;
|
|
@@ -67,15 +67,12 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
|
|
|
67
67
|
|
|
68
68
|
global.require = originalRequire;
|
|
69
69
|
global.Buffer = originalBuffer;
|
|
70
|
+
global.process = originalProcess;
|
|
70
71
|
|
|
71
72
|
/** @type {import('../../../../core/index.js')['default']} */
|
|
72
73
|
// @ts-expect-error - not worth giving test global an actual type.
|
|
73
74
|
const lighthouse = global.runBundledLighthouse;
|
|
74
75
|
|
|
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
76
|
// Launch and connect to Chrome.
|
|
80
77
|
const launchedChrome = await ChromeLauncher.launch();
|
|
81
78
|
const port = launchedChrome.port;
|
|
@@ -83,17 +80,11 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
|
|
|
83
80
|
// Run Lighthouse.
|
|
84
81
|
try {
|
|
85
82
|
const logLevel = testRunnerOptions.isDebug ? 'verbose' : 'info';
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
}
|
|
83
|
+
|
|
84
|
+
// Puppeteer is not included in the bundle, we must create the page here.
|
|
85
|
+
const browser = await puppeteer.connect({browserURL: `http://127.0.0.1:${port}`});
|
|
86
|
+
const page = await browser.newPage();
|
|
87
|
+
const runnerResult = await lighthouse(url, {port, logLevel}, config, page);
|
|
97
88
|
if (!runnerResult) throw new Error('No runnerResult');
|
|
98
89
|
|
|
99
90
|
return {
|
|
@@ -110,7 +101,7 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
|
|
|
110
101
|
* Launch Chrome and do a full Lighthouse run via the Lighthouse DevTools bundle.
|
|
111
102
|
* @param {string} url
|
|
112
103
|
* @param {LH.Config=} config
|
|
113
|
-
* @param {{isDebug?: boolean
|
|
104
|
+
* @param {{isDebug?: boolean}=} testRunnerOptions
|
|
114
105
|
* @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
|
|
115
106
|
*/
|
|
116
107
|
async function runLighthouse(url, config, testRunnerOptions = {}) {
|
|
@@ -133,7 +124,7 @@ async function runLighthouse(url, config, testRunnerOptions = {}) {
|
|
|
133
124
|
const log = logs.join('') + '\n';
|
|
134
125
|
|
|
135
126
|
if (workerResponse.type === 'error') {
|
|
136
|
-
new Error(`Worker returned an error: ${workerResponse.value}\nLog:\n${log}`);
|
|
127
|
+
throw new Error(`Worker returned an error: ${workerResponse.value}\nLog:\n${log}`);
|
|
137
128
|
}
|
|
138
129
|
|
|
139
130
|
const result = workerResponse.value;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
/// <reference path="../../../../../../types/internal/lighthouse-logger.d.ts" />
|
|
2
1
|
/**
|
|
3
2
|
* Launch Chrome and do a full Lighthouse run via the Lighthouse CLI.
|
|
4
3
|
* @param {string} url
|
|
5
4
|
* @param {LH.Config=} config
|
|
6
|
-
* @param {{isDebug?: boolean
|
|
5
|
+
* @param {{isDebug?: boolean}=} testRunnerOptions
|
|
7
6
|
* @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
|
|
8
7
|
*/
|
|
9
8
|
export function runLighthouse(url: string, config?: LH.Config | undefined, testRunnerOptions?: {
|
|
10
9
|
isDebug?: boolean | undefined;
|
|
11
|
-
useFraggleRock?: boolean | undefined;
|
|
12
10
|
} | undefined): Promise<{
|
|
13
11
|
lhr: LH.Result;
|
|
14
12
|
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
|
|
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
|
|
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
|
|
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,13 +5,9 @@
|
|
|
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
|
|
9
8
|
* @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
|
|
10
9
|
*/
|
|
11
|
-
export function runLighthouse(url: string, config?: LH.Config | undefined
|
|
12
|
-
isDebug?: boolean;
|
|
13
|
-
useLegacyNavigation?: boolean;
|
|
14
|
-
} | undefined): Promise<{
|
|
10
|
+
export function runLighthouse(url: string, config?: LH.Config | undefined): Promise<{
|
|
15
11
|
lhr: LH.Result;
|
|
16
12
|
artifacts: LH.Artifacts;
|
|
17
13
|
log: string;
|
|
@@ -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,26 +40,17 @@ 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
|
|
46
43
|
* @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
|
|
47
44
|
*/
|
|
48
|
-
async function runLighthouse(url, config
|
|
45
|
+
async function runLighthouse(url, config) {
|
|
49
46
|
const chromeFlags = [
|
|
50
47
|
`--custom-devtools-frontend=file://${devtoolsDir}/out/LighthouseIntegration/gen/front_end`,
|
|
51
48
|
];
|
|
52
49
|
const {lhr, artifacts, logs} = await testUrlFromDevtools(url, {
|
|
53
50
|
config,
|
|
54
51
|
chromeFlags,
|
|
55
|
-
useLegacyNavigation: testRunnerOptions.useLegacyNavigation,
|
|
56
52
|
});
|
|
57
53
|
|
|
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
54
|
const log = logs.join('') + '\n';
|
|
66
55
|
return {lhr, artifacts, log};
|
|
67
56
|
}
|
|
@@ -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
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference path="../../../../../types/internal/lighthouse-logger.d.ts" />
|
|
2
1
|
export type Difference = {
|
|
3
2
|
path: string;
|
|
4
3
|
actual: any;
|
|
@@ -16,7 +15,7 @@ export type Comparison = {
|
|
|
16
15
|
* summary. Returns count of passed and failed tests.
|
|
17
16
|
* @param {{lhr: LH.Result, artifacts: LH.Artifacts, networkRequests?: string[]}} actual
|
|
18
17
|
* @param {Smokehouse.ExpectedRunnerResult} expected
|
|
19
|
-
* @param {{runner?: string, isDebug?: boolean
|
|
18
|
+
* @param {{runner?: string, isDebug?: boolean}=} reportOptions
|
|
20
19
|
* @return {{passed: number, failed: number, log: string}}
|
|
21
20
|
*/
|
|
22
21
|
export function getAssertionReport(actual: {
|
|
@@ -26,7 +25,6 @@ export function getAssertionReport(actual: {
|
|
|
26
25
|
}, expected: Smokehouse.ExpectedRunnerResult, reportOptions?: {
|
|
27
26
|
runner?: string;
|
|
28
27
|
isDebug?: boolean;
|
|
29
|
-
useLegacyNavigation?: boolean;
|
|
30
28
|
} | undefined): {
|
|
31
29
|
passed: number;
|
|
32
30
|
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
|
|
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
|
|
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,
|
|
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
|
|
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 ARIAAllowedRole;
|
|
2
|
+
declare class ARIAAllowedRole 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-allowed-role.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
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 ARIA attributes are appropriate for an element's role.
|
|
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 the ARIA role attributes are valid for the HTML element. This title is descriptive of the successful state and is shown to users when no user action is required. */
|
|
17
|
+
title: 'Values assigned to `role=""` are valid ARIA roles.',
|
|
18
|
+
/** Title of an accesibility audit that evaluates if the ARIA role attributes are valid for the HTML element. 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: 'Values assigned to `role=""` are not valid ARIA roles.',
|
|
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: 'ARIA `role`s enable assistive technologies to know the role of each element on ' +
|
|
22
|
+
'the web page. If the `role` values are misspelled, not existing ARIA `role` values, or ' +
|
|
23
|
+
'abstract roles, then the purpose of the element will not be communicated to users of ' +
|
|
24
|
+
'assistive technologies. ' +
|
|
25
|
+
'[Learn more about ARIA roles](https://dequeuniversity.com/rules/axe/4.7/aria-allowed-roles).',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
29
|
+
|
|
30
|
+
class ARIAAllowedRole extends AxeAudit {
|
|
31
|
+
/**
|
|
32
|
+
* @return {LH.Audit.Meta}
|
|
33
|
+
*/
|
|
34
|
+
static get meta() {
|
|
35
|
+
return {
|
|
36
|
+
id: 'aria-allowed-role',
|
|
37
|
+
title: str_(UIStrings.title),
|
|
38
|
+
failureTitle: str_(UIStrings.failureTitle),
|
|
39
|
+
description: str_(UIStrings.description),
|
|
40
|
+
requiredArtifacts: ['Accessibility'],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default ARIAAllowedRole;
|
|
46
|
+
export {UIStrings};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default ImageRedundantAlt;
|
|
2
|
+
declare class ImageRedundantAlt 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=image-redundant-alt.d.ts.map
|