Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6290

expo + jest: unable to run test for a component containing icon from @expo/vector-icons/MaterialIcons

$
0
0

In my react-native expo app, I've successfully setup jest and wrote a test. But when I run it, I get the following error:

● Test suite failed to run    TypeError: Cannot read property 'default' of undefined      at _default (node_modules/@expo/vector-icons/src/createIconSet.tsx:110:28)      at Object.<anonymous> (node_modules/@expo/vector-icons/src/AntDesign.ts:5:16)      at Object.<anonymous> (node_modules/@expo/vector-icons/src/Icons.ts:1:1)

Here is my jest.config.js file:

module.exports = {    preset: 'jest-expo',    setupFilesAfterEnv: ['<rootDir>/setupTest.ts'],    moduleDirectories: ['node_modules', 'src/testing-setup', '__dirname'],};

Please help me look into this issue; I've spent 2 days looking at various similar issues (it looks like icons don't play nice with jest). But no solution so far has worked for me. The use of preset: 'jest-expo' is supposed to also include @expo/vector-icons...


Viewing all articles
Browse latest Browse all 6290

Trending Articles