-
Notifications
You must be signed in to change notification settings - Fork 364
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
@lungui/macro module undefined in test with jest and react-testing-library #721
Comments
Hey @Spy-Seth. Yeah, this is weird. Well I've never had this problem with using macros in tests. Could you please post the failing unit test? |
In fact it seems my babel configuration was not loaded in test: I'm using 'ts-jest' (https://kulshekhar.github.io/ts-jest/) to test my TS files. And it does not load the babel configuration by default: https://kulshekhar.github.io/ts-jest/user/config/babelConfig. After updating my setup to correctly have the macro running, I still got an internal error in the lingui macro code 😢
I have never written babel macro so I'm not sure what I could do help to fix this |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I have same issue, |
Same issue with version |
Since this issue it's closed, you can open a new one with a reproduction repo and I'll could help much more than just reading same issue :) In our examples folder, create-react-app contains a testing-library suite where we test our pre-releases and works as expected, so i'm inclined to think that it's something related to your configuration. Anyways, feel free to open a new issue with a repro link and I'll help you there! |
@armandabric did you find out what the cause was, I am hitting the same error and have run out of ideas |
fyi I made a standalone repro and issue #1197 |
FYI to make this work follow #1197 (comment) |
Describe the bug
When I try to render a component that use
Trans
andPlural
tag from@lungui/macro
, the imported component are 'undefined':This lead to failing render as
undefined
is not a valid React component.For now I have to mock component imported from @lingui/macro in my test:
Additional context
Add any other context about the problem here.
3.0.0-13
Babel version
Your Babel config (e.g. `.babelrc`)
The text was updated successfully, but these errors were encountered: