Skip to content

Instantly share code, notes, and snippets.

@cheshirecode
Created August 6, 2022 08:24
Show Gist options
  • Save cheshirecode/22a9ccdbfc0b150422c4557083ab055c to your computer and use it in GitHub Desktop.
Save cheshirecode/22a9ccdbfc0b150422c4557083ab055c to your computer and use it in GitHub Desktop.
use lighthouse ci to generate report manually
// current timeout issue https://github.com/GoogleChrome/lighthouse-ci/issues/475
module.exports = {
ci: {
collect: {
numberOfRuns: 1,
isSinglePageApplication: true,
settings: {
chromeFlags:
'--no-sandbox --disable-gpu --disable-dev-shm-usage --ignore-certificate-errors',
disableStorageReset: true,
formFactor: 'desktop',
screenEmulation: {
mobile: false,
width: 800,
height: 600,
deviceScaleFactor: 1,
disabled: false
},
throttlingMethod: 'simulate',
throttling: {
rttMs: 0,
throughputKbps: 0,
requestLatencyMs: 0,
downloadThroughputKbps: 0,
uploadThroughputKbps: 0,
cpuSlowdownMultiplier: 1
},
maxWaitForLoad: 90 * 1000,
maxWaitForFcp: 90 * 1000,
onlyCategories: ['performance']
}
},
assert: {
preset: 'lighthouse:no-pwa'
},
upload: {
target: 'filesystem',
reportFilenamePattern: 'index.%%EXTENSION%%'
}
}
};
#!/usr/bin/env bash
OUTPUT_PATH=./out/
npm i @lhci/cli --no-save
node_modules/.bin/lhci healthcheck
node_modules/.bin/lhci collect \
--config=./lighthouserc.js \
--staticDistDir=$(OUTPUT_PATH) \
|| echo "LHCI failed!"
node_modules/.bin/lhci upload \
--config=./lighthouserc.js \
--outputDir=$(OUTPUT_PATH)/lhci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment