-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[jest.mock + Typescript] You are loading @emotion/react when it is already loaded. Running multiple instances may cause problems. #1727
Comments
Thanks for the report - I'm going to take a look at this later. |
Thanks @Andarist |
Hm, this is an interesting case. Still digging into this - I need to get more familiar with what jest is actually doing under the hood to isolate tests etc. |
I was able to find a way to not show the error in jest. Going to the This still keeps the error in all the other expected "platforms". PS - I know this is probably not the solution you were looking for, but after a few hours I can't understand why jest loads 2 instances of @emotion/styled. Do you have any idea why that is happening? |
Nope, I've tried to reach out to a jest maintainer, but haven't got an answer so far. Given the fact that this check is primarily meant for browsers, maybe we should just log it only in them. That being said - it could still potentially be helpful for test-runners, but only if we can log it reliably and currently it seems that we can't. |
I've reported it to the Jest team and prepared a PR to mute this warning in Jest for the time being: #1806 . Should get released in a couple of days. |
Thank you very very much @Andarist :) |
Current behaviour:
Inside a unit test, after using jest.mock('./MyComponent') we get the error message added at #1677
To reproduce:
Option 1 - Cloning:
Option 2 - Step by step after "npx create-react-app my-app --typescript":
npm test
Expected behaviour:
No warning should be seen in the console
Versions
React - latest
typescript - 3.7.4
react: 16.12.0
@emotion/react - 11.0.0-next.11
@emotion/styled - 11.0.0-next.11
The text was updated successfully, but these errors were encountered: