-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
misc(runner): add assertion for devtoolsLog as requiredArtifact #9290
Conversation
@@ -289,11 +289,13 @@ class Runner { | |||
for (const artifactName of audit.meta.requiredArtifacts) { | |||
const noArtifact = artifacts[artifactName] === undefined; | |||
|
|||
// If trace required, check that DEFAULT_PASS trace exists. | |||
// TODO: need pass-specific check of networkRecords and traces. |
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.
networkRecords
! This is old :)
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
consistency with our trace check sgtm!
@@ -289,11 +289,13 @@ class Runner { | |||
for (const artifactName of audit.meta.requiredArtifacts) { | |||
const noArtifact = artifacts[artifactName] === undefined; | |||
|
|||
// If trace required, check that DEFAULT_PASS trace exists. | |||
// TODO: need pass-specific check of networkRecords and traces. | |||
const noTrace = artifactName === 'traces' && !artifacts.traces[Audit.DEFAULT_PASS]; |
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.
hm I wasn't even aware we did this, I guess it's impossible to eliminate the defaultPass then even with a custom config if you want any network or trace data?
lighthouse-core/runner.js
Outdated
// TODO: need pass-specific check of networkRecords and traces. | ||
const noTrace = artifactName === 'traces' && !artifacts.traces[Audit.DEFAULT_PASS]; | ||
// If trace/devtoolsLog required, check that DEFAULT_PASS trace/devtoolsLog exists. | ||
// TODO: need pass-specific check of traces and devtoolsLogs. |
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 would personally just get rid of this TODO, are we really going to move to requiredArtifacts: ['traces.mySpecialPass']
at any point in the near future?
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 would personally just get rid of this TODO, are we really going to move to
requiredArtifacts: ['traces.mySpecialPass']
at any point in the near future?
I think we're going to run into this sooner or later for the custom config/plugin reason you mention above. I think there are solutions, e.g. we could use a tracePassName
(or whatever) convention in the audit options that defaults to defaultPass
and check based on that here. That has its own pretty serious issues (we need to check requiredArtifacts
and audit options now? what if an audit doesn't want to/can't follow the convention? etc), but I'd like to keep thinking about it.
Main thing is that if/when that situation does come up, this is where the error will occur, so it would be good to have a comment on it. I can definitely make it not a TODO, though.
when we're checking required artifacts before running an audit, we assert that the default trace exists if the audit needs a trace, but we only assert that the top-level
devtoolsLogs
artifact exists (it always does since it's a base artifact), not if any logs on it exist (they might not if there was a pageLoadError).As a result, while nearly everyone in an error report will have
"Required {Artifact} gatherer did not run."
error string, a few audits that rely only on the devtoolsLog will have the lovely"Cannot read property 'forEach' of undefined"
error string instead.This adds a check for devtoolsLog just like the trace check.