diff --git a/packages/react-test-renderer/src/ReactTestRenderer.js b/packages/react-test-renderer/src/ReactTestRenderer.js index ff80440379f14..65da95aad5bfa 100644 --- a/packages/react-test-renderer/src/ReactTestRenderer.js +++ b/packages/react-test-renderer/src/ReactTestRenderer.js @@ -56,6 +56,7 @@ const {IsSomeRendererActing} = ReactSharedInternals; type TestRendererOptions = { createNodeMock: (element: React$Element) => any, unstable_isConcurrent: boolean, + unstable_strictModeLevel: number, ... }; @@ -433,6 +434,7 @@ function propsMatch(props: Object, filter: Object): boolean { function create(element: React$Element, options: TestRendererOptions) { let createNodeMock = defaultTestOptions.createNodeMock; let isConcurrent = false; + let strictModeLevel = null; if (typeof options === 'object' && options !== null) { if (typeof options.createNodeMock === 'function') { createNodeMock = options.createNodeMock; @@ -440,6 +442,9 @@ function create(element: React$Element, options: TestRendererOptions) { if (options.unstable_isConcurrent === true) { isConcurrent = true; } + if (options.unstable_strictModeLevel !== undefined) { + strictModeLevel = options.unstable_strictModeLevel; + } } let container = { children: [], @@ -451,7 +456,7 @@ function create(element: React$Element, options: TestRendererOptions) { isConcurrent ? ConcurrentRoot : LegacyRoot, false, null, - null, + strictModeLevel, ); invariant(root != null, 'something went wrong'); updateContainer(element, root, null, null);