-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
🚀 Feature Proposal
The current scope of accepted config keys is super narrow (and the documentation doesn't say anything about it).
Motivation
The two most asked-for watch plugins that are not yet implemented are:
- toggle coverage collection
- toggle test verbosity
Both are trivial to implement, provided that the passed updateConfigAndRun() function takes the relevant global config keys into account. Currently, it only accepts the minimum set of config keys required to implement the internal plugins, not one more. Fortunately, this was enough to implement the typeahead plugin, as it's just an overwrite of the logic for the non-typeahead internal plugin, but that's as far as it goes.
Note that IMHO, the global config should be audited for prime candidate keys that seem innocuous enough to expose to watch plugins. It's likely that bail, collectCoverageFrom, collectCoverageOnlyFrom, coverageDirectory, coverageReporters, notify, notifyMode, onlyFailures and reporters would be good candidates that do not impede core's ability to function when tweaked.
Example
- Being able to toggle
collectCoveragewould let us implement a coverage toggler - Being able to toggle
verbosewould let us implement a verbosity toggler.
Pitch
Why does this feature belong in the Jest core platform?
Because it can't be implemented from the outside. For obvious reasons, the passed global config is immutable, and the one used by watch() is a local reference that it is the only scope to access.
I'm willing to help with changes in core, and have the two aforementioned plugins at the ready (or almost so, for coverage, as I want to expand it further).
Let me know!