MCPcopy
hub / github.com/facebook/react / getTestFlags

Function getTestFlags

scripts/jest/TestFlags.js:56–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54};
55
56function getTestFlags() {
57 // These are required on demand because some of our tests mutate them. We try
58 // not to but there are exceptions.
59 const featureFlags = require('shared/ReactFeatureFlags');
60 const schedulerFeatureFlags = require('scheduler/src/SchedulerFeatureFlags');
61
62 const www = global.__WWW__ === true;
63 const xplat = global.__XPLAT__ === true;
64 const releaseChannel = www
65 ? __EXPERIMENTAL__
66 ? 'modern'
67 : 'classic'
68 : __EXPERIMENTAL__
69 ? 'experimental'
70 : 'stable';
71
72 // Return a proxy so we can throw if you attempt to access a flag that
73 // doesn't exist.
74 return new Proxy(
75 {
76 channel: releaseChannel,
77 modern: releaseChannel === 'modern',
78 classic: releaseChannel === 'classic',
79 source: !process.env.IS_BUILD,
80 www,
81 fb: www || xplat,
82
83 // These aren't flags, just a useful aliases for tests.
84 // TODO: Clean this up.
85 enableActivity: true,
86 enableSuspenseList: releaseChannel === 'experimental' || www || xplat,
87 enableLegacyHidden: www,
88 // TODO: Suspending the work loop during the render phase is currently
89 // not compatible with sibling prerendering. We will add this optimization
90 // back in a later step.
91 enableSuspendingDuringWorkLoop: false,
92
93 // This flag is used to determine whether we should run Fizz tests using
94 // the external runtime or the inline script runtime.
95 // For Meta we use variant to gate the feature. For OSS we use experimental
96 shouldUseFizzExternalRuntime: !featureFlags.enableFizzExternalRuntime
97 ? false
98 : www
99 ? __VARIANT__
100 : __EXPERIMENTAL__,
101
102 // This is used by useSyncExternalStoresShared-test.js to decide whether
103 // to test the shim or the native implementation of useSES.
104
105 enableUseSyncExternalStoreShim: !__VARIANT__,
106
107 // If there's a naming conflict between scheduler and React feature flags, the
108 // React ones take precedence.
109 // TODO: Maybe we should error on conflicts? Or we could namespace
110 // the flags
111 ...schedulerFeatureFlags,
112 ...featureFlags,
113 ...environmentFlags,

Callers 2

setupTests.jsFile · 0.85
setupTests.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected