-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Tried to render a non renderable component #18
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
Comments
@kentcdodds i added a PR implementing the mentioned fix |
Hi @shrynx! The reason is that it overcomplicates the library (both in implementation and use) and goes against the guiding principles. I would therefore recommend adding a Based on your project I think you came up with an alternative. I'm glad. Good luck! And thanks for understanding :) |
…his API (testing-library#18) * Add bindQueriesToElement utility function for libraries using this API * Add documentation and update contributors * Rename to bindElementToQueries as this seems to be more appropriate Closes testing-library#17
docs: ✏️ add documentation
Uh oh!
There was an error while loading. Please reload this page.
Thanks for making this project. This will simply a lot of my tests and test configs.
I am starting to replace enzyme with it wherever possible
react-testing-library
version: 1.6.0node
version: 9.4npm
(oryarn
) version: 1.5.1jest
version: 22.4.2Relevant code or config
What you did:
Tried to render a non renderable component , to test if my custom console errors are thrown
What happened:
render throws error on non-renderable component rather than silently failing
Reproduction repository:
currently i am playing with
react-testing-library
and trying to replace enzyme on a small react util i wrote.This is a sample test currently written in enzyme, but on my local branch i am replacing it
react-testing-library
.https://github.com/shrynx/react-render-function/blob/master/tests/index.test.js#L118
Problem description:
TestComponent shouldn't be able to render without Children, and for missing Children i am throwing errors from inside TestComponent which i want to test for using jest (i.e, test console.error message).
But the test fails at render itself throwing, rather than throwing my error.
Earlier i was using
enzyne
and usedshallow
in the same way i used render above and this used to work.Suggested solution:
The render should fail silently or better if could be configured to not throw error, maybe like
I can try making a PR for it. should be easy to put try catch on ReactDOM.render and not throwing errors only if user has configured not to.
The text was updated successfully, but these errors were encountered: