From 88e3d75f2b4887ef26c4329e663ac84965fb1189 Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Wed, 18 Mar 2020 11:54:27 +0100 Subject: [PATCH] imp: Deprecate shallow --- src/helpers/debugShallow.js | 4 ++-- src/shallow.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/helpers/debugShallow.js b/src/helpers/debugShallow.js index 896e059d3..80e36e681 100644 --- a/src/helpers/debugShallow.js +++ b/src/helpers/debugShallow.js @@ -1,6 +1,6 @@ // @flow import * as React from 'react'; -import shallow from '../shallow'; +import { shallowInternal } from '../shallow'; import format from './format'; /** @@ -10,7 +10,7 @@ export default function debugShallow( instance: ReactTestInstance | React.Element, message?: any ) { - const { output } = shallow(instance); + const { output } = shallowInternal(instance); if (message) { console.log(`${message}\n\n`, format(output)); diff --git a/src/shallow.js b/src/shallow.js index e07b123ca..576ac913a 100644 --- a/src/shallow.js +++ b/src/shallow.js @@ -1,11 +1,12 @@ // @flow import * as React from 'react'; import ShallowRenderer from 'react-test-renderer/shallow'; // eslint-disable-line import/no-extraneous-dependencies +import { printDeprecationWarning } from './helpers/errors'; /** * Renders test component shallowly using react-test-renderer/shallow */ -export default function shallow( +export function shallowInternal( instance: ReactTestInstance | React.Element ) { const renderer = new ShallowRenderer(); @@ -16,3 +17,11 @@ export default function shallow( output: renderer.getRenderOutput(), }; } + +export default function shallow( + instance: ReactTestInstance | React.Element +) { + printDeprecationWarning('shallow'); + + return shallowInternal(instance); +}