-
Notifications
You must be signed in to change notification settings - Fork 2.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
Icon component is not working with jest #2657
Comments
I tried running jest test case for Icon |
@bibekluitel I'm having this exact same issue. I've tried mocking Platform as per the above, but this still doesn't work. Were you able to resolve this? |
@edwardmsmith i was able to resolve it after mocking a icon component.
Try mocking all components which breaks Jest. |
See my comment in react-native-vector-icons for other fix. oblador/react-native-vector-icons#1046 (comment) cf.
|
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).
I ended by this solution jest.mock('native-base/dist/src/basic/Icon', () => jest.genMockFromModule('native-base/dist/src/basic/Icon')); |
+ The issue: Our jest runner for our tests does not play nice with the react-native-vector-icons Icon object on the build machine. So we override the Icon constructor post-installation like this thread explains: GeekyAnts/NativeBase#2657 Worth noting: locally, everything worked fine. The issue was specific to the build machine, as far as I could assess.
+ The issue: Our jest runner for our tests does not play nice with the react-native-vector-icons Icon object on the build machine. So we override the Icon constructor post-installation like this thread explains: GeekyAnts/NativeBase#2657 Worth noting: locally, everything worked fine. The issue was specific to the build machine, as far as I could assess.
+ The issue: Our jest runner for our tests does not play nice with the react-native-vector-icons Icon object on the build machine. So we override the Icon constructor post-installation like this thread explains: GeekyAnts/NativeBase#2657 Worth noting: locally, everything worked fine. The issue was specific to the build machine, as far as I could assess.
Having a similar problem where Calendar dates (using MUI calendar icons) are not correctly accessible on an Ubuntu agent. The tests run fine on a local machine but the fields cannot be accessed on the agent in a consistent manner. Any solution here? |
Icon component is breaking while running with jest.
#package.json
node: v11.13.0, npm : 6.7.0, react-native
Expected behaviour
Test should have rendered it properly.
Actual behaviour
It breaks throwing error
Steps to reproduce
Initilaize a new project with
react-native init AwesomeProject
npm install native-base --save
Add
into jest of package.json
npm install
Add Icon component into App.js
npm run test
Is the bug present in both iOS and Android or in any one of them?
N/A
Any other additional info which would help us debug the issue quicker.
The text was updated successfully, but these errors were encountered: