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

core(config): add category weight to perf config #3529

Merged
merged 3 commits into from
Oct 11, 2017

Conversation

stevector
Copy link
Contributor

I noticed that when running the Lighthouse with the --perf flag, the top level score value in the generated json report is 0 even when the score of the performance category is higher than 0. I expected these values to be the same when performance is the only category being evaluated.

This pull request simply adds default weights to performance, accessibility, and best-practices. pwa already had a weight.

Here's one way I tested this change.

git checkout master
/lighthouse-cli/index.js --chrome-flags="--headless --disable-gpu" https://www.github.com --perf  --output=json   --output-path=report.json  && cat report.json | jq '{TopLevelScore:  .score, PerfScore: .reportCategories[].score}'
{
  "TopLevelScore": 0,
  "PerfScore": 75.94117647058823
}

git checkout default-weight-value
./lighthouse-cli/index.js --chrome-flags="--headless --disable-gpu" https://www.github.com --perf  --output=json   --output-path=report.json  && cat report.json | jq '{TopLevelScore:  .score, PerfScore: .reportCategories[].score}'
{
  "TopLevelScore": 79.94117647058823,
  "PerfScore": 79.94117647058823
}

I encountered this problem when I was walking through https://github.com/ebidel/lighthouse-ci from @ebidel which relies on the top level score value of the json report generated by lighthouse.

@stevector stevector changed the title Adding weight to categories core: Adding weight to categories Oct 11, 2017
@patrickhulce
Copy link
Collaborator

thanks for the contribution @stevector! good point about the --perf flag usage. For context, the PWA category was the only category with a score originally to maintain parity with Lighthouse 1.x that used the PWA audits as the toplevel score. It does make sense to have performance be the toplevel score of the perf config though.

How would you feel about just updating config/perf.json to have the performance category weight: 1 for now?

cc @vinamratasingal to potentially prioritize top-level score use cases and exploration later on

@stevector
Copy link
Contributor Author

Thanks for the background info @patrickhulce! I hadn't thought about 1.x vs. 2.x as a factor. I'll push that change.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome thanks for fixing this! 🎉 💯

@patrickhulce patrickhulce changed the title core: Adding weight to categories core(config): add category weight to perf config Oct 11, 2017
@patrickhulce patrickhulce merged commit 6af2eb1 into GoogleChrome:master Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants