-
Notifications
You must be signed in to change notification settings - Fork 233
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
Deprecate @testing-library/react-hooks
#849
Comments
Yep, but there’s a few things I want to do first:
Any assistance with these tasks is appreciated. |
Description @testing-library/react now has a renderHook api. See: - testing-library/react-testing-library#991 - testing-library/testing-library-docs#967 - testing-library/react-hooks-testing-library#849
Is there any recommendations on how to do error handling using the renderHook from react-resting-library? |
Your questions regarding that are better suited to that repo |
It's still a work-in-progress and I haven't looked at it in ages, but I'm getting a new laptop and didn't want to lose it, so there is now a branch with the beginnings of the migration guide for React 18. If anyone has more capacity than me to add to it, please feel free to work off that branch as I'm not sure when I will have time to complete it. |
I imagine there are a lot of codebases that will take a little time to upgrade to 18 and won't be able to use the latest testing-library that includes @testing-library/react-hooks. Should keep this one around. The notice at the top of the README is excellent and made it clear what the options are As always, thank you for @mpeyper and anyone else who contributed |
The version of renderHook included with the latest @testing-library/react is far more limited than this library supports and their take is "well instead do testing on components that use your custom hook" which sounds all good until you're talking about an existing codebase with dozens of tests and much of the reason for outsourcing the code to hooks in the first place was precisely because they are things that are far more difficult to assert on "visually". And that isn't even getting into the fact that just having to refactor all those tests so we can update to React 18 adds a shedload of work for no good cause. |
This makes no sense. The React team promotes the use of hooks to have better isolation, thus better testing among other things. But then the testing tools says that now we have to test hooks coupled to components. These are 2 opposite directions. This library did a fantastic job regarding hooks in isolation. The new subset within |
Now that testing-library/react-testing-library#991 & callstack/react-native-testing-library#923 are merged, this library can be deprecated
CC/ @testing-library/react-hooks
The text was updated successfully, but these errors were encountered: