Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency in the test result using lighthouse programatically vs in devtool #16278

Closed
3 tasks done
amrsa1 opened this issue Dec 6, 2024 · 2 comments
Closed
3 tasks done

Comments

@amrsa1
Copy link

amrsa1 commented Dec 6, 2024

FAQ

URL

any

What happened?

i was experimenting the lighthouse library and checking the html report against a url, but when i run the analysis from lighthouse in devtool im getting complete different results, which make one of the results is unreliable not sure now which one is supposed to be the accurate one.

result from library
Screenshot 2024-12-06 at 22 49 20

result from lighthouse in devtool
Screenshot 2024-12-06 at 22 51 25

What did you expect?

same results are close results

import fs from "fs";
import lighthouse from "lighthouse";
import * as chromeLauncher from "chrome-launcher";

const chrome = await chromeLauncher.launch({ chromeFlags: ["--headless"] });
const runnerResult = await lighthouse(
  "example",
  {
    logLevel: "error",
    output: "html",
    onlyCategories: ["performance", "accessibility", "best-practices",],
    formFactor: "desktop",
    port: chrome.port,
    screenEmulation: {
      disabled: true,
    },
  }
);

// `.report` is the HTML report as a string
const reportHtml = runnerResult.report;
fs.writeFileSync("lhreport.html", reportHtml);

// `.lhr` is the Lighthouse Result as a JS object
console.log("Report is done for", runnerResult.lhr.finalDisplayedUrl);
console.log(
  "Performance score was",
  runnerResult.lhr.categories.performance.score * 100
);

chrome.kill();

What have you tried?

No response

How were you running Lighthouse?

node

Lighthouse Version

12.2.2

Chrome Version

Chromium: 131.0.6778.108

Node Version

22

OS

No response

Relevant log output

No response

@adamraine
Copy link
Member

Please see our variability docs: https://github.com/GoogleChrome/lighthouse/blob/main/docs/variability.md

@amrsa1
Copy link
Author

amrsa1 commented Dec 9, 2024

Hmm doesnt make sense as im testing against same server results using library are similar after multiple run to each others

And results from dev tools are similar.

But node library results are not even close to devtool results, we are speaking about 50% variation in result which make the results unreliable which one is the true one ?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants