Skip to content

Commit 6d31da2

Browse files
authored
imp: Deprecate shallow (#264)
1 parent 9edcd16 commit 6d31da2

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/helpers/debugShallow.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22
import * as React from 'react';
3-
import shallow from '../shallow';
3+
import { shallowInternal } from '../shallow';
44
import format from './format';
55

66
/**
@@ -10,7 +10,7 @@ export default function debugShallow(
1010
instance: ReactTestInstance | React.Element<any>,
1111
message?: any
1212
) {
13-
const { output } = shallow(instance);
13+
const { output } = shallowInternal(instance);
1414

1515
if (message) {
1616
console.log(`${message}\n\n`, format(output));

src/shallow.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// @flow
22
import * as React from 'react';
33
import ShallowRenderer from 'react-test-renderer/shallow'; // eslint-disable-line import/no-extraneous-dependencies
4+
import { printDeprecationWarning } from './helpers/errors';
45

56
/**
67
* Renders test component shallowly using react-test-renderer/shallow
78
*/
8-
export default function shallow(
9+
export function shallowInternal(
910
instance: ReactTestInstance | React.Element<any>
1011
) {
1112
const renderer = new ShallowRenderer();
@@ -16,3 +17,11 @@ export default function shallow(
1617
output: renderer.getRenderOutput(),
1718
};
1819
}
20+
21+
export default function shallow(
22+
instance: ReactTestInstance | React.Element<any>
23+
) {
24+
printDeprecationWarning('shallow');
25+
26+
return shallowInternal(instance);
27+
}

0 commit comments

Comments
 (0)