-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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 breaking when importing component using state class property #22437
Comments
Could you post a minimal reproduction? 1 component, 1 test, keep adding your specific details until it's reproducible. It is hard to help you without more context. |
Sure, here it goes The test:
the component with state defined inside constructor, working :
The test result for the above example:
The component with state class property :
The test result for the above example:
Thanks for the help |
@KalebPortillo If you use |
Jest config file:
packege.json
|
Same issue. If the component has a class property, e.g.:
getting the error |
I've got the same problem on React Native 0.57.7. It's strange because the Jest preprocessor
Any workarounds? |
@KalebPortillo The workaround is #22175 (comment). |
Hey @sasurau4 , it worked! Just for someone that may endup here in this issue, the workaround consists in:
|
Attempt to fix jest test issue while keeping react native working by installing c7b02730c762ab8bebe45fd57cd8ea69290e99ec rn commit see issues: facebook/react-native#22437 facebook/react-native#22175
Attempt to fix jest test issue while keeping react native working by installing c7b02730c762ab8bebe45fd57cd8ea69290e99ec rn commit see issues: facebook/react-native#22437 facebook/react-native#22175 @warning - jest integration tests have not been tested and might be broken due to jest haste config removal (unlikely though). - react-native app as not been tested (only tests) and might be broken as well (at launch time). - incompatibility issues may have appeared du to deprecation and breaking changes (unlikely).
Attempt to fix jest test issue while keeping react native working by installing c7b02730c762ab8bebe45fd57cd8ea69290e99ec rn commit The attempt didn't work out as r-n refused the commit due to the following comment: facebook/react-native#23326 (comment) See my comment here for correct fix patching react-native-vector-icons: GeekyAnts/NativeBase#2657 (comment) Original issues letting me to ugrade react-native: facebook/react-native#22437 facebook/react-native#22175 @warning - jest integration tests have not been tested and might be broken due to jest haste config removal (unlikely though). - react-native app as not been tested (only tests) and might be broken as well (at launch time). - incompatibility issues may have appeared du to deprecation and breaking changes (unlikely).
Attempt to fix jest test issue while keeping react native working by installing c7b02730c762ab8bebe45fd57cd8ea69290e99ec rn commit The attempt didn't work out as r-n refused the commit due to the following comment: facebook/react-native#23326 (comment) See my comment here for correct fix patching react-native-vector-icons: GeekyAnts/NativeBase#2657 (comment) Original issues letting me to ugrade react-native: facebook/react-native#22437 facebook/react-native#22175 @warning - jest integration tests have not been tested and might be broken due to jest haste config removal (unlikely though). - react-native app as not been tested (only tests) and might be broken as well (at launch time). - incompatibility issues may have appeared du to deprecation and breaking changes (unlikely).
Environment
Description
When I import a component like the example below:
the test produces the following error:
This only happens when the state is defined as class property, when I define it inside the constructor, the test runs normally
The text was updated successfully, but these errors were encountered: