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

Fix onlyAudits and onlyGroups errors in Lighthouse plugin #903

Open
hanna-skryl opened this issue Dec 24, 2024 · 0 comments · May be fixed by #911
Open

Fix onlyAudits and onlyGroups errors in Lighthouse plugin #903

hanna-skryl opened this issue Dec 24, 2024 · 0 comments · May be fixed by #911
Assignees
Labels
🐛 bug something isn't working

Comments

@hanna-skryl
Copy link
Collaborator

hanna-skryl commented Dec 24, 2024

What happened?

When using onlyAudits or onlyGroups in the Lighthouse plugin configuration, unexpected errors are thrown, indicating that category references are invalid due to missing audits or groups.

Examples of errors:

  • For onlyGroups: ['performance']:
custom: The following category references need to point to an audit or group: lighthouse#accessibility (group), lighthouse#best-practices (group), lighthouse#seo (group)
  • For onlyAudits: ['csp-xss']:
custom: The following category references need to point to an audit or group: lighthouse#performance (group), lighthouse#accessibility (group), lighthouse#seo (group)

What would you expect to happen?

  • Categories should dynamically adjust their references to match the filtered audits and groups.
  • Invalid references should be removed without throwing errors.
  • Groups with no valid references should be excluded from the final configuration.
  • Informational logs should detail which audits, groups, and categories were filtered out.

What steps did you take?

Set onlyGroups in lighthouseCoreConfig:

export const lighthouseCoreConfig = async (
  url: string,
): Promise<CoreConfig> => ({
  plugins: [
    await lighthousePlugin(url, {
      onlyGroups: ['performance'],
    }),
  ],
  categories: lighthouseCategories,
});

Set onlyAudits in lighthouseCoreConfig:

export const lighthouseCoreConfig = async (
  url: string,
): Promise<CoreConfig> => ({
  plugins: [
    await lighthousePlugin(url, {
      onlyAudits: ['csp-xss'],
    }),
  ],
  categories: lighthouseCategories,
});

Proposed Fix

  • Update the Lighthouse plugin to dynamically filter invalid category references based on isSkipped audits and groups.
  • Remove categories with no valid references.
  • Log skipped audits, groups, and categories for transparency.

Code PushUp package version

No response

What operation system are you on?

MacOS

Node version

v22.10.0

Relevant log output

@hanna-skryl hanna-skryl added the 🐛 bug something isn't working label Dec 24, 2024
@hanna-skryl hanna-skryl changed the title Fix onlyAudits and onlyCategories errors in Lighthouse plugin Fix onlyAudits and onlyGroups errors in Lighthouse plugin Dec 24, 2024
@hanna-skryl hanna-skryl self-assigned this Jan 2, 2025
@hanna-skryl hanna-skryl linked a pull request Jan 7, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant