Node 22 (LTS) or later is required. Some CLI flags are not available in the Node API — pass configuration directly as the third argument instead.
lighthouse(url, flags, config, page)
The default export. Runs a full navigation audit against a URL and returns a RunnerResult.
Parameters
The URL to audit. Optional when running in
auditMode.Runtime flags that override config settings. Common flags include
port, output, onlyCategories, and logLevel. See Configuration reference for the full list.A Lighthouse config object. If omitted, the default config (
lighthouse:default) is used. See Configuration reference.An existing Puppeteer
Page instance. If provided, Lighthouse uses it directly instead of connecting via the port flag.Return value
ReturnsPromise<LH.RunnerResult | undefined>.
The Lighthouse Result object. See Understanding results.
The formatted report string (HTML, JSON, or CSV). When multiple output formats are requested this is an array.
Raw artifacts collected during the run.
startFlow(page, options)
Creates a UserFlow instance to record multiple steps (navigations, timespans, snapshots) in sequence, then generate a single combined flow report.
Parameters
| Parameter | Type | Description |
|---|---|---|
page | Puppeteer.Page | Required. A Puppeteer page instance. |
options | LH.UserFlow.Options | Optional. May include name (string) for the flow report title and a base config. |
Return value
ReturnsPromise<UserFlow>. The UserFlow instance exposes .navigate(), .startTimespan(), .endTimespan(), .snapshot(), and .generateReport().
navigation(page, requestor, options)
Performs a single navigation-based audit. This is the function lighthouse() calls internally.
Parameters
| Parameter | Type | Description |
|---|---|---|
page | Puppeteer.Page | undefined | Puppeteer page to use. |
requestor | LH.NavigationRequestor | undefined | URL string or a function that triggers navigation. |
options | {config?, flags?} | Optional config and flags. |
Return value
ReturnsPromise<LH.RunnerResult | undefined>.
startTimespan(page, options)
Begins a timespan audit that records user interactions between startTimespan and endTimespan. Use this to measure the performance impact of a specific interaction.
Parameters
| Parameter | Type | Description |
|---|---|---|
page | Puppeteer.Page | The page to instrument. |
options | {config?, flags?} | Optional config and flags. |
Return value
ReturnsPromise<{endTimespan: () => Promise<LH.RunnerResult | undefined>}>.
snapshot(page, options)
Audits the current state of the page without navigating. Useful for auditing the state of a single-page application after user interaction.
Parameters
| Parameter | Type | Description |
|---|---|---|
page | Puppeteer.Page | The page to snapshot. |
options | {config?, flags?} | Optional config and flags. |
Return value
ReturnsPromise<LH.RunnerResult | undefined>.
generateReport(result, format)
Converts a Lighthouse result or flow result object to a formatted report string.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
result | LH.Result | LH.FlowResult | — | The result object to format. |
format | 'html' | 'json' | 'csv' | 'html' | Output format. 'csv' is not supported for LH.FlowResult. |
Return value
Returnsstring.
auditFlowArtifacts(flowArtifacts, config)
Re-audits previously collected flow artifacts against an optional config. Useful when you want to change scoring or audits without re-running the browser.
Parameters
| Parameter | Type | Description |
|---|---|---|
flowArtifacts | LH.UserFlow.FlowArtifacts | Artifacts from a previous flow run. Includes gatherSteps and name. |
config | LH.Config | Optional config to apply during the audit phase. |
Return value
ReturnsPromise<LH.FlowResult>.
getAuditList()
Returns an array of all available built-in audit IDs.
Return value
Returnsstring[].
Base classes
Audit
The base class for all Lighthouse audits. Extend this to create custom audits.
Gatherer
The base class for all Lighthouse gatherers. Extend this to collect custom artifacts.
Computed artifact
NetworkRecords
A computed artifact that parses devtools log entries into structured network request objects. Useful when writing custom audits that need network data.
Built-in configs
| Export | Description |
|---|---|
defaultConfig | The standard Lighthouse config. Equivalent to lighthouse:default. |
desktopConfig | Desktop preset config. Disables mobile emulation and uses desktop throttling. |