feat: add debug.deep and debug.shallow (#37)

<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

Adds API proposed by https://github.com/callstack/react-native-testing-library/pull/33#issuecomment-430302079.
Also component output is now highlighted:

<img width="259" alt="screenshot 2018-10-16 at 19 33 25" src="https://user-images.githubusercontent.com/5106466/47035614-c10efb80-d17a-11e8-99ac-00f648880008.png">


### Test plan

Added tests for `debug`.
This commit is contained in:
Michał Pierzchała
2018-10-16 21:45:56 +02:00
committed by GitHub
parent 03e2c4b0f2
commit 05db7bcaac
8 changed files with 190 additions and 9 deletions
+7
View File
@@ -81,8 +81,15 @@ const shallowTree: { output: React.ReactElement<any> } = shallow(
const waitForFlush: Promise<any> = flushMicrotasksQueue();
// debug API
debug(<TestComponent />);
debug(<TestComponent />, 'message');
debug(getByNameString);
debug(getByNameString, 'message');
debug.shallow(<TestComponent />);
debug.shallow(<TestComponent />, 'message');
debug.deep(<TestComponent />);
debug.deep(<TestComponent />, 'message');
const waitBy: Promise<ReactTestInstance> = waitForElement<ReactTestInstance>(
() => tree.getByName('View')