I'm trying to get Jest working with my React app, but I get this error when running 'sudo npm run test':
FAIL __tests__/App.test.js
● Test suite failed to run
TypeError: Cannot read property 'directEventTypes' of undefined
at Object.directEventTypes (node_modules/react-native-gesture-handler/GestureHandler.js:47:24)
at Object.<anonymous> (node_modules/react-native-gesture- handler/Swipeable.js:11:1)
I did some poking around and found that this only happens when I import App from App.js in my test file:
import App from '../App';
describe('<App />', () => {
it('has 1 child', () => {
const tree = renderer.create(<App />).toJSON();
expect(tree.children.length).toBe(1);
..
I searched around, and no one seems to have a fix for this.
I tried everything located here https://github.com/react-navigation/react-navigation/issues/5264 and here https://github.com/kmagiera/react-native-gesture-handler/issues/344#issuecomment-440572584, but nothing works.
Aucun commentaire:
Enregistrer un commentaire