Closed waspfreak closed 2 years ago
I have the same problem with react-native-testing-library
testing package too.
facing the same problem
Anyone has a resolution for this?
Came across same issue.
Add this to your jest config
"transformIgnorePatterns": [ "node_modules/(?!react-native|@shoutem|react-clone-referenced-element|native-base-shoutem-theme)" ]
This solution unfortunately didn't work, are there any other solutions? It's not great if we can't use Jest for testing apps with NativeBase :-(
Add this to your jest config
"transformIgnorePatterns": [ "node_modules/(?!react-native|@shoutem|react-clone-referenced-element|native-base-shoutem-theme)" ]
I am thinking of not not using Native Base... since it does not support testing with Jest . Or at least if we had a workaround? Could not configure my project to successfully use NativeBase and Jest.
I will share my jest.config.js
, this was enough to make it work for me:
module.exports = {
preset: 'react-native',
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
transformIgnorePatterns: [
'<rootDir>/node_modules/(?!(jest-)?react-native|native-base-shoutem-theme)'
]
};
My jest.setup.js
does nothing but import @testing-library/jest-native/extend-expect
.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have gone through these following points
Jest enzyme test Error Native Base
react-native, version
Expected behaviour
Actual behaviour
Try run test from my screen component
<!- import React from 'react'; import { Container, Content } from 'native-base';
const HomeScreen = props => { return (
); };
export default HomeScreen; -> Got this error
I add this in my transformIgnorePatterns: <!- transformIgnorePatterns: [ 'node_modules/(?!react-native|native-base|react-navigation|react-native-reanimated|react-navigation-redux-helpers|react-native-maps|@react-navigation/|@shoutem/theme|native-base-shoutem-theme|@shoutem/animation|@shoutem/ui|react-native-easy-grid|tcomb-form-native.*)/' ], ->
Is the bug present in both iOS and Android or in any one of them?
Yes
Any other additional info which would help us debug the issue quicker.
Important
If im using React native component the tst runs ok