-
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
core(runner): audits can only use requiredArtifacts #8760
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,10 @@ const makeComputedArtifact = require('./computed-artifact.js'); | |
|
||
class ViewportMeta { | ||
/** | ||
* @param {{MetaElements: LH.GathererArtifacts['MetaElements']}} artifacts | ||
* @param {LH.GathererArtifacts['MetaElements']} MetaElements | ||
* @return {Promise<ViewportMetaResult>} | ||
*/ | ||
static async compute_({MetaElements}) { | ||
static async compute_(MetaElements) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a necessary refactor to ensure that they're still cached, also this seems like a bad idea to cache on the entire artifacts object anyway :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lol whoops |
||
const viewportMeta = MetaElements.find(meta => meta.name === 'viewport'); | ||
|
||
if (!viewportMeta) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,7 +325,12 @@ class Runner { | |
...sharedAuditContext, | ||
}; | ||
|
||
const product = await audit.audit(artifacts, auditContext); | ||
const requiredArtifacts = audit.meta.requiredArtifacts | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the magic
patrickhulce marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.reduce((requiredArtifacts, artifactName) => { | ||
requiredArtifacts[artifactName] = artifacts[artifactName]; | ||
return requiredArtifacts; | ||
}, /** @type {LH.Artifacts} */ ({})); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is unfortunate, but fine enough. Maybe add a line about the masquerading type to the above comment as well? I was hoping at one point that we could type the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I thought about it for about 5 seconds before thinking there was no way it was going to be usable 😆 hopefully one day typescript will let you work your magic here :) |
||
const product = await audit.audit(requiredArtifacts, auditContext); | ||
auditResult = Audit.generateAuditResult(audit, product); | ||
} catch (err) { | ||
log.warn(audit.meta.id, `Caught exception: ${err.message}`); | ||
|
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.
do you want to change anything about
CSSUsage
for this audit, since after this PR it won't ever see it unless we get around to optionalArtifacts?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 nice catch!