enzyme-adapter-react-18
enzyme-adapter-react-18 copied to clipboard
Fixed crash when calling .simulate on an emotion styled component
This fixes #12 for me locally. Without this fix, I had this error 6 times in a pretty big private codebase. This fix doesn't result in any problems in this codebase, while it does have ~1500 enzyme unit test cases and ~250 styled components. It also makes heavy use of Material UI V5, which also uses emotion. I made a minimum reproducible example here: https://github.com/leroydev/enzyme-adapter-react-emotion-issue and also included a way to test this fix by inlining ReactEighteenAdapter.ts with the proposed change.
After cloning this repo and running npm i
, the old and new behavior can be compared by running npm run original-test
/npm run changed-test
🙂