Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {
batchedUpdates,
flushPassiveEffects,
IsThisRendererActing,
} from 'react-reconciler/inline.test';
import ReactSharedInternals from 'shared/ReactSharedInternals';
import enqueueTask from 'shared/enqueueTask';
import * as Scheduler from 'scheduler';
const {IsSomeRendererActing} = ReactSharedInternals;
// this implementation should be exactly the same in
// ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
const isSchedulerMocked =
typeof Scheduler.unstable_flushAllWithoutAsserting === 'function';
const flushWork =
Scheduler.unstable_flushAllWithoutAsserting ||
function() {
let didFlushWork = false;
while (flushPassiveEffects()) {
didFlushWork = true;
}
return didFlushWork;
};
function flushWorkAndMicroTasks(onDone: (err: ?Error) => void) {
try {
flushWork();
enqueueTask(() => {
if (flushWork()) {
eventNameDispatchConfigs = _ReactDOM$__SECRET_IN[4],
accumulateTwoPhaseDispatches = _ReactDOM$__SECRET_IN[5],
accumulateDirectDispatches = _ReactDOM$__SECRET_IN[6],
enqueueStateRestore = _ReactDOM$__SECRET_IN[7],
restoreStateIfNeeded = _ReactDOM$__SECRET_IN[8],
dispatchEvent = _ReactDOM$__SECRET_IN[9],
runEventsInBatch = _ReactDOM$__SECRET_IN[10],
/* eslint-enable no-unused-vars */
flushPassiveEffects = _ReactDOM$__SECRET_IN[11],
IsThisRendererActing = _ReactDOM$__SECRET_IN[12];
var batchedUpdates = ReactDOM.unstable_batchedUpdates;
var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; // this implementation should be exactly the same in
// ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
var isSchedulerMocked = typeof Scheduler.unstable_flushAllWithoutAsserting === 'function';
var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
var didFlushWork = false;
while (flushPassiveEffects()) {
didFlushWork = true;
}
return didFlushWork;
};
function flushWorkAndMicroTasks(onDone) {
try {
flushWork();
enqueueTask(function () {
if (flushWork()) {
accumulateDirectDispatches = _ReactDOM$__SECRET_IN[6],
enqueueStateRestore = _ReactDOM$__SECRET_IN[7],
restoreStateIfNeeded = _ReactDOM$__SECRET_IN[8],
dispatchEvent = _ReactDOM$__SECRET_IN[9],
runEventsInBatch = _ReactDOM$__SECRET_IN[10],
/* eslint-enable no-unused-vars */
flushPassiveEffects = _ReactDOM$__SECRET_IN[11],
IsThisRendererActing = _ReactDOM$__SECRET_IN[12];
var batchedUpdates = ReactDOM.unstable_batchedUpdates;
var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; // this implementation should be exactly the same in
// ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
var isSchedulerMocked = typeof Scheduler.unstable_flushAllWithoutAsserting === 'function';
var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
var didFlushWork = false;
while (flushPassiveEffects()) {
didFlushWork = true;
}
return didFlushWork;
};
function flushWorkAndMicroTasks(onDone) {
try {
flushWork();
enqueueTask(function () {
if (flushWork()) {
flushWorkAndMicroTasks(onDone);
} else {
dispatchEvent,
runEventsInBatch,
/* eslint-enable no-unused-vars */
flushPassiveEffects,
IsThisRendererActing,
] = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
const batchedUpdates = ReactDOM.unstable_batchedUpdates;
const {IsSomeRendererActing} = ReactSharedInternals;
// this implementation should be exactly the same in
// ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
const isSchedulerMocked =
typeof Scheduler.unstable_flushAllWithoutAsserting === 'function';
const flushWork =
Scheduler.unstable_flushAllWithoutAsserting ||
function() {
let didFlushWork = false;
while (flushPassiveEffects()) {
didFlushWork = true;
}
return didFlushWork;
};
function flushWorkAndMicroTasks(onDone: (err: ?Error) => void) {
try {
flushWork();
enqueueTask(() => {
if (flushWork()) {
flushPassiveEffects,
IsThisRendererActing,
} from 'react-reconciler/inline.test';
import ReactSharedInternals from 'shared/ReactSharedInternals';
import enqueueTask from 'shared/enqueueTask';
import * as Scheduler from 'scheduler';
const {IsSomeRendererActing} = ReactSharedInternals;
// this implementation should be exactly the same in
// ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
const isSchedulerMocked =
typeof Scheduler.unstable_flushAllWithoutAsserting === 'function';
const flushWork =
Scheduler.unstable_flushAllWithoutAsserting ||
function() {
let didFlushWork = false;
while (flushPassiveEffects()) {
didFlushWork = true;
}
return didFlushWork;
};
function flushWorkAndMicroTasks(onDone: (err: ?Error) => void) {
try {
flushWork();
enqueueTask(() => {
if (flushWork()) {
flushWorkAndMicroTasks(onDone);
} else {
var eventNameDispatchConfigs$1 = _ReactDOM$__SECRET_IN$1[4];
var accumulateTwoPhaseDispatches$1 = _ReactDOM$__SECRET_IN$1[5];
var accumulateDirectDispatches$1 = _ReactDOM$__SECRET_IN$1[6];
var enqueueStateRestore$1 = _ReactDOM$__SECRET_IN$1[7];
var restoreStateIfNeeded$1 = _ReactDOM$__SECRET_IN$1[8];
var dispatchEvent$1 = _ReactDOM$__SECRET_IN$1[9];
var runEventsInBatch$1 = _ReactDOM$__SECRET_IN$1[10];
var flushPassiveEffects$1 = _ReactDOM$__SECRET_IN$1[11];
var IsThisRendererActing$1 = _ReactDOM$__SECRET_IN$1[12];
var batchedUpdates = ReactDOM.unstable_batchedUpdates;
var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; // this implementation should be exactly the same in
// ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
var isSchedulerMocked = typeof Scheduler.unstable_flushAllWithoutAsserting === 'function';
var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
var didFlushWork = false;
while (flushPassiveEffects$1()) {
didFlushWork = true;
}
return didFlushWork;
};
function flushWorkAndMicroTasks(onDone) {
try {
flushWork();
enqueueTask$1(function () {
if (flushWork()) {
flushWorkAndMicroTasks(onDone);
} else {
/* eslint-enable no-unused-vars */
flushPassiveEffects,
IsThisRendererActing,
] = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
const batchedUpdates = ReactDOM.unstable_batchedUpdates;
const {IsSomeRendererActing} = ReactSharedInternals;
// this implementation should be exactly the same in
// ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
const isSchedulerMocked =
typeof Scheduler.unstable_flushAllWithoutAsserting === 'function';
const flushWork =
Scheduler.unstable_flushAllWithoutAsserting ||
function() {
let didFlushWork = false;
while (flushPassiveEffects()) {
didFlushWork = true;
}
return didFlushWork;
};
function flushWorkAndMicroTasks(onDone: (err: ?Error) => void) {
try {
flushWork();
enqueueTask(() => {
if (flushWork()) {
flushWorkAndMicroTasks(onDone);
} else {
var getFiberCurrentPropsFromNode$1 = _ReactDOM$__SECRET_IN$1[2];
var injectEventPluginsByName$1 = _ReactDOM$__SECRET_IN$1[3];
var eventNameDispatchConfigs$1 = _ReactDOM$__SECRET_IN$1[4];
var accumulateTwoPhaseDispatches$1 = _ReactDOM$__SECRET_IN$1[5];
var accumulateDirectDispatches$1 = _ReactDOM$__SECRET_IN$1[6];
var enqueueStateRestore$1 = _ReactDOM$__SECRET_IN$1[7];
var restoreStateIfNeeded$1 = _ReactDOM$__SECRET_IN$1[8];
var dispatchEvent$1 = _ReactDOM$__SECRET_IN$1[9];
var runEventsInBatch$1 = _ReactDOM$__SECRET_IN$1[10];
var flushPassiveEffects$1 = _ReactDOM$__SECRET_IN$1[11];
var IsThisRendererActing$1 = _ReactDOM$__SECRET_IN$1[12];
var batchedUpdates = ReactDOM.unstable_batchedUpdates;
var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; // this implementation should be exactly the same in
// ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
var isSchedulerMocked = typeof Scheduler.unstable_flushAllWithoutAsserting === 'function';
var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
var didFlushWork = false;
while (flushPassiveEffects$1()) {
didFlushWork = true;
}
return didFlushWork;
};
function flushWorkAndMicroTasks(onDone) {
try {
flushWork();
enqueueTask$1(function () {
if (flushWork()) {
export function warnIfUnmockedScheduler(fiber: Fiber) {
if (__DEV__) {
if (
didWarnAboutUnmockedScheduler === false &&
Scheduler.unstable_flushAllWithoutAsserting === undefined
) {
if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
didWarnAboutUnmockedScheduler = true;
console.error(
'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' +
'to guarantee consistent behaviour across tests and browsers. ' +
'For example, with jest: \n' +
"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" +
'For more info, visit https://fb.me/react-mock-scheduler',
);
} else if (warnAboutUnmockedScheduler === true) {
didWarnAboutUnmockedScheduler = true;
console.error(
'Starting from React v17, the "scheduler" module will need to be mocked ' +
'to guarantee consistent behaviour across tests and browsers. ' +
'For example, with jest: \n' +
export function warnIfUnmockedScheduler(fiber: Fiber) {
if (__DEV__) {
if (
didWarnAboutUnmockedScheduler === false &&
Scheduler.unstable_flushAllWithoutAsserting === undefined
) {
if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
didWarnAboutUnmockedScheduler = true;
warningWithoutStack(
false,
'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' +
'to guarantee consistent behaviour across tests and browsers. ' +
'For example, with jest: \n' +
"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" +
'For more info, visit https://fb.me/react-mock-scheduler',
);
} else if (warnAboutUnmockedScheduler === true) {
didWarnAboutUnmockedScheduler = true;
warningWithoutStack(
false,
'Starting from React v17, the "scheduler" module will need to be mocked ' +