-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[Docs] Add docs for Testing Components #1477
Conversation
First off, thanks for getting the testing ball rolling! 🍺 I would kind of expect mocks like these to be automatically generated (by react-native cli or jest?). I wouldn't expect people to know that |
Agreed, this is a good start. In addition to what we have here, it would be great if we could include instructions as per #700 (comment) for how to do it without mocking out all of the pieces in order to be able to use the shallow renderer. Could you try this out to see if it works with 0.6.0-rc? If not, let's find a way to make it work 😄 |
|
||
### Transpiling ES6 Code | ||
|
||
React Native is written in ES6 and there's a very good chance that your component is it too. So you'll have to make sure to preprocess your source files to ES5 prior to running your tests. You can do this by configuring Jest with a [`scriptPreprocessor`](https://facebook.github.io/jest/docs/api.html#config-scriptpreprocessor-string) like [this one](https://gist.github.com/naoufal/dd8447646fe6f6fbf426). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/component is it too/component is too/
Hey @brentvatne: want to guide this along and merge it when it's ready? |
@sahrens - sure thing |
Going to close this because @naoufal is busy at the moment, we can revive when he has more time 😄 |
+1 to this. I would really like more documentation on setting up testing ... |
+1 |
1 similar comment
+1 |
+1 still an issue |
This PR adds documentation on how to get started with testing React Native components with Jest.
It stems from #700.