Test a Lighthouse performance budget with a deliberate regression
Both variants serve the same checkout page on the same loopback route. The clean page renders immediately. The regressed page runs a four-second, synchronous script in the document head before rendering the checkout content. The acceptance rule is a median mobile performance score of at least 90 across three runs of each variant.
Run the fixture
Use Node.js 24, Chrome or Chromium, and a writable temporary directory. Download the fixture runner into a clean directory and run:
npm install --no-save --package-lock=false lighthouse@13.6.0
LIGHTHOUSE_BIN="$PWD/node_modules/.bin/lighthouse" node budget-pair.mjs
Set CHROME_PATH to the browser executable if Chrome discovery needs it. The runner creates a loopback HTTP server, launches a fresh mobile Lighthouse audit for each capture and saves the raw JSON to the temporary directory printed at startup. It checks the Lighthouse version in each report. A passing fixture run requires both the clean median to meet the budget and the delayed median to miss it. CPU and browser differences can change the individual values.
Inspect the recorded run
This run used Node.js 24.22.3, Lighthouse 13.6.0 and HeadlessChrome 156.0.0.0 on Linux. The fixture uses default mobile simulated throttling and captures only the performance category. The raw audited URL points at the temporary loopback server.
| Variant | Mobile scores | Median | Budget of 90 |
|---|---|---|---|
| Clean | 100, 100, 100 | 100 | Pass |
| Render delayed | 56, 56, 56 | 56 | Fail |
Recorded summary · Six full Lighthouse reports · Lighthouse performance scoring
To independently recompute the medians without launching Chrome, run the following in the directory containing the downloaded report archive.
python3 - <<'PY'
import json
import statistics
import tarfile
with tarfile.open("budget-reports.tar.gz", "r:gz") as archive:
for case in ("clean", "regressed"):
scores = []
for run in (1, 2, 3):
report = json.load(archive.extractfile(f"{case}-{run}.json"))
assert report["lighthouseVersion"] == "13.6.0"
assert report["configSettings"]["formFactor"] == "mobile"
scores.append(round(report["categories"]["performance"]["score"] * 100))
median = statistics.median(scores)
print(case, scores, median, "pass" if median >= 90 else "fail")
PY
Read as Markdown ↗