Skip to content

Support testing hooks in isolation #25

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

Closed
CarsonMcKinstry opened this issue Jun 5, 2020 · 6 comments
Closed

Support testing hooks in isolation #25

CarsonMcKinstry opened this issue Jun 5, 2020 · 6 comments

Comments

@CarsonMcKinstry
Copy link

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

@CarsonMcKinstry CarsonMcKinstry changed the title Include the ability to test hooks in isolation Support testing hooks in isolation Jun 5, 2020
@kentcdodds
Copy link
Member

kentcdodds commented Jun 5, 2020 via email

@mpeyper
Copy link
Member

mpeyper commented Jun 5, 2020

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.

@kentcdodds
Copy link
Member

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

@CarsonMcKinstry
Copy link
Author

CarsonMcKinstry commented Jun 8, 2020

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 😄

@kentcdodds
Copy link
Member

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.

@CarsonMcKinstry
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants