You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration.md
+82-33Lines changed: 82 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,8 @@
1
+
<!---
2
+
TODO(rm-legacy): Remove this when legacy path is gone.
3
+
-->
4
+
> **WARNING**: This config format is for configs in version 10.0 and beyond. Please read the [legacy config](#legacy-configs) section if you are using the old config format.
5
+
1
6
# Lighthouse Configuration
2
7
3
8
The Lighthouse config object is the primary method of customizing Lighthouse to suit your use case. Using a custom config, you can limit the audits to run, add additional loads of the page under special conditions, add your own custom checks, tweak the scoring, and more.
@@ -10,7 +15,7 @@ You can specify a custom config file when using Lighthouse through the CLI or co
@@ -79,44 +84,23 @@ For full list see [our config settings typedef](https://github.com/GoogleChrome/
79
84
| onlyAudits |`string[]`| Includes only the specified audits in the final report. Additive with `onlyCategories` and reduces the time to audit a page. |
80
85
| skipAudits |`string[]`| Excludes the specified audits from the final report. Takes priority over `onlyCategories`, not usable in conjuction with `onlyAudits`, and reduces the time to audit a page. |
81
86
82
-
### `passes: Object[]`
83
-
84
-
The passes property controls how to load the requested URL and what information to gather about the page while loading. Each entry in the passes array represents one load of the page (e.g. 4 entries in `passes` will load the page 4 times), so be judicious about adding multiple entries here to avoid extending run times.
87
+
### `artifacts: Object[]`
85
88
86
-
Each `passes` entry defines basic settings such as how long to wait for the page to load and whether to record a trace file. Additionally a list of **gatherers** to use is defined per pass. Gatherers can read information from the page to generate artifacts which are later used by audits to provide you with a Lighthouse report. For more information on implementing a custom gatherer and the role they play in building a Lighthouse report, refer to the [recipes](https://github.com/GoogleChrome/lighthouse/blob/master/docs/recipes/custom-audit). Also note that `artifacts.devtoolsLogs`will be automatically populated for every pass. Gatherers also have access to this data within the `afterPass` as `traceData.devtoolsLog` (However, most will find the higher-level `traceData.networkRecords` more useful).
89
+
The list of artifacts to collect on a single Lighthouse run. This property is required and on extension will be concatenated with the existing set of artifacts.
87
90
88
-
For list of default pass values, see [our config constants](https://github.com/GoogleChrome/lighthouse/blob/master/core/config/constants.js).
| passName |`string`| A unique identifier for the pass used in audits and during config extension. |
113
-
| recordTrace |`boolean`| Records a [trace](https://github.com/GoogleChrome/lighthouse/blob/master/docs/architecture.md#understanding-a-trace) of the pass when enabled. Available to gatherers during `afterPass` as `traceData.trace` and to audits in `artifacts.traces`. |
114
-
| useThrottling |`boolean`| Enables throttling of the pass when enabled. |
115
-
| pauseAfterLoadMs |`number`| The number of milliseconds to wait after the load event before the pass can continue. Used to ensure the page has had time for post-load JavaScript to execute before ending a trace. (Default: 0) |
116
-
| networkQuietThresholdMs |`number`| The number of milliseconds since the last network request to wait before the page should be considered to have reached 'network quiet'. Used to ensure the page has had time for the full waterfall of network requests to complete before ending a trace. (Default: 5000) |
117
-
| pauseAfterNetworkQuietMs |`number`| The number of milliseconds to wait after 'network quiet' before the pass can continue. Used to ensure the page has had time for post-network-quiet JavaScript to execute before ending a trace. (Default: 0) |
118
-
| blockedUrlPatterns |`string[]`| URLs of requests to block while loading the page. Basic wildcard support using `*`. |
119
-
| gatherers |`string[]`| The list of gatherers to run on this pass. This property is required and on extension will be concatenated with the existing set of gatherers. |
102
+
| id |`string`| Unique identifier for this artifact. This is how the artifact is referenced in audits. |
103
+
| gatherer |`string`| Gatherer used to produce this artifact. Does not need to be unique within the `artifacts` list. |
120
104
121
105
### `audits: string[]`
122
106
@@ -132,7 +116,6 @@ The audits property controls which audits to run and include with your Lighthous
132
116
}
133
117
```
134
118
135
-
136
119
### `categories: Object|undefined`
137
120
138
121
The categories property controls how to score and organize the audit results in the report. Each category defined in the config will have an entry in the `categories` property of Lighthouse's output. The category output contains the child audit results along with an overall score for the category.
@@ -211,3 +194,69 @@ The best examples are the ones Lighthouse uses itself! There are several referen
Older versions of Lighthouse (pre-10.0) use a slightly different config format. The biggest difference is that the new configs do not include `passes`. If you want to load a page multiple times, we recommend creating a [user flow](https://github.com/GoogleChrome/lighthouse/blob/master/docs/user-flows.md).
The passes property controls how to load the requested URL and what information to gather about the page while loading. Each entry in the passes array represents one load of the page (e.g. 4 entries in `passes` will load the page 4 times), so be judicious about adding multiple entries here to avoid extending run times.
207
+
208
+
Each `passes` entry defines basic settings such as how long to wait for the page to load and whether to record a trace file. Additionally a list of **gatherers** to use is defined per pass. Gatherers can read information from the page to generate artifacts which are later used by audits to provide you with a Lighthouse report. For more information on implementing a custom gatherer and the role they play in building a Lighthouse report, refer to the [recipes](https://github.com/GoogleChrome/lighthouse/blob/master/docs/recipes/custom-audit). Also note that `artifacts.devtoolsLogs` will be automatically populated for every pass. Gatherers also have access to this data within the `afterPass` as `traceData.devtoolsLog` (However, most will find the higher-level `traceData.networkRecords` more useful).
209
+
210
+
For list of default pass values, see [our config constants](https://github.com/GoogleChrome/lighthouse/blob/master/core/config/constants.js).
211
+
212
+
#### Example
213
+
```js
214
+
{
215
+
passes: [
216
+
{
217
+
passName:'fastPass',
218
+
gatherers: ['fast-gatherer'],
219
+
},
220
+
{
221
+
passName:'slowPass',
222
+
recordTrace:true,
223
+
useThrottling:true,
224
+
networkQuietThresholdMs:5000,
225
+
gatherers: ['slow-gatherer'],
226
+
}
227
+
]
228
+
}
229
+
```
230
+
231
+
#### Options
232
+
| Name | Type | Description |
233
+
| -- | -- | -- |
234
+
| passName |`string`| A unique identifier for the pass used in audits and during config extension. |
235
+
| recordTrace |`boolean`| Records a [trace](https://github.com/GoogleChrome/lighthouse/blob/master/docs/architecture.md#understanding-a-trace) of the pass when enabled. Available to gatherers during `afterPass` as `traceData.trace` and to audits in `artifacts.traces`. |
236
+
| useThrottling |`boolean`| Enables throttling of the pass when enabled. |
237
+
| pauseAfterLoadMs |`number`| The number of milliseconds to wait after the load event before the pass can continue. Used to ensure the page has had time for post-load JavaScript to execute before ending a trace. (Default: 0) |
238
+
| networkQuietThresholdMs |`number`| The number of milliseconds since the last network request to wait before the page should be considered to have reached 'network quiet'. Used to ensure the page has had time for the full waterfall of network requests to complete before ending a trace. (Default: 5000) |
239
+
| pauseAfterNetworkQuietMs |`number`| The number of milliseconds to wait after 'network quiet' before the pass can continue. Used to ensure the page has had time for post-network-quiet JavaScript to execute before ending a trace. (Default: 0) |
240
+
| blockedUrlPatterns |`string[]`| URLs of requests to block while loading the page. Basic wildcard support using `*`. |
241
+
| gatherers |`string[]`| The list of gatherers to run on this pass. This property is required and on extension will be concatenated with the existing set of gatherers. |
242
+
243
+
### Migrating to 10.0 format
244
+
245
+
1. Combine the gatherer lists in [`config.passes`](#passes-object) into [`config.artifacts`](#artifacts-object), giving each artifact a unique ID.
246
+
1. Remove [`config.passes`](#passes-object) property. Pass properties such as `pauseAfterLoadMs` are defined on `config.settings` in 10.0 configs.
247
+
248
+
### Using legacy configs in 10.0
249
+
250
+
The old config format can still be used in 10.0 but it's behind a separate path in the CLI and Node API.
0 commit comments