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

report(util): ✅ audits should be in Passed Audits #5963

Merged
merged 4 commits into from
Sep 8, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions lighthouse-core/report/html/renderer/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,7 @@ class Util {
case 'numeric':
case 'binary':
default:
// Numeric audits that are within PASS_THRESHOLD will still show up with failing.
// For opportunities, we want to have them show up with other failing for contrast.
// For diagnostics, we sort by score so they'll be lowest priority.
return Number(audit.score) === 1;
return Number(audit.score) >= RATINGS.PASS.minScore;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ describe('PerfCategoryRenderer', () => {
const diagnosticSection = categoryDOM.querySelectorAll('.lh-category > .lh-audit-group')[2];

const diagnosticAudits = category.auditRefs.filter(audit => audit.group === 'diagnostics' &&
audit.result.score !== 1 && audit.result.scoreDisplayMode !== 'not-applicable');
audit.result.score < Util.PASS_THRESHOLD &&
Copy link
Member

Choose a reason for hiding this comment

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

@paulirish was there a historical reason for this not just being !Util.showAsPassed(audit.result)?

Copy link
Member

Choose a reason for hiding this comment

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

nope. that sounds great.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Sorted in 6a1715a.

audit.result.scoreDisplayMode !== 'not-applicable');
Copy link
Member

Choose a reason for hiding this comment

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

oh, sorry, should have put the comment below this line. showAsPassed() includes the not-applicable check :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's my bad; I should have noticed the check showAsPassed. 👍 Fixed in latest commit.

const diagnosticElements = diagnosticSection.querySelectorAll('.lh-audit');
assert.equal(diagnosticElements.length, diagnosticAudits.length);
});
Expand All @@ -151,7 +152,8 @@ describe('PerfCategoryRenderer', () => {

const passedAudits = category.auditRefs.filter(audit =>
audit.group && audit.group !== 'metrics' &&
(audit.result.score === 1 || audit.result.scoreDisplayMode === 'not-applicable'));
(audit.result.score >= Util.PASS_THRESHOLD ||
audit.result.scoreDisplayMode === 'not-applicable'));
const passedElements = passedSection.querySelectorAll('.lh-audit');
assert.equal(passedElements.length, passedAudits.length);
});
Expand Down