mirror of
https://github.com/facebook/react.git
synced 2026-02-26 07:55:55 +00:00
These are based on the ReactNoop renderer, which we use to test React itself. This gives library authors (Relay, Apollo, Redux, et al.) a way to test their components for async compatibility. - Pass `unstable_isAsync` to `TestRenderer.create` to create an async renderer instance. This causes updates to be lazily flushed. - `renderer.unstable_yield` tells React to yield execution after the currently rendering component. - `renderer.unstable_flushAll` flushes all pending async work, and returns an array of yielded values. - `renderer.unstable_flushThrough` receives an array of expected values, begins rendering, and stops once those values have been yielded. It returns the array of values that are actually yielded. The user should assert that they are equal. Although we've used this pattern successfully in our own tests, I'm not sure if these are the final APIs we'll make public.
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
import invariant from 'fbjs/lib/invariant';
|
|
|
|
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
|
|
import typeof * as PersistentFeatureFlagsType from './ReactFeatureFlags.persistent';
|
|
|
|
export const debugRenderPhaseSideEffects = false;
|
|
export const debugRenderPhaseSideEffectsForStrictMode = false;
|
|
export const enableCreateRoot = false;
|
|
export const enableUserTimingAPI = __DEV__;
|
|
export const enableGetDerivedStateFromCatch = false;
|
|
export const warnAboutDeprecatedLifecycles = false;
|
|
export const replayFailedUnitOfWorkWithInvokeGuardedCallback = false;
|
|
export const enableMutatingReconciler = true;
|
|
export const enableNoopReconciler = false;
|
|
export const enablePersistentReconciler = false;
|
|
export const alwaysUseRequestIdleCallbackPolyfill = false;
|
|
|
|
// Only used in www builds.
|
|
export function addUserTimingListener() {
|
|
invariant(false, 'Not implemented.');
|
|
}
|
|
|
|
// Flow magic to verify the exports of this file match the original version.
|
|
// eslint-disable-next-line no-unused-vars
|
|
type Check<_X, Y: _X, X: Y = _X> = null;
|
|
// eslint-disable-next-line no-unused-expressions
|
|
(null: Check<PersistentFeatureFlagsType, FeatureFlagsType>);
|