Repository navigation
fix(cli): keep complete lighthouse configs from extending the default - #350
Merged
Merged
Conversation
A flow config that lists its own artifacts and has no extends is complete. user-flow added extends: 'lighthouse:default' to it, and Lighthouse then failed merging its artifacts with the default ones (Expected object but got string). A complete config now gets no extends and takes only settings from the global config. Closes #348
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Document the order in which the global config, the flow config, flags and step options apply, when user-flow adds extends, and how complete configs are handled. The README (also the npm page), the GitHub docs and the docs site all describe the same rules. Also correct the claim that --configPath overrides the rc file: it replaces collect.configPath, and combining it with collect.config stops the run.
❗❗❗ report generated by this PR ❗❗❗☕ Order Coffee ☕Date/Time: 2026-11-13 16:03
|
☕ Order Coffee ☕Date/Time: 2026-11-13 16:03
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #348
Problem
mergeLhConfigaddedextends: 'lighthouse:default'to every non-empty config. A flow config that lists its ownartifacts,auditsandcategorieswithoutextendsis complete. Lighthouse then treated it as an extension of the default config and merged the artifacts by id, and failed on the first step when a gatherer was given as animplementationwhere the default config names it by path:A global
collect.configwithextendscaused the same error, because{ ...globalCfg, ...localCfg }kept the globalextends.Fix
A flow config with
artifactsand noextendscounts as complete (isCompleteLhConfig):extends;settingsfrom the global config, with the flow's settings winning.Configs without
artifactsbehave as before and still getextends: 'lighthouse:default'.Tests
mergeLhConfigandisCompleteLhConfig. They cover a complete flow config on its own and with a global config that hasextends, plus the existing behaviour.e2e/cli-e2e/tests/collect/config.e2e.test.tswith a newcomplete-config.uf.mtsmock. It gives theDevtoolsLoggatherer as an implementation and runs the flow with and without a globalextendsconfig. Both tests fail onmainwithExpected object but got stringand pass with this change.Behaviour change
A flow config that has
artifactsand noextendsno longer gets the default config added. If a config relied on user-flow addingextends, for example to add a custom artifact on top of the defaults, its report now only contains what the config lists. The fix is to setextends: 'lighthouse:default'explicitly. Lighthouse treats a config withoutextendsthe same way.Docs
The README (also the npm page),
packages/cli/docs/lh-configuraton.mdand the docs site page now explain how configs are combined:extendsis added, and what Lighthouse does with it;flowOptions.flags→ step options;They also correct an earlier claim that
--configPathoverrides the rc file. It replacescollect.configPath, and combining it withcollect.configstops the run.