Skip to content
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

Multiple errors when using latest Emotion with Enzyme #3015

Open
ismailcherri opened this issue Mar 23, 2023 · 0 comments
Open

Multiple errors when using latest Emotion with Enzyme #3015

ismailcherri opened this issue Mar 23, 2023 · 0 comments

Comments

@ismailcherri
Copy link

Description:
We are currently using React with Emotion UI and we have some tests that still use Enzyme. We have currently the following versions:

"@emotion/react": "11.5.0",
"@emotion/styled": "11.3.0",
"enzyme": "3.11.0",
"enzyme-to-json": "3.6.2",
"@emotion/jest": "11.5.0",

When we tried to upgrade to the latest Emotion UI we encountered a lot of errors that are caused by this version.
I already opened a PR to report one of them (which was the first one to discover). Later, we discovered two more.
In summary here are the issues that happen while using the Emotion Enzyme Serializer:

  1. Nested Self Enclosed styled divs throw errors with shallow renders
  2. HOC with children function throws errors with shallow renders
  3. Using dive throws errors (this particular one happens with the latest emotion/react and emotion/css)

To reproduce:

I created this repository: https://github.com/ismailcherri/emotion-issues/tree/main.
In which there is a test file containing all the issues: https://github.com/ismailcherri/emotion-issues/blob/main/src/App.test.js

All the tests in the repository will pass if you change the package versions to the ones mentioned above.

Expected behavior:

The tests should work as expected

Environment information:

"@emotion/react": "11.5.0",
"@emotion/styled": "11.3.0",
"enzyme": "3.11.0",
"enzyme-to-json": "3.6.2",
"@emotion/jest": "11.5.0",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant