testing-library/preact-testing-library

Support testing hooks in isolation

CarsonMcKinstry opened this issue ยท 6 comments

  • preact-testing-library version: any
  • preact version: X
  • node version: v12.13.1
  • npm (or yarn) version: yarn - 1.22.4

Hi! My team got into the situation where we needed to test some preact hooks, and we were looking for a way to do this in isolation and we tried the @testing-library/react-hooks library. Due to the reliance on react-test-renderer the react hooks testing library will probably never be compatible with preact.

With that being said, we decided to port the current @testing-library/react-hooks implementation to use preact, and we open sourced it on npm under @trivago/preact-hooks-testing-library.

Github Repo: https://github.com/trivago/preact-hooks-testing-library
npm: https://www.npmjs.com/package/@trivago/preact-hooks-testing-library

The big question at this point, is whether or not this library would be a good candidate to include under the @testing-library namespace?

Hey @CarsonMcKinstry,

I'm currently working on a feature to support multiple renderers (react-test-renderer and react-dom) by abstracting them away from the core functionality, so in theory it should be able to support preact as well.

It's likely that we'd still want that variation to be it's own package, but your port could become a plugin real soon if you wanted it to be.

I think there's value in having a separate package actually. Makes it easier for consumers.

That's brilliant! You're more than welcome to bring it in the testing library family both in GitHub and npm. Let me know if that's what you'd like to do and I'll give you access ๐Ÿ‘

@kentcdodds This would be great! Just let me know what all needs to happen from our side ๐Ÿ˜„

Hi @CarsonMcKinstry,

I've just added you and the other two publishers to the npm and github org. Let me know what else you need.

Oops! Forgot to update this issue! We moved the library and npm package over to the @testing-library/preact-hooks repo ๐Ÿ˜ This issue can be safely closed.