-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Add documentation for shallow testing #2963
Conversation
Are we using this internally yet? We might want to hold off on merging this documentation until we've started using this and validated that the API makes sense and is production-ready. |
I had similar concerns, especially since it doesn't support refs (or context?). @sebmarkbage points out it's a better testing story than anything we have currently, though. |
I think we should probably start talking about it and getting people to use it. We're a slower moving ship so it's harder to steer but getting feedback from people who can move a bit faster would be worthwhile and will perhaps get us to the best shape possible. We should probably enumerate any limitations though (and perhaps label it as "beta" or something just so people have an idea of what they're getting into) |
Also, move it to the bottom of the test utils documentation and mention that it's experimental.
This looks very useful! I'm curious as to why you'd want to limit this to one level of components, though..? Seems to me you'd be dealing with the same limitations (e.g. ref's missing) regardless of depth, and being able to test the whole composition of the UI could be valuable. |
@jareware: the motivation is to be able to test just one thing at a time (i.e., unit testing). Say Foo's render method returns |
@graue, the value in testing one-level-deep is not lost on me, and I think I see the possible misunderstanding now. So am I correct in assuming whereas previously we've been able to either render a complete component hierarchy using DOM emulation (e.g. |
@jareware Correct. |
Ok, now that that's cleared up, is there any reason why this couldn't be done for an entire component hierarchy instead of a single, "shallow" component? Anything like |
@graue let me know if you have any updates you want to make before this gets merged. Otherwise I'm happy with it. |
Add documentation for shallow testing
Thanks :) |
Aww, this doesn't seem to have made it into the changelog... |
Oops, our mistake… |
See #2393 for the original issue, and #2497 for the implementation.