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

Convert Jest tests to snapshot tests. #110

Merged
merged 1 commit into from
Jul 27, 2016

Conversation

cpojer
Copy link
Contributor

@cpojer cpojer commented Jul 26, 2016

This diff will work once Jest 14.0 is out with the new react-native-preset which eliminates all configuration by providing a preset and it eliminates tons of hard to understand testing code by introducing snapshot tests.

Let me know what you think!

]
"preset": "jest-react-native",
"moduleNameMapper": {
"\\.\/datepicker$": "<rootDir>/node_modules/tcomb-form-native/lib/templates/bootstrap/datepicker.ios.js"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this one is curious. Jest doesn't seem to resolve relative platform paths properly but I'm not sure I'm interested in supporting this. For now, this mapping works.

@cpojer
Copy link
Contributor Author

cpojer commented Jul 26, 2016

I also want to note that not all snapshots may be entirely correct – I just spot-checked them and hope that based on the original tests, they work as intended. I had to update some things however to make sure things even render at all which hints at some subtle bugs from before.

I also had to update react-native to 0.30 because it contains some necessary JS fixes. Someone might want to do this update in a separate diff before merging this one.

@cpojer
Copy link
Contributor Author

cpojer commented Jul 27, 2016

It's out now: http://facebook.github.io/jest/blog/2016/07/27/jest-14.html and there is a tutorial here: http://facebook.github.io/jest/docs/tutorial-react-native.html#content based on the changes I made in this repo.

This has nothing to do with iOS Snapshot testing and I will update the react-native docs shortly.

@bartonhammond
Copy link
Owner

Appears to be working w/ minor changes to package.json and ignoring apsl-react-native-button.

Many thanks @cpojer !!!!!

@bartonhammond bartonhammond merged commit 7ba420f into bartonhammond:master Jul 27, 2016
@orta orta mentioned this pull request Aug 13, 2016
7 tasks
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.

None yet

2 participants