-
-
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
css property does not get passed theme
in Vitest tests
#3237
Comments
Why is this an issue created in the Emotion's repo then? |
Because I didn't know what is the best place to post this. I have no idea if this is a I forgot to mention that my application root component uses the
I was hoping for someone to shed some light on how the |
We have this problem too and this happened after the dependency |
It seems like Vitest is not using a unified module resolution environment. Sometimes packages are resolved with one set of conditions and sometimes they are resolved with another set of conditions. This indicates a bug in Vitest |
🪙 I had kinda similar resolution issue. |
Current behavior:
When rendering a component from inside a test, the
theme
is not passed to thecss
property if usingThemeProvider
from@mui/material/styles
. However, the test passes ifThemeProvider
is imported from@emotion/react
.The component that is being tested
The test
My application root component uses the
ThemeProvider
frommui
and works as expected when it renders in development.To reproduce:
I have put up a minimal git repo that you can use to reproduce the issue.
https://github.com/cdan-youdo/react_vitest_emotion
Once checked out, just run
Expected behavior:
I am expecting the test to pass when the component is rendered inside the
ThemeProvider
from@mui/material/styles
.Environment information:
react
version: 18.3.1@emotion/react
version: 11.13.0The text was updated successfully, but these errors were encountered: