Skip to content

optimized-images calculation incorrect for cached images #12465

@Janpot

Description

@Janpot

EDIT (paul dec 2021): the first part of this thread is working-as-intended but the real bug emerges here: #12465 (comment)


Provide the steps to reproduce

Running

const puppeteer = require('puppeteer');
const lighthouse = require('lighthouse');

async function run() {
  const browser = await puppeteer.launch({
    headless: false,
    defaultViewport: null,
  });

  await lighthouse('https://www.example.com/', {
    port: (new URL(browser.wsEndpoint())).port,
    output: 'json',
    logLevel: 'info',
  }, {
    passes: [{
      passName: 'defaultPass',
      // useThrottling: true,
      recordTrace: true,
      gatherers: [
        'viewport-dimensions',
        'dobetterweb/optimized-images',
        'image-elements'
      ]
    }],
    audits: [
      'byte-efficiency/uses-responsive-images'
    ]
  });

  await browser.close()
}

run()

What is the current behavior?

Observing the logs, I only see

  status Cleaning browser cache +4ms

if I uncomment // useThrottling: true,

What is the expected behavior?

Lighthouse cleans browser cache, even if throttling is not enabled on a pass. The code that causes this is here:

disableStorageReset: !passConfig.useThrottling,

Environment Information

  • Lighthouse version: 7.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions