mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
9a72e62271
Withdf12d7eac4I accidentally made it so that tests aren't run with the 2 variant modes for most SchedulerFeatureFlags anymore. This fixes it with the same approach asee4233bdbc. Test Plan: Run and notice the boolean flags follow the variant: ``` yarn test-www --variant=true yarn test-www --variant=false ```
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
jest.mock('shared/ReactFeatureFlags', () => {
|
|
jest.mock(
|
|
'ReactFeatureFlags',
|
|
() => jest.requireActual('shared/forks/ReactFeatureFlags.www-dynamic'),
|
|
{virtual: true}
|
|
);
|
|
const actual = jest.requireActual('shared/forks/ReactFeatureFlags.www');
|
|
|
|
// This flag is only used by tests, it should never be set elsewhere.
|
|
actual.enableSyncDefaultUpdates = __VARIANT__;
|
|
|
|
return actual;
|
|
});
|
|
|
|
jest.mock('scheduler/src/SchedulerFeatureFlags', () => {
|
|
const schedulerSrcPath = process.cwd() + '/packages/scheduler';
|
|
jest.mock(
|
|
'SchedulerFeatureFlags',
|
|
() =>
|
|
jest.requireActual(
|
|
schedulerSrcPath + '/src/forks/SchedulerFeatureFlags.www-dynamic'
|
|
),
|
|
{virtual: true}
|
|
);
|
|
const actual = jest.requireActual(
|
|
schedulerSrcPath + '/src/forks/SchedulerFeatureFlags.www'
|
|
);
|
|
|
|
// These flags are not a dynamic on www, but we still want to run
|
|
// tests in both versions.
|
|
actual.enableIsInputPending = __VARIANT__;
|
|
actual.enableIsInputPendingContinuous = __VARIANT__;
|
|
actual.enableProfiling = __VARIANT__;
|
|
actual.enableSchedulerDebugging = __VARIANT__;
|
|
|
|
return actual;
|
|
});
|
|
|
|
global.__WWW__ = true;
|