Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luke-j/lighthouse-thresholds
A utility to to run Google Lighthouse against score budgets
https://github.com/luke-j/lighthouse-thresholds
Last synced: 3 months ago
JSON representation
A utility to to run Google Lighthouse against score budgets
- Host: GitHub
- URL: https://github.com/luke-j/lighthouse-thresholds
- Owner: luke-j
- License: mit
- Created: 2018-05-10T01:55:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-06T08:43:37.000Z (over 6 years ago)
- Last Synced: 2024-07-18T15:30:29.784Z (4 months ago)
- Language: JavaScript
- Size: 85.9 KB
- Stars: 70
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lighthouse-thresholds
This package runs [Google Lighthouse](https://github.com/GoogleChrome/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](#example-lighthouserc-file)).
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
| Param | Type | Meaning |
| ------------------------- | -------- | ---------------------------------------------------- |
| `url` | _String_ | A full url to run Google Lighthouse against |
| `thresholds` | _Object_ | An object containing the predetermined thresholds |
| `thresholds.performance` | _Number_ | A threshold for the page's performance score |
| `thresholds.seo` | _Number_ | A threshold for the page's performance score |
| `thresholds.progressive` | _Number_ | A threshold for the page's progressive/offline score |
| `thresholds.a11y` | _Number_ | A threshold for the page's accessibility score |
| `thresholds.bestPractice` | _Number_ | A threshold for the page's best practice score |## Example `.lighthouserc` file
```json
[
{
"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:
```js
module.exports = { ...config }
```