-
-
Notifications
You must be signed in to change notification settings - Fork 203
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 mock "TypeError: Cannot read properties of undefined (reading 'top')" #551
Comments
@eppisapiafsl can you provide more details about the test you are trying to run? |
Hey @LucasGarcez Yes, we do have
I'm using the @testing-library/react-native to render the screens, I have a custom function that isolates my screen so no other Provider styles impact the tests
I did a patch reverting #449 and the error got fixed
|
@eppisapiafsl I couldn't replicate your issue. Can you provide the real code? The component you are testing, the imports, and where the |
We had the same problem but an undefined width from useSafeAreaFrame(). The first test in a suite always pass but not the rest. It was this mock reset that caused it.
|
Nice find, @Ejdamm ! Confirmed, it only happened when we reset the mocks in our test. Thank you so much @LucasGarcez This might not be a bug in the library itself but a config issue; I haven't been able to reproduce it in a base react-native project 🤔 |
so in theory, the solution is to change the calls to be |
Yep that is what we did |
When upgrading from 4.13.0 to 4.13.1, start facing a TypeError due to a recent mock update #449
Following the guide, I included the
react-native-safe-area-context
to my transformIgnorePatternsThe text was updated successfully, but these errors were encountered: