Codelab: Auditing with Lighthouse
How do I tell if all of my Progressive Web App (PWA) features are in order? Lighthouse is an open-source tool from Google that audits a web app for PWA features. It provides a set of metrics to help guide you in building a PWA with a full application-like experience for your users.
Lighthouse tests if your app:
- Can load in offline or flaky network conditions
- Is relatively fast
- Is served from a secure origin
- Uses certain accessibility best practices
Lighthouse is available as a Chrome extension for Chrome 52 (and later) and a command line tool.
Running Lighthouse as a Chrome extension
Download the Lighthouse Chrome extension from the Chrome Web Store.
When installed it places an icon in your taskbar.
Run Lighthouse on your application by selecting the icon and choosing Generate report (with your app open in the browser page).
Lighthouse generates an HTML page with the results. An example page is shown below.
Running Lighthouse from the command line
If you want to run Lighthouse from the command line (for example, to integrate it with a build process) it is available as a Node module.
You can download Node from nodejs.org (select the version that best suits your environment and operating system).
To install Lighthouse's Node module from the command line, use the following command:
npm install -g lighthouse
This installs the tool globally. You can then run Lighthouse from the command line (where https://airhorner.com/ is your app):
You can check Lighthouse flags and options with the following command: