Skip to content
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

Open
MichaelDeBoey opened this issue May 26, 2022 · 7 comments
Open

Deprecate @testing-library/react-hooks #849

MichaelDeBoey opened this issue May 26, 2022 · 7 comments

Comments

@MichaelDeBoey
Copy link
Member

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

@mpeyper
Copy link
Member

mpeyper commented May 27, 2022

Yep, but there’s a few things I want to do first:

  • publish a migration guide
    • I’ve been working on this on and off for a while now
  • publish deprecation messages
  • deprecate the package in npm
  • archive this repo

Any assistance with these tasks is appreciated.

@chrisngobanh
Copy link

Is there any recommendations on how to do error handling using the renderHook from react-resting-library?

@joshuaellis
Copy link
Member

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

@mpeyper
Copy link
Member

mpeyper commented Sep 28, 2022

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.

@gabrielrotbart
Copy link

gabrielrotbart commented Sep 28, 2022

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

@shawnharvell
Copy link

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.

@sospedra
Copy link

sospedra commented Apr 5, 2023

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 @testing-library/react-* is subpar by a margin. Is there a way to get more clarification? Did I miss the reasoning on why are we changing the paradigm?

@testing-library testing-library locked and limited conversation to collaborators Apr 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants