Lighthouse is an amazing tool to audit your app for performance, accessibility, progressive web apps, SEO and more. Overral, it works pretty well, but when it comes to assessing the performance of an app, there is an inherent variability factor we should expect.
On its Lighthouse Metric Variability and Accuracy, the Lighthouse team describes this problem in more depth, explaining the sources, the impact and how can it be mitigated.
This repository intends to mitigate the variability factor by consecutively running the lighthouse performance audit n-times and averaging the results on the created reports.
The project consists of two Node JS scripts (generate-reports.js
and
parse-reports.js
). To use them, you need Node 10+. The generate-reports
will
run the lighthouse script n-times and put the reports on a directory. The
parse-reports
will read the reports generated by the former script on a
certain directory and generate the average performance metrics.
At the top of each script, there are variables you should customize to use them. To run the scripts, you can do:
chmod +x generate-reports.js # give the file permission to be executed
chmod +x parse-reports.js
APP_URL="my-custom-url" ./generate-reports.js
APP_URL="my-custom-url" ./parse-reports.js
- Lighthouse Report Viewer, drop a json report and see it in a more human-readable format.
- Lighthouse Metric Variability and Accuracy
- The Magic of Running Multiple Lighthouse Performance Tests on macOS, the first script was based on this article.