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
+2 -2
View File
@@ -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<any>,
message?: any
) {
const { output } = shallow(instance);
const { output } = shallowInternal(instance);
if (message) {
console.log(`${message}\n\n`, format(output));
+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);
}