Description
FAQ
- Yes, my issue is not about variability or throttling.
- Yes, my issue is not about a specific accessibility audit (file with axe-core instead).
URL
What happened?
Setting onlyAudits
, onlyCategories
, and skipAudits
to an empty array []
rather than null
results in incomplete LHR JSON.
What was missing
lhr.categories
returns{}
- Unsure of any other omissions.
Repro script
import puppeteer from 'puppeteer'
import lighthouse from 'lighthouse'
import { writeFile } from 'node:fs'
const url = 'https://chromestatus.com/features'
// Use Puppeteer to launch headful Chrome and don't use its default 800x600 viewport.
const browser = await puppeteer.launch({
headless: false,
defaultViewport: null,
ignoreDefaultArgs: ['--enable-automation']
})
const page = await browser.newPage()
const flags = { logLevel: 'debug' }
const config = {
extends: 'lighthouse:default',
settings: {
skipAudits: [],
onlyCategories: [],
onlyAudits: []
}
}
// Lighthouse will open the URL.
const { lhr } = await lighthouse(url, flags, config, page)
const data = new Uint8Array(Buffer.from(JSON.stringify(lhr)))
writeFile('lhr.json', data, err => {
if (err) throw err
})
console.log(lhr.categories)
await browser.close()
What did you expect?
Expected lhr.categories
to include category information.
What have you tried?
Setting to null
rather than an []
results in a full LHR.
How were you running Lighthouse?
node
Lighthouse Version
10.1.0
Chrome Version
112.0.5615.121
Node Version
18.7.X
OS
Mac
Relevant log output
No response