mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
9fc83fec60
* WIP * More changes * WIP * Added throwRemovedFunctionError docsRef * Fixed tests * Typescript types cleanup * Cleanup * Moving some changes from `prepare-2` branch * Moving some changes from `prepare-2` branch * Update src/waitFor.js Co-authored-by: Michał Pierzchała <thymikee@gmail.com> * Update website/docs/Migration20.md Co-authored-by: Michał Pierzchała <thymikee@gmail.com> * Code review changes * More code review changes * Code review changes * More code review changes * Added @deprecated messages for TS type defs * Spelling mistake * Reformatted index.d.ts * Removed remaining refs to warnFn Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
27 lines
739 B
JavaScript
27 lines
739 B
JavaScript
// @flow
|
|
import * as React from 'react';
|
|
import ShallowRenderer from 'react-test-renderer/shallow'; // eslint-disable-line import/no-extraneous-dependencies
|
|
import { throwRemovedFunctionError } from './helpers/errors';
|
|
|
|
/**
|
|
* Renders test component shallowly using react-test-renderer/shallow
|
|
*/
|
|
export function shallowInternal(
|
|
instance: ReactTestInstance | React.Element<any>
|
|
) {
|
|
const renderer = new ShallowRenderer();
|
|
|
|
renderer.render(React.createElement(instance.type, instance.props));
|
|
|
|
return {
|
|
output: renderer.getRenderOutput(),
|
|
};
|
|
}
|
|
|
|
export default function shallow(_: ReactTestInstance | React.Element<any>) {
|
|
throwRemovedFunctionError(
|
|
'shallow',
|
|
'migration-v2#removed-global-shallow-function'
|
|
);
|
|
}
|