imp: Deprecate shallow (#264)

This commit is contained in:
Kacper Wiszczuk
2020-03-18 13:03:21 +01:00
committed by GitHub
parent 9edcd16c72
commit 6d31da215d
2 changed files with 12 additions and 3 deletions
+10 -1
View File
@@ -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<any>
) {
const renderer = new ShallowRenderer();
@@ -16,3 +17,11 @@ export default function shallow(
output: renderer.getRenderOutput(),
};
}
export default function shallow(
instance: ReactTestInstance | React.Element<any>
) {
printDeprecationWarning('shallow');
return shallowInternal(instance);
}