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
string
The URL to audit. Optional when running in
auditMode.object
default:"{}"
Runtime flags that override config settings. Common flags include
port, output, onlyCategories, and logLevel. See Configuration reference for the full list.object
A Lighthouse config object. If omitted, the default config (
lighthouse:default) is used. See Configuration reference.Puppeteer.Page
An existing Puppeteer
Page instance. If provided, Lighthouse uses it directly instead of connecting via the port flag.Return value
ReturnsPromise<LH.RunnerResult | undefined>.
object
required
The Lighthouse Result object. See Understanding results.
string | string[]
required
The formatted report string (HTML, JSON, or CSV). When multiple output formats are requested this is an array.
object
required
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
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
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
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
Return value
ReturnsPromise<LH.RunnerResult | undefined>.
generateReport(result, format)
Converts a Lighthouse result or flow result object to a formatted report string.
Parameters
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
Return value
ReturnsPromise<LH.FlowResult>.
getAuditList()
Returns an array of all available built-in audit IDs.
Return value
Returnsstring[].