1.0.6-alpha • Published 6 years ago

lighthouse-thresholds v1.0.6-alpha

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

lighthouse-thresholds

This package runs Google Lighthouse and compares the scores against predetermined thresholds defined an a .lighthouserc config file.

Usage

Create a .lighthouserc file in your project root (see the example file here).

Run lighthouse-thresholds to run Google Lighthouse against your defined URLs and either pass or fail them when comparing with the set thresholds.

Note that there will need to be a locally installed version of chrome (or chromium), for this package to work.

Config options

ParamTypeMeaning
urlStringA full url to run Google Lighthouse against
thresholdsObjectAn object containing the predetermined thresholds
thresholds.performanceNumberA threshold for the page's performance score
thresholds.seoNumberA threshold for the page's performance score
thresholds.progressiveNumberA threshold for the page's progressive/offline score
thresholds.a11yNumberA threshold for the page's accessibility score
thresholds.bestPracticeNumberA threshold for the page's best practice score

Example .lighthouserc file

[
  {
    "url": "https://google.com/",
    "thresholds": {
      "performance": 90.25,
      "seo": 90.25,
      "progressive": 90.25,
      "a11y": 90.25,
      "bestPractice": 90.25
    }
  }
]

Note that this file can also be .lighthouserc.js, in which case it must be in the form:

module.exports = { ...config }