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-emotion] document is not defined when using jest-enzyme with React Native #1790
Comments
|
Thank you for your quick response! I will try to make this work with JSDOM injection. Maybe |
That probably would be the best thing to do right now 👍 |
Got it. I will get back to you as soon as I have any findings. |
If we dive 3 times into a component: wrapper
.find(Container)
.dive()
.dive()
.dive()
.prop('style') we will be able to get the style prop. I'm not sure if this is the ideal solution though. @Andarist what do you think? |
If it can be abstracted within |
Currently, jest-styled-components is also having issues with React Native: styled-components/jest-styled-components#294. It had supposedly worked in the past in v6 (although I have never been able to get it to work on both v6 and v7) by directly accessing style prop like this:
but of course that would not work since the component would have no props at all. Diving into component three times can solve both issues. Am happy to open a PR if you're good with this 😄 |
Current behavior:
Asserting
toHaveStyleRule
on ashallow
rendered React Native component will fail with errorReferenceError: document is not defined
To reproduce:
Expected behavior:
toHaveStyleRule
should pass.Environment information:
react
version:16.9.0
react-native
version:0.61.5
@emotion/core
version:^10.0.28
@emotion/native
version:^10.0.27
jest-emotion
version:^10.0.27
The text was updated successfully, but these errors were encountered: