-
-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Updated the example for mocking the localstorage #6882
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
base: main
Are you sure you want to change the base?
Conversation
The mocking example for the `localStorage` which was provided earlier was breaking after the recent `jest` update (using `CRA - v3.0`). I've updated the example to mock through the `Storage` api. Sample code sandbox: https://codesandbox.io/s/43pn52xmz0?fontsize=14&previewwindow=tests
Look like the travis is hung. |
Is this documented somewhere with Jest? I'd like to verify that this is correct before we change it. |
I couldn't find anything related to this in their documentation. However whatever the snippet provided in our documentation doesn't work after the upgrade. The code sandbox link proves that. |
@iansu : Any comments? |
We were on an old version of Jest/jsdom previously which was lacking a Some relevant info: |
This may be a good solution: jestjs/jest#6798 (comment). It isn't overriding the implementation of |
Sorry for not replying or not taking any action against the comment. Do you want me to resubmit this PR with your recommendation? |
Using |
The mocking example for the
localStorage
which was provided earlier was breaking after the recentjest
update (usingCRA - v3.0
). I've updated the example to mock through theStorage
api.Sample code sandbox: https://codesandbox.io/s/43pn52xmz0?fontsize=14&previewwindow=tests