how to avoid Reached gathering budget of 5s warning in lighthouse

36 Views Asked by At

how to avoid this warning in lighthouse:

enter image description here LH:artifacts:getArtifact ImageElements +35ms LH:ImageElements:warn Reached gathering budget of 5s. Skipped extra details for 281/314 +6s

and I have following code for generating lighthouse audit report:

async function runLighthouse(url, outputPath, iterations) {
    const chrome = await chromeLauncher.launch({ chromeFlags: ["--headless"] });

    for (let i = 0; i < iterations; i++) {
        const options = {
            // disableStorageReset: true, // Disable clearing the browser storage between runs
            logLevel: "info",
            output: "json",
            port: chrome.port,
            throttling: {
                method: "devtools",
                devtools: {
                    networkThrottling: {
                        downloadThroughputKbps: 1000,
                    },
                    cpuThrottling: 4, // Simulate slower CPU for more consistent results
                },
            },
            emulatedFormFactor: 'desktop',
        };
        const runnerResult = await lighthouse(url, options);

        const filename = `${outputPath}/${i + 1}.json`;
        const reportJson = runnerResult.report;
        fs.writeFileSync(filename, reportJson);
        console.log(`Lighthouse report saved to ${filename}`);
    }

    await chrome.kill();
}
0

There are 0 best solutions below