lighthouse 11.2.0-dev.20231017 → 11.2.0-dev.20231018
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/cli/test/smokehouse/frontends/smokehouse-bin.js +18 -7
- package/cli/test/smokehouse/lighthouse-runners/bundle.d.ts +2 -4
- package/cli/test/smokehouse/lighthouse-runners/bundle.js +8 -4
- package/cli/test/smokehouse/lighthouse-runners/cli.d.ts +2 -4
- package/cli/test/smokehouse/lighthouse-runners/cli.js +5 -3
- package/cli/test/smokehouse/lighthouse-runners/devtools.d.ts +2 -1
- package/cli/test/smokehouse/lighthouse-runners/devtools.js +3 -1
- package/cli/test/smokehouse/smokehouse.d.ts +4 -2
- package/cli/test/smokehouse/smokehouse.js +10 -7
- package/core/config/config.d.ts +1 -2
- package/core/config/config.js +18 -62
- package/core/config/constants.d.ts +1 -3
- package/core/config/constants.js +2 -18
- package/core/config/filters.d.ts +0 -8
- package/core/config/filters.js +0 -28
- package/core/config/validation.d.ts +4 -15
- package/core/config/validation.js +18 -63
- package/core/gather/base-artifacts.d.ts +2 -2
- package/core/gather/base-artifacts.js +5 -5
- package/core/gather/driver/navigation.d.ts +1 -1
- package/core/gather/driver/navigation.js +1 -1
- package/core/gather/driver/prepare.d.ts +3 -18
- package/core/gather/driver/prepare.js +14 -38
- package/core/gather/navigation-runner.d.ts +3 -31
- package/core/gather/navigation-runner.js +39 -112
- package/core/lib/navigation-error.d.ts +1 -2
- package/core/lib/navigation-error.js +2 -6
- package/package.json +1 -1
- package/types/config.d.ts +0 -38
- package/types/internal/smokehouse.d.ts +10 -5
|
@@ -15,12 +15,11 @@ export function getInterstitialError(mainRecord: LH.Artifacts.NetworkRequest | u
|
|
|
15
15
|
* Returns an error if the page load should be considered failed, e.g. from a
|
|
16
16
|
* main document request failure, a security issue, etc.
|
|
17
17
|
* @param {LH.LighthouseError|undefined} navigationError
|
|
18
|
-
* @param {{url: string,
|
|
18
|
+
* @param {{url: string, networkRecords: Array<LH.Artifacts.NetworkRequest>, warnings: Array<string | LH.IcuMessage>}} context
|
|
19
19
|
* @return {LH.LighthouseError|undefined}
|
|
20
20
|
*/
|
|
21
21
|
export function getPageLoadError(navigationError: LH.LighthouseError | undefined, context: {
|
|
22
22
|
url: string;
|
|
23
|
-
loadFailureMode: LH.Config.SharedPassNavigationJson['loadFailureMode'];
|
|
24
23
|
networkRecords: Array<LH.Artifacts.NetworkRequest>;
|
|
25
24
|
warnings: Array<string | LH.IcuMessage>;
|
|
26
25
|
}): LH.LighthouseError | undefined;
|
|
@@ -113,11 +113,11 @@ function getNonHtmlError(finalRecord) {
|
|
|
113
113
|
* Returns an error if the page load should be considered failed, e.g. from a
|
|
114
114
|
* main document request failure, a security issue, etc.
|
|
115
115
|
* @param {LH.LighthouseError|undefined} navigationError
|
|
116
|
-
* @param {{url: string,
|
|
116
|
+
* @param {{url: string, networkRecords: Array<LH.Artifacts.NetworkRequest>, warnings: Array<string | LH.IcuMessage>}} context
|
|
117
117
|
* @return {LH.LighthouseError|undefined}
|
|
118
118
|
*/
|
|
119
119
|
function getPageLoadError(navigationError, context) {
|
|
120
|
-
const {url,
|
|
120
|
+
const {url, networkRecords} = context;
|
|
121
121
|
/** @type {LH.Artifacts.NetworkRequest|undefined} */
|
|
122
122
|
let mainRecord = NetworkAnalyzer.findResourceForUrl(networkRecords, url);
|
|
123
123
|
|
|
@@ -148,10 +148,6 @@ function getPageLoadError(navigationError, context) {
|
|
|
148
148
|
const interstitialError = getInterstitialError(mainRecord, networkRecords);
|
|
149
149
|
const nonHtmlError = getNonHtmlError(finalRecord);
|
|
150
150
|
|
|
151
|
-
// Check to see if we need to ignore the page load failure.
|
|
152
|
-
// e.g. When the driver is offline, the load will fail without page offline support.
|
|
153
|
-
if (loadFailureMode === 'ignore') return;
|
|
154
|
-
|
|
155
151
|
// We want to special-case the interstitial beyond FAILED_DOCUMENT_REQUEST. See https://github.com/GoogleChrome/lighthouse/pull/8865#issuecomment-497507618
|
|
156
152
|
if (interstitialError) return interstitialError;
|
|
157
153
|
|
package/package.json
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -34,45 +34,11 @@ declare module Config {
|
|
|
34
34
|
interface ResolvedConfig {
|
|
35
35
|
settings: Settings;
|
|
36
36
|
artifacts: AnyArtifactDefn[] | null;
|
|
37
|
-
navigations: NavigationDefn[] | null;
|
|
38
37
|
audits: AuditDefn[] | null;
|
|
39
38
|
categories: Record<string, Category> | null;
|
|
40
39
|
groups: Record<string, Group> | null;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
interface SharedPassNavigationJson {
|
|
44
|
-
/**
|
|
45
|
-
* Controls the behavior when the navigation fails to complete (due to server error, no FCP, etc).
|
|
46
|
-
* Fatal means Lighthouse will exit immediately and return a runtimeError / non-zero exit code.
|
|
47
|
-
* Warn means a toplevel warning will appear in the report, but the run will complete with success.
|
|
48
|
-
* Ignore means a failure is expected and no action should be taken.
|
|
49
|
-
*/
|
|
50
|
-
loadFailureMode?: 'fatal'|'warn'|'ignore';
|
|
51
|
-
/** The number of milliseconds to wait after FCP until the page should be considered loaded. */
|
|
52
|
-
pauseAfterFcpMs?: number;
|
|
53
|
-
/** The number of milliseconds to wait after the load event until the page should be considered loaded. */
|
|
54
|
-
pauseAfterLoadMs?: number;
|
|
55
|
-
/** The number of milliseconds to wait between high priority network requests or 3 simulataneous requests before the page should be considered loaded. */
|
|
56
|
-
networkQuietThresholdMs?: number;
|
|
57
|
-
/** The number of milliseconds to wait between long tasks until the page should be considered loaded. */
|
|
58
|
-
cpuQuietThresholdMs?: number;
|
|
59
|
-
/** Substring patterns of network resources to block during this navigation, '*' wildcards supported though unnecessary as prefix or suffix (due to substring matching). */
|
|
60
|
-
blockedUrlPatterns?: string[];
|
|
61
|
-
/** The URL to use for the "blank" neutral page in between navigations. Defaults to `about:blank`. */
|
|
62
|
-
blankPage?: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
interface NavigationJson extends SharedPassNavigationJson {
|
|
66
|
-
/** The identifier for the navigation. Config extension will deduplicate navigations with the same id. */
|
|
67
|
-
id: string;
|
|
68
|
-
/** Whether throttling settings should be skipped for the pass. */
|
|
69
|
-
disableThrottling?: boolean;
|
|
70
|
-
/** Whether storage clearing (service workers, cache storage) should be skipped for the pass. A run-wide setting of `true` takes precedence over this value. */
|
|
71
|
-
disableStorageReset?: boolean;
|
|
72
|
-
/** The array of artifacts to collect during the navigation. */
|
|
73
|
-
artifacts?: Array<string>;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
42
|
interface ArtifactJson {
|
|
77
43
|
id: string;
|
|
78
44
|
gatherer: GathererJson;
|
|
@@ -121,10 +87,6 @@ declare module Config {
|
|
|
121
87
|
|
|
122
88
|
type Settings = ConfigSettings;
|
|
123
89
|
|
|
124
|
-
interface NavigationDefn extends Omit<Required<NavigationJson>, 'artifacts'> {
|
|
125
|
-
artifacts: AnyArtifactDefn[];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
90
|
interface ArtifactDefn<TDependencies extends Gatherer.DependencyKey = Gatherer.DependencyKey> {
|
|
129
91
|
id: string;
|
|
130
92
|
gatherer: GathererDefn<TDependencies>;
|
|
@@ -56,14 +56,19 @@ declare global {
|
|
|
56
56
|
{runnerName?: string} & ((url: string, config?: Config, runnerOptions?: {isDebug?: boolean}) => Promise<{lhr: LHResult, artifacts: Artifacts, log: string}>);
|
|
57
57
|
|
|
58
58
|
export interface SmokehouseOptions {
|
|
59
|
-
/**
|
|
60
|
-
|
|
59
|
+
/** Options to pass to the specific Lighthouse runner. */
|
|
60
|
+
testRunnerOptions?: {
|
|
61
|
+
/** If true, performs extra logging from the test runs. */
|
|
62
|
+
isDebug?: boolean;
|
|
63
|
+
/** Launch Chrome in the new headless mode (`--headless=new`), rather than the typical desktop headful mode. */
|
|
64
|
+
headless?: boolean;
|
|
65
|
+
};
|
|
61
66
|
/** Manually set the number of jobs to run at once. `1` runs all tests serially. */
|
|
62
|
-
jobs
|
|
67
|
+
jobs: number;
|
|
63
68
|
/** The number of times to retry failing tests before accepting. Defaults to 0. */
|
|
64
|
-
retries
|
|
69
|
+
retries: number;
|
|
65
70
|
/** A function that runs Lighthouse with the given options. Defaults to running Lighthouse via the CLI. */
|
|
66
|
-
lighthouseRunner
|
|
71
|
+
lighthouseRunner: LighthouseRunner;
|
|
67
72
|
/** A function that gets a list of URLs requested to the server since the last fetch. */
|
|
68
73
|
takeNetworkRequestUrls?: () => string[];
|
|
69
74
|
/** A function run once before all smoke tests. */
|