The Lighthouse Node module gives you full programmatic control over audits. Use it to integrate Lighthouse into build scripts, test suites, or custom reporting pipelines.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GoogleChrome/lighthouse/llms.txt
Use this file to discover all available pages before exploring further.
Chrome must be installed on the machine running Lighthouse. The
chrome-launcher package handles launching and connecting to it automatically.Write your first script
The following example launches a headless Chrome instance, runs a Lighthouse audit, saves an HTML report, and prints the performance score.Run it with:
audit.js
Access the report and result object
The
Access category scores and individual audit results directly from
lighthouse() function returns a RunnerResult with two key properties:| Property | Type | Description |
|---|---|---|
.report | string | The report as an HTML, JSON, or CSV string, depending on the output option |
.lhr | object | The full Lighthouse Result (LHR) object with all audit data, scores, and metrics |
.lhr:Configuration
Pass a config object as the third argument tolighthouse() to customize audits beyond what flags allow:
lighthouse:default to build on the standard configuration, or omit it to start from scratch.
See Configuration overview for all available options, and Node API reference for the full API surface.