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(fr): limit scope of audits to applicable modes #12764

Merged
merged 3 commits into from
Jul 9, 2021

Conversation

patrickhulce
Copy link
Collaborator

Summary
Updates several more audits to accurately reflect their supported gather modes. Most of this is restricting the supportedMode to navigation even if the artifacts are available, a few optional notApplicable states, and then minor gatherer fixes too.

The remaining ones are due to...

  • simulate throttlingMethod still being default in timespan (tracked by Flow Support (Fraggle Rock) #11313)
  • Opportunities that haven't been converted yet but are still on the burndown.
  • Network analysis failing when there are no network records at all.

Related Issues/PRs
ref #11313

@patrickhulce patrickhulce requested a review from a team as a code owner July 8, 2021 20:51
@patrickhulce patrickhulce requested review from adamraine and removed request for a team July 8, 2021 20:51
@google-cla google-cla bot added the cla: yes label Jul 8, 2021
try {
return await this._audit(artifacts, context);
} catch (err) {
const noFramesErrors = new Set([
Copy link
Member

Choose a reason for hiding this comment

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

nit: Set seems like overkill for this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

overkill to employ a data structure that matches the semantics? :)

is there a particular concern addressed by using an array?

Copy link
Member

Choose a reason for hiding this comment

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

I guess it boils down to a style choice, so we can leave it as is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SGTM!

just out of curiosity though, is there a particular concern you feel is addressed by using an array?

e.g. Sets are still too unfamiliar to most developers and take longer to understand the initialization than a plain array does

Copy link
Member

Choose a reason for hiding this comment

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

No, I think the code is easily understandable. I do think it would look cleaner if we used the array directly.

lighthouse-core/computed/resource-summary.js Outdated Show resolved Hide resolved
lighthouse-core/test/audits/final-screenshot-test.js Outdated Show resolved Hide resolved
const {largestContentfulPaintEvt} = await ProcessedNavigation.request(processedTrace, context);
const {largestContentfulPaintEvt} = await ProcessedNavigation
.request(processedTrace, context)
.catch(err => {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep! good catch

@@ -194,7 +194,7 @@ describe('Fraggle Rock API', () => {
const {lhr} = result;
const {auditResults, failedAudits, erroredAudits} = getAuditsBreakdown(lhr);
// TODO(FR-COMPAT): This assertion can be removed when full compatibility is reached.
expect(auditResults.length).toMatchInlineSnapshot(`152`);
Copy link
Member

Choose a reason for hiding this comment

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

This is TapTargets right?

Copy link
Collaborator Author

@patrickhulce patrickhulce Jul 8, 2021

Choose a reason for hiding this comment

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

yep, the inheriting supportedModes array is [] so it was never run

expect(notApplicableAudits.map(audit => audit.id)).toContain('server-response-time');

// TODO(FR-COMPAT): Reduce this number by handling the error, making N/A, or removing timespan support.
expect(erroredAudits.length).toMatchInlineSnapshot(`22`);
expect(erroredAudits.length).toMatchInlineSnapshot(`12`);
Copy link
Member

Choose a reason for hiding this comment

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

🎉

@patrickhulce patrickhulce merged commit c284253 into master Jul 9, 2021
@patrickhulce patrickhulce deleted the fr_narrow_remaining_audits branch July 9, 2021 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants