GoogleChrome / GoogleChrome/lighthouse
optimized-images calculation incorrect for cached images
- Dominant language
- JavaScript
- Stars
- 30.8k
- Forks
- 9.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 19
Description
**_EDIT (paul dec 2021)_**: the first part of this thread is working-as-intended but the real bug emerges here: https://github.com/GoogleChrome/lighthouse/issues/12465#issuecomment-852896577
--------
#### Provide the steps to reproduce
Running
```ts
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: https://github.com/GoogleChrome/lighthouse/blob/145e24c7026c7ce000ebd4552b85774f8520c42e/lighthouse-core/gather/gather-runner.js#L758
#### Environment Information
* Lighthouse version: 7.4.0
Contributor guide
Assessment
This issue has not been assessed yet.