core(config): Throw an error if an onlyX filter is an empty array #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This is a bugfix, which fixes this issue:
GoogleChrome#14986
Logic fix and relevant unit tests were added.
Description
TLDR: Throw an Error In case and empty array of
onlyCategories
/onlyAudits
is passedIn the case an empty array of
onlyCategories
is passed, all categories are filtered (as only 0 categories are to be kept).This results in an unexpected behavior, as an empty array might be interpreted as "don't filter anything".
Since passing an empty array serves no use, an error is thrown.
TBD
The original issue referred to throwing an error also for the case in which
audits
is left empty after filtering, however empty/missingaudits
is being handled in following code, and throwing an error breaks this logic.Throwing an error for empty
audits
also breaks 30 tests.I would suggest not changing any
audits
logic.