Back to Lighthouse

Basic Custom Audit Recipe

docs/recipes/custom-audit/readme.md

13.2.01.5 KB
Original Source

Basic Custom Audit Recipe

Tip: see Lighthouse Architecture for information on terminology and architecture.

What this example does

This example shows how to write a custom Lighthouse audit that measures memory usage using the Chrome DevTools Protocol Memory.startSampling command. The audit fails if any memory sample exceeds 1 MB.

The Audit, Gatherer, and Config

Note: when extending the default configuration file, all arrays will be concatenated and primitive values will override the defaults.

Run the configuration

Run Lighthouse with the custom audit by using the --config-path flag with your configuration file:

sh
lighthouse --config-path=custom-config.js https://example.com