/lighthouse-ci

A useful wrapper around Google Lighthouse CLI

Primary LanguageJavaScriptMIT LicenseMIT

Lighthouse CI

All Contributors npm version npm Known Vulnerabilities Commitizen friendly XO code style

A useful wrapper around Google Lighthouse CLI

Lighthouse CI logo

Install

$ npm install -g lighthouse-ci

Table of Contents

Usage

lighthouse-ci --help

CLI

$ lighthouse-ci --help

  Usage
    $ lighthouse-ci <target-url>

  Example
    $ lighthouse-ci https://example.com/
    $ lighthouse-ci -s https://example.com/
    $ lighthouse-ci https://example.com/ --score=75
    $ lighthouse-ci https://example.com/ --accessibility=90 --seo=80

  Options
    --report=<path>               Generate an HTML report inside a specified folder
    -s, --silent                  Run Lighthouse without printing report log.
    --score=<threshold>           Specify a score threshold for the CI to pass.
    --performance=<threshold>     Specify a minimal performance score for the CI to pass.
    --pwa=<threshold>             Specify a minimal pwa score for the CI to pass.
    --accessibility=<threshold>   Specify a minimal accessibility score for the CI to pass.
    --best-practice=<threshold>   [DEPRECATED] Use best-practices instead.
    --best-practices=<threshold>  Specify a minimal best-practice score for the CI to pass.
    --seo=<threshold>             Specify a minimal seo score for the CI to pass.

Lighthouse flags

In addition to listed lighthouse-ci configuration flags, it is also possible to pass any native lighthouse flags.

To see the full list of available flags, please refer to the official Google Lighthouse documentation.

eg.

# Launches browser, collects artifacts, saves them to disk (in `./test-report/`) and quits
$ lighthouse-ci --gather-mode=test-report https://my.website.com
# skips browser interaction, loads artifacts from disk (in `./test-report/`), runs audits on them, generates report
$ lighthouse-ci --audit-mode=test-report https://my.website.com

Chrome flags

In addition of the lighthouse flags, you can also specify extra chrome flags comma separated.

eg.

$ lighthouse-ci --chrome-flags=--cellular-only,--force-ui-direction=rtl https://my.website.com

eg.

$ lighthouse-ci --emulated-form-factor desktop --seo 92 https://my.website.com

Contributors

Thanks goes to these wonderful people (emoji key):


Andrea Sonny

💬 💻 📖

Celso Santa Rosa

💻

Ben Hammond

🐛 💻

Alex Tenepere

🐛 💻

Connor Markwell

🐛 💻

Michael Griffiths

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT


Created with 🦄 by andreasonny83