Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make debug.deep more usable #40

Merged
merged 3 commits into from
Oct 18, 2018
Merged

feat: make debug.deep more usable #40

merged 3 commits into from
Oct 18, 2018

Conversation

thymikee
Copy link
Member

Summary

Make debug.deep more usable by allowing it to print arbitrary JSON (and actually any) files. This proves handy when we want to debug async component which we want to snapshot after async operations:

const { toJSON, getByName } = render(
  <Button onPress={jest.fn} text="Press me" />
);
fireEvent.press(getByName('TouchableOpacity'));
await flushMicrotasksQueue();

debug.deep(toJSON());

Test plan

added one

@thymikee thymikee requested a review from Esemesek October 17, 2018 22:50
src/debug.js Outdated
console.log(format(toJSON()), message || '');
function debugDeep(
instance: React.Element<*> | ?ReactTestRendererJSON,
message?: any
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use default parameter here, instead of message || '' later on.

@thymikee thymikee merged commit 6fbbe2c into master Oct 18, 2018
@thymikee thymikee deleted the feat/deep-fallback branch October 18, 2018 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants