-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
build: ReactTestRenderer package #7362
Conversation
Yea we really should have done this before talking about it 😕 Requiring from lib is 100% unsupported and our own projects shouldn't promote it. I think that package name sounds fine. Want to bike shed on it at all @spicyj? @iamdustan, I think you forgot to git add a few files 😛 |
45a9369
to
8ca74ac
Compare
Thank Git for revisionist history :) |
my own bikeshedding on the name:
|
Where does the name "renderer" come from? I don't remember writing that anywhere. This renderer is not only for snapshot testing, it's more of a generic inspectable test renderer which doesn't quite have all the hooks yet. Shallow rendering should've been called createShallowRenderer. We already have the react-test-renderer name on npm and that seems good (thanks @thejameskyle). |
idk? that line was pulled out of the code example on the jest blog. Not sure if you’re referring to the first |
"bugs": { | ||
"url": "https://github.com/facebook/react/issues" | ||
}, | ||
"homepage": "https://facebook.github.io/react-native/", |
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.
Not react-native :P
We should also have a readme in there, as well as adding this package to the version check script (https://github.com/facebook/react/blob/master/gulp/tasks/version-check.js). I was going to ship 15.3 today but I think I'd like to get this in so we don't end up delaying updates to that Jest post. Any updates you want to make to this are great, otherwise we can followup with the rest and get that in tonight. Then we'll ship 15.3 tomorrow. |
@spicyj if you wanted to writeup a short readme, that would be great. |
👍 I'll hit these updates in a few hours. |
README: react-test-rendererThis package provides an experimental React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment. Essentially, this package makes it easy to grab a snapshot of the "DOM tree" rendered by a React DOM or React Native component without using a browser or jsdom. Usage:
You can also use Jest's snapshot testing feature to automatically save a copy of the JSON tree to a file and check in your tests that it hasn't changed: http://facebook.github.io/jest/blog/2016/07/27/jest-14.html. |
@spicyj should we add that currently the API is unstable beyond |
8ca74ac
to
155c345
Compare
Updated. |
(cherry picked from commit 7e874f5)
Official package implemented in facebook/react#7362
Official package implemented in facebook/react#7362
Reading @cpojer’s blog post on Jest 14 this morning (http://facebook.github.io/jest/blog/2016/07/27/jest-14.html) and the import from React internals stuck out to me. The goal is that we can change the public blog post to the following sooner rather than later: