You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the fullWidth variable which has been imported from a different file is reported as not defined when using @emotion/babel-plugin inside a Jest test. The styles work when @emotion/babel-plugin is not used. Making minor adjustments to the styles, like removing the @media rule, or changing the order of the nesting of button and @media mean also result in the variable no longer being reported as not defined.
Thanks for filing a report - I've narrowed down the issue to the toInputTree function and I think that I've also recognized how the logic is broken. Gonna be working on a fix soon.
Is there an update on this? We've bumped into this exact issue. Our workaround is to fall back and use the old babel-plugin-emotion when running the tests, if anyone's interested.
Current behavior:
Given a very specific set of styles:
the
fullWidth
variable which has been imported from a different file is reported as not defined when using @emotion/babel-plugin inside a Jest test. The styles work when @emotion/babel-plugin is not used. Making minor adjustments to the styles, like removing the@media
rule, or changing the order of the nesting ofbutton
and@media
mean also result in the variable no longer being reported as not defined.To reproduce:
npm i
npm run test
The tests fail like so
Expected behavior:
The test should pass. The variable
fullWidth
has been defined - it is imported on line 3 of src/Component.jsxEnvironment information:
react
version: 17..0.2@emotion/styled
version: 11.8.1@emotion/babel-plugin
version: 11.9.2The text was updated successfully, but these errors were encountered: