A configuration file must be specified when using lighthouse-inspector.
sample-config.json
{
"pages": [
"https://google.com/"
],
"expectations": {
"categories": {
"pwa": 90,
"best-practices": 90,
"performance": 90,
"accessibility": 90
},
"audits": {
"first-meaningful-paint": 30,
"load-fast-enough-for-pwa": true
}
},
"lighthouseParams": {
"flags": {
"chromeFlags": ["--headless"]
},
"config": {
"extends": "lighthouse:default"
}
}
}
CLI
lighthouse-inspector --config /path/to/config
Name | Type |
---|---|
pages | string[] |
expectations | Object |
lighthouseParams | Object|undefined |
failOnUnmetExpectation | boolean |
The pages
property specifies a set of URLs to inspect with Lighthouse. At least one URL must be specified.
The expectations
property specifies the expected score for certain Lighthouse categories and audits.
The expected score for categories must be a number. The expected score for audits must be a number or a boolean.
The categories and audits declared in the expectations
object will be used to tell Lighthouse which categories and audits to test, by implicitly setting Lighthouse's configuration settings.onlyCategories
and settings.onlyAudits
(see Lighthouse settings property documentation).
Name | Type | Description |
---|---|---|
categories | Object |
An object where the key is the category id (as defined by the Lighthouse categories configuration), and the value is the expected score for that category. |
audits | Object |
An object where the key is the audit name (as defined by the Ligthouse audits configuration), and the value is the expected score for the audit. |
The lighthouseParams
property specifies the flags and configuration for Lighthouse.
Name | Type | Description |
---|---|---|
config | Object |
A Lighthouse configuration object as specified in the Lightouse configuration file documentation. If settings.onlyCategories or settings.onlyAudits are set, the implicit configuration of these properties derived from the expectations object will be overriden. |
flags | Object |
An object containing Lighthouse flags, as specified in the Lighthouse CLI options. |
The failOnUnmetExpectation
property indicates whether the program will return with an error code when an expectation is unmet. Defaults to false
.