-
Notifications
You must be signed in to change notification settings - Fork 273
Jest Warnings: You are trying to import a file after the Jest environment has been torn down. #658
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
Comments
This is not related to this library. It's something that likely should be mocked in the official react-native jest preset. Feel free to propose such change. Meanwhile you should be good with e.g. this: jest.mock('react-native/Libraries/LogBox/LogBox'); |
Thanks @thymikee - especially for the suggestion rather than just a close. |
Yea, it's a bummer it's not properly mocked in the source, but I believe it should be done there, instead of just patching it in this library. That's why I encourage folks to target their efforts to the right place. |
@thymikee, I just wanted to thank you for the mock you suggested. It solved my issue. I was previously on /Users/USER/Documents/code/project-name/node_modules/react-native/Libraries/LogBox/Data/LogBoxData.js:104
ExceptionsManager.handleException(error, true);
TypeError: ExceptionsManager.handleException is not a function
at reportLogBoxError (/Users/USER/Documents/code/project-name/node_modules/react-native/Libraries/LogBox/Data/LogBoxData.js:108:21)
at Immediate.<anonymous> (/Users/USER/Documents/code/project-name/node_modules/react-native/Libraries/LogBox/Data/LogBoxData.js:214:7) After adding the following lines to my jest.mock('react-native/Libraries/LogBox/LogBox'); It's unfortunate that an upgrade to React Native can still break unit tests at a fundamental level like this, but your answer is a lifesaver for those of us in production work. |
Describe the bug
Getting lots of warnings when running tests with Jest:
I believe that this is likely this library due to testing-library/native-testing-library#132 but I may be wrong
Expected behavior
No warnings
Steps to Reproduce
I'm not exactly sure, as I don't know where this is being triggered from. The stack trace is originating within LogBoxData.
Versions
The text was updated successfully, but these errors were encountered: