testing-library/react-hooks-testing-library

Deprecate `@testing-library/react-hooks`

MichaelDeBoey opened this issue · 7 comments

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

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.

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

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 @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?