-
Notifications
You must be signed in to change notification settings - Fork 10
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
Cannot read properties of undefined (reading '__H') #20
Comments
we have a similar issue...have you found a solution @pitis |
@ositowang I believe the issue is that useState is not mocked. So if you create a way to mock |
https://preactjs.com/guide/v10/preact-testing-library#testing-preact-hooks using |
I spent all of yesterday trying to figure out how to get this working. This issue is quite old now, but on the off chance it might help anyone else with this problem here's what I've found.
However, if you're using Preact 10, then you can import Unfortunately, at the time I'm writing this, the testing documentation for the latest version of Preact currently recommends importing |
Hey there guys, I am trying to test some of my custom hooks that work in prod, but don't work with @testing-library/preact-hooks.
I am trying to write some unit tests where I check the height of a banner. Initially I used jest, but now I'm using vitest, which has an API almost identical to jest.
All the tests pass besides the ones on the custom hooks. This seems like a package issue.
Thanks!
Stack Info:
Preact: 10.11.3
Vite: 4.0.0
Vitest: 0.27.0
@testing-library/preact-hooks: 1.1.0
The text was updated successfully, but these errors were encountered: