ci(lighthouse): stop lhci reading the form factor as a CLI flag

lhci treats every LHCI_* environment variable as a command-line option, so
LHCI_PRESET=mobile reached `lhci assert` as an invalid --preset and failed
both jobs after the audits had run. Use LIGHTHOUSE_FORM_FACTOR instead.

Also upload the reports: upload-artifact v4+ skips dot-directories such as
.lighthouseci unless include-hidden-files is set.
This commit is contained in:
Josh Creek
2026-09-14 21:19:20 +01:00
parent 5d41462d35
commit 7603116369
3 changed files with 12 additions and 7 deletions
+5 -3
View File
@@ -1,8 +1,10 @@
// Lighthouse CI: `npm run test:lighthouse` builds the Node adapter output, serves it and audits the
// public pages. Any category below 90 fails the run (and so the PR).
// Set LHCI_PRESET=desktop to audit with the desktop profile; the default is Lighthouse's mobile
// profile (slow 4G + CPU throttling), which is the stricter of the two.
const preset = process.env.LHCI_PRESET === 'desktop' ? 'desktop' : undefined;
// Set LIGHTHOUSE_FORM_FACTOR=desktop to audit with the desktop profile; the default is Lighthouse's
// mobile profile (slow 4G + CPU throttling), which is the stricter of the two. The variable must not
// start with LHCI_: lhci treats those as CLI flags, so LHCI_PRESET was passed to `lhci assert` as
// an invalid `--preset`.
const preset = process.env.LIGHTHOUSE_FORM_FACTOR === 'desktop' ? 'desktop' : undefined;
module.exports = {
ci: {