-
Notifications
You must be signed in to change notification settings - Fork 71
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
[Jest]: Import of styles yield empty object? #86
Comments
Hi @StevenLangbroek, this plugin only works within IDE environments. This is a limitation of TypeScript, as plugins aren't loaded during builds. This is unfortunate, and as soon as TypeScript does support this, we'll be sure to add whatever is needed. You can read more about that here: On your exact issue, it's likely that your app and Storybook have Webpack loaders to handle CSS modules. For Jest, there are libraries like these that might help?
It looks like you have a file that should be handling this already ( |
Fixed by using https://www.npmjs.com/package/jest-css-modules-transform. If you feel it's worth documenting I can add a line to README. |
Oh wow thanks for the thoughtful response 🙇 . Yeah that was exactly the issue. Let me know if you want me to write this into README.. |
NP! I'll make an update in the next few days, that's a great idea - thanks ;) And glad I could help. |
Describe the bug
We're using
@babel/preset-typescript
andjest
(usingbabel-jest
). Mystyle
imports yield empty objects, leading to snapshot tests failing.I'm unsure how to pin down exactly what's causing this so what further info to provide
To Reproduce
Expected behavior
What more info can I provide to figure out what's going on here?
The text was updated successfully, but these errors were encountered: