mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
imp: Deprecate shallow (#264)
This commit is contained in:
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user