Setting `onlyAudits`, `onlyCategories` and `skipAudits` to `[]` returns unexpected LHR · Issue #14986 · GoogleChrome/lighthouse · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Setting onlyAudits, onlyCategories and skipAudits to [] returns unexpected LHR #14986

Open
@benschwarz

Description

@benschwarz

FAQ

URL

https://example.com

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      TMZ Celebrity News – Breaking Stories, Videos & Gossip

      Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

      Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

      🎥 Watch TMZ Live

      TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.