[go: nahoru, domu]

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

core(config): assert all audit requiredArtifacts will be gathered #9284

Merged
merged 2 commits into from
Jun 27, 2019

Conversation

brendankenny
Copy link
Member

as mentioned in #8865 (review), when there is a pageLoadError you get a ton of logging, 2x every audit. #9236 moved that logging from "Required x gatherer encountered an error" to "Required x gatherer did not run", but you still get a lot of it.

This PR

  • halves the logging (in the end, it didn't feel right to completely remove the warnings)
  • the easiest way to do that was to i18n the "required x gatherer" error strings
  • adds a new validation check to Config to separate the cases of "a gatherer didn't run due to an error" and "a gatherer didn't run due to not being included in the config". Currently those cases are logged the exact same way, and not until the whole LH run has completed, which sucks if you just messed up your config.

'URL',
'Timing',
'PageLoadError',
];
Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't think of a better way to do this. Suggestions? We don't have a place where we export it anywhere. We could separate construction from populating in gather-runner, I guess...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Object.keys(/** @type {Record<keyof LH.BaseArtifacts, string>} */ ({
...
}))

to enable type checking at least so it's automated to update?

Copy link
Member Author

Choose a reason for hiding this comment

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

to enable type checking at least so it's automated to update?

haha, it's terrible but I love it :)

@@ -296,7 +296,7 @@ class Runner {
if (noArtifact || noTrace) {
log.warn('Runner',
Copy link
Member Author

Choose a reason for hiding this comment

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

originally made this log.verbose, under the theory that you get a big red pageLoadError logged above this, but that's scrolled away and you just get a bunch of blue status Auditing: Properly size images +1ms, etc messages that make everything look ok. So now we just don't log here and below

@@ -58,7 +58,7 @@ describe('Config', () => {
assert.equal(MyAudit, newConfig.audits[0].implementation);
});

it('doesn\'t change directly injected plugin instances', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

these are just confusing old uses of "plugin" for "live Gatherer instances"

Copy link
Collaborator
@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

love it!

'URL',
'Timing',
'PageLoadError',
];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Object.keys(/** @type {Record<keyof LH.BaseArtifacts, string>} */ ({
...
}))

to enable type checking at least so it's automated to update?

const auditMeta = auditDefn.implementation.meta;
for (const requiredArtifact of auditMeta.requiredArtifacts) {
if (!foundGatherers.has(requiredArtifact)) {
throw new Error(`${requiredArtifact} gatherer, required by audit ${auditMeta.id}, ` +
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we make this an i18n'd LHError too while we're adding it? I'd personally vote no on all config errors since we never expect these to happen in blessed environments :)

Copy link
Member Author

Choose a reason for hiding this comment

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

should we make this an i18n'd LHError too while we're adding it? I'd personally vote no on all config errors since we never expect these to happen in blessed environments :)

yeah, I'll vote no too. Luckily like a million tests will fail if the default config starts throwing this error :)

Copy link
Collaborator
@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants