0.3.1 • Published 5 years ago
lighthouse-compare v0.3.1
lighthouse-compare
Note: This is the pre-alpha version. Please contact me to get the API token if you want to use and help improve this service :slightly_smiling_face:.
Feature
What is Lighthouse?
Lighthouse is a tool built and open sourced by Google, which is to improve the quality of web apps.
Lighthouse Compare?
The goal of Ligthouse Compare is to monitor and keep web app’s quality by running Lighthouse in CI and compare reports so that developers can see how a particular changeset influenced the score or any of the audits.
Installation
$ npm install lighthouse-compare lighthouse --save
Usage
- Use lighthouse-compare in your test script
// test.js
const cp = require('child_process');
const compare = require('lighthouse-compare');
// build and start to serve locally
cp.execSync('yarn build', { stdio: 'inherit' });
const proc = cp.spawn('yarn', ['serve']);
// run lighthouse analysing
compare.run({ url: 'http://localhost:5001' });
- Run script in CI
A
.travis.yml
example:
# need following config for running chrome
sudo: required
dist: trusty
# other config
# run your test script
script: node ./test.js
# add chrome addon to run lighthouse
addons:
chrome: stable
You should be able to see the report link in the CI logs.
Click into the link and you can see the report (example).
TODO
- Wrap the service with Github App
- Comment in Pull Request (score and audits diff)
- Cli tool