ThemeProvider not providing theme to styled components in Vitest #2418
Unanswered
chris-susantooo
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Might be related to this: vitest-dev/vitest#1562 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all! I encountered an issue about emotion not able to access theme from the ThemeProvider component by Theme UI.
To reproduce the issue
Codesandbox: run
yarn test
in linkAs seen in the test cases, emotion (useTheme hook, styled components, etc.) did not receive the theme context from the
ThemeProvider
from Theme UI.In the custom
ThemeProvider.tsx
, we have:In
ThemeProvider.test.tsx
, we have:And the test results:
Expected behavior
As mentioned in the docs
Emotion should be able to receive the theme context in Vitest, just like in production. Did I miss any project setup that leads to this? Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions