-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
report: show overall category scores in csv output #11404
report: show overall category scores in csv output #11404
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
9f97082
to
0de16b2
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @pujitha7 this is great!
const overallCategoryScore = category.score === null ? -1 : category.score; | ||
rows.push(rowFormatter([lhr.requestedUrl, lhr.finalUrl, category.title, | ||
'overall-category-score', 'Overall Category Score', 'numeric', overallCategoryScore])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about including the category in these column values? something like the below
const overallCategoryScore = category.score === null ? -1 : category.score; | |
rows.push(rowFormatter([lhr.requestedUrl, lhr.finalUrl, category.title, | |
'overall-category-score', 'Overall Category Score', 'numeric', overallCategoryScore])); | |
const table = Object.keys(lhr.categories).map(categoryId => { | |
const rows = []; | |
const category = lhr.categories[categoryId]; | |
const overallCategoryScore = category.score === null ? -1 : category.score; | |
rows.push(rowFormatter([lhr.requestedUrl, lhr.finalUrl, category.title, | |
'${categoryId}-score', `${category.title} Category Score`, 'numeric', overallCategoryScore])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it would be more readable. I will make these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, no we definitely don't need to iterate both. GitHub wouldn't allow a multi-line suggestion so this would absolutely replace the Object.values
iteration (we pull in the value with const category = lhr.categories[categoryId];
here anyway).
Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it made sense a little later so deleted the comment. I modified the code. Please review
@@ -104,7 +104,7 @@ describe('ReportGenerator', () => { | |||
expect(lines.length).toBeGreaterThan(100); | |||
expect(lines.slice(0, 2).join('\n')).toMatchInlineSnapshot(` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use the first 3 lines now to test both category and audit lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside from the test fix, thanks @pujitha7!
csvOutput.includes('performance-score'); | ||
csvOutput.includes('accessibility-score'); | ||
csvOutput.includes('best-practices-score'); | ||
csvOutput.includes('seo-score'); | ||
csvOutput.includes('pwa-score'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
csvOutput.includes('performance-score'); | |
csvOutput.includes('accessibility-score'); | |
csvOutput.includes('best-practices-score'); | |
csvOutput.includes('seo-score'); | |
csvOutput.includes('pwa-score'); | |
expect(csvOutput).toContain('performance-score'); | |
expect(csvOutput).toContain('accessibility-score'); | |
expect(csvOutput).toContain('best-practices-score'); | |
expect(csvOutput).toContain('seo-score'); | |
expect(csvOutput).toContain('pwa-score'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently it's not actually asserting :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah i missed that
1d6adb0
to
be86c07
Compare
be86c07
to
23c1209
Compare
23c1209
to
23d7519
Compare
thanks @pujitha7! 🎉 great job here :) |
closes #11398
Summary
Added one row each for category to show
overall category score
in the output CSV report