-
-
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
Theme is not applied to styled components props in Vitest #2955
Comments
Please recheck if your |
None of that seems to be the case. If I switch to styled-components and do the exact same setup with typings definition, ThemeProvider, babel plugin... the styled API gets correct theme. |
I did some further testing in the codesandbox attached above and it seems like the issue in the babel plugin. Is there a way you could confirm that this issue is on emotion side or I should direct it on Vitest? |
Yes, I've found out yesterday that the Babel plugin was messing things up - but didn't have time to respond here to you. I hope that by removing the Babel plugin temporarily you are able to unblock yourself. That being said - this is Vite's bug. I've created a PR that explains the issue and fixes it in Vite here: vitejs/vite#11259 |
Thank you very much for the effort. Currently it is a blocker we cannot really remove since without the babel plugin we are not able to use component referencing in styled. Hope this gets resolved soon :) |
Since this isn't really our issue - I will close this one here. Let's wait on the Vite maintainers to handle my PR. |
Facing the similar issue after jest 29 upgrade. |
Current behavior:
I am using latest React, Vitest, Vite, Emotion and during testing ThemeProvider does not populate theme prop in styled.div syntax. This happens only during testing.
To reproduce:
https://codesandbox.io/s/vitest-and-emotion-styled-o3i7jm
Expected behavior:
ThemeProvider should provide me correct theme prop when using styled in testing environment.
Environment information:
react
version: 18.2.0@emotion/react
version: 11.10.5The text was updated successfully, but these errors were encountered: