-
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
remove explicit required generateAuditResult() call #1857
Conversation
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.
This is awesome! Thanks for the cleanup.
error?: boolean; | ||
description: string; | ||
name: string; | ||
category: string; | ||
helpText?: string; | ||
requiredArtifacts?: Array<string>; |
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.
wait, no longer needed?
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.
this is for the AuditResult
, not Audit
. I'm not sure why requiredArtifacts
was on this in the first place
lighthouse-core/audits/audit.js
Outdated
* @param {!AuditResultInput} result | ||
* @return {!AuditResult} | ||
* @param {!Audit} audit | ||
* @param {!AuditResut} result |
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.
AuditResut
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.
nice catch :)
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.
done
@@ -74,7 +74,6 @@ describe('Performance: speed-index-metric audit', () => { | |||
const artifacts = mockArtifactsWithSpeedlineResult(SpeedlineResult); | |||
|
|||
return Audit.audit(artifacts).then(response => { | |||
assert.equal(response.displayValue, '845'); |
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.
i saw when you were debugging this..
looks like you nuked it because .displayValue
is never explictly set?
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.
If that's true, what is this bit doing?
lighthouse/lighthouse-core/audits/audit.js
Lines 60 to 63 in 3fefe78
let displayValue = result.displayValue; | |
if (typeof displayValue === 'undefined') { | |
displayValue = result.rawValue ? result.rawValue : ''; | |
} |
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.
looks like you nuked it because
.displayValue
is never explictly set?
yes. That line in audit.js
does the same thing as it did before (so the final result output by Lighthouse will have a displayValue
of '845'
), but since the unit test is calling .audit()
directly, it's not getting the version run through generateAuditResult
and so won't have displayValue
on it
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.
roger that.
3fefe78
to
a62602f
Compare
Thanks for the ping on the page execution breakdowns PR. This change looks pretty sane. LGTM3. |
basically forever we've required audits to call
AuditName.generateAuditResult()
on the result they're returning.This just moves the call to the caller of the audit (
Runner._runAudit
) instead, making writing an audit require just a little less boilerplate :)