-
-
Notifications
You must be signed in to change notification settings - Fork 216
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
Error when adding a spy on localStorage #1377
Comments
…y-on-localstorage fix: [#1377] Makes it possible to spy on Storage.prototype methods
Thank you for reporting @sybers! 🙂 I have fixed the error when deleting a property, but it seems like it will not be possible to spy on the instance methods with Jest (it works with Vitest), as Jest relies on In the latest version of Happy DOM, I have made it possible to spy on Example: jest.spyOn(Storage.prototype, 'getItem').mockImplementationOnce(() => () => {
throw new Error('error');
}); Read more about the release: |
Thanks alot for fixing this @capricorn86 !
That's how I used to to with Jest so everything good :) |
Describe the bug
Hey,
I'm trying to add a spy on
localstorage.setItem
and I'm getting an error.I'm using
@happy-dom/[email protected]
.To Reproduce
If you add the code below to any tests:
Jest will fail with the following error:
Please let me know if you need more information, Thanks !
PS: This could be related to #1368
The text was updated successfully, but these errors were encountered: