39 / 95 · 05 Performance & Chaos Engineering · Lighthouse CI: Enforcing Frontend Performance Budgets← prev⊞ allnext →☰ Read as one page
7.3Lighthouse CI Configuration
The core configuration lives in a lighthouserc.json file at the root of your project:
{
"ci": {
"collect": {
"url": [
"https://staging.example.com/",
"https://staging.example.com/products/1",
"https://staging.example.com/checkout"
],
"numberOfRuns": 3,
"settings": {
"chromeFlags": "--no-sandbox --headless",
"throttling": {
"cpuSlowdownMultiplier": 4,
"downloadThroughputKbps": 1600,
"uploadThroughputKbps": 768,
"rttMs": 150
}
}
},
"assert": {
"assertions": {
"categories:performance": ["error", { "minScore": 0.9 }],
"categories:accessibility": ["error", { "minScore": 0.95 }],
"first-contentful-paint": ["error", { "maxNumericValue": 1800 }],
"largest-contentful-paint": ["error", { "maxNumericValue": 2500 }],
"cumulative-layout-shift": ["error", { "maxNumericValue": 0.1 }],
"interactive": ["error", { "maxNumericValue": 3800 }],
"total-blocking-time": ["warn", { "maxNumericValue": 300 }],
"speed-index": ["warn", { "maxNumericValue": 3400 }]
}
},
"upload": {
"target": "lhci",
"serverBaseUrl": "https://lhci.internal.example.com"
}
}
}
Configuration Breakdown
collect: Defines what to measure.
url: List of pages to audit. Always include your most critical user journeys.numberOfRuns: Run each URL multiple times. Lighthouse CI reports the median, which reduces variance from network jitter.settings.throttling: Simulate realistic network conditions. The default simulates a mid-tier mobile device on a 4G connection.
assert: Defines what must pass.
"error"level assertions fail the pipeline."warn"level assertions produce warnings but do not block deployment.- Assertions can target category scores (0-1 scale) or specific metrics (milliseconds).
upload: Optional -- stores results for historical comparison.