Allow reading default feature flags from bundle tests #13629
Merged
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.
I want to run some tests both in Fire and normal modes (#13628).
But for that I need tests to switch on
ReactFeatureFlags
and determine the expected behavior based on that. And this doesn't work in bundle tests so I'd have to make them internal.I don't want to make those tests internal. So instead I'm making a readonly version of
ReactFeatureFlags
available to bundle tests. That's sufficient to know in which mode we're running. If you attempt to write to it (as some our tests which need to stay internal do), this will throw.I could have used something like
process.env
for this instead. But it felt more confusing to me to have different ways to read a feature flag.