Skip to content

Commit

Permalink
fix: ignore onlyCategories when onlyAudits is supplied
Browse files Browse the repository at this point in the history
Fixes #175
  • Loading branch information
harlan-zw committed Mar 3, 2024
1 parent 5359703 commit 3ec2531
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/core/src/resolveConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ export const resolveUserConfig: (userConfig: UserConfig) => Promise<ResolvedUser
}
if (config.lighthouseOptions) {
if (config.lighthouseOptions.onlyCategories?.length) {
// restrict categories values and copy order of columns from the default config
// @ts-expect-error 'defaultConfig.lighthouseOptions' is always set in default config
config.lighthouseOptions.onlyCategories = defaultConfig.lighthouseOptions.onlyCategories
.filter(column => config.lighthouseOptions.onlyCategories.includes(column))
if (config.lighthouseOptions.onlyAudits?.length) {
logger.warn('You have specified both `onlyCategories` and `onlyAudits`. `onlyCategories` will be ignored.')
config.lighthouseOptions.onlyCategories = []
}
else {
// restrict categories values and copy order of columns from the default config
config.lighthouseOptions.onlyCategories = defaultConfig.lighthouseOptions.onlyCategories
.filter(column => config.lighthouseOptions.onlyCategories.includes(column))
}
}
}
else {
Expand Down

0 comments on commit 3ec2531

Please sign in to comment.