mirror of
https://github.com/zebrajr/react.git
synced 2025-12-07 00:20:28 +01:00
I copied the set up we use for React. In the www-variant test job, the Scheduler `__VARIANT__` flags will be `true`. When writing a test, we can read the value of the flag with the `gate` pragma and method. Note: Since these packages are currently released in lockstep, maybe we should remove SchedulerFeatureFlags and use ReactFeatureFlags for both.
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
jest.mock('shared/ReactFeatureFlags', () => {
|
|
jest.mock(
|
|
'ReactFeatureFlags',
|
|
() => jest.requireActual('shared/forks/ReactFeatureFlags.www-dynamic'),
|
|
{virtual: true}
|
|
);
|
|
|
|
const wwwFlags = jest.requireActual('shared/forks/ReactFeatureFlags.www');
|
|
const defaultFlags = jest.requireActual('shared/ReactFeatureFlags');
|
|
|
|
// TODO: Many tests were written before we started running them against the
|
|
// www configuration. Update those tests so that they work against the www
|
|
// configuration, too. Then remove these overrides.
|
|
wwwFlags.disableLegacyContext = defaultFlags.disableLegacyContext;
|
|
wwwFlags.disableJavaScriptURLs = defaultFlags.disableJavaScriptURLs;
|
|
|
|
return wwwFlags;
|
|
});
|
|
|
|
jest.mock('scheduler/src/SchedulerFeatureFlags', () => {
|
|
const schedulerSrcPath = process.cwd() + '/packages/scheduler';
|
|
jest.mock(
|
|
'SchedulerFeatureFlags',
|
|
() =>
|
|
jest.requireActual(
|
|
schedulerSrcPath + '/src/forks/SchedulerFeatureFlags.www-dynamic'
|
|
),
|
|
{virtual: true}
|
|
);
|
|
return jest.requireActual(
|
|
schedulerSrcPath + '/src/forks/SchedulerFeatureFlags.www'
|
|
);
|
|
});
|
|
|
|
global.__WWW__ = true;
|