Please provide the following:
- SDK Version: 42
- Platforms(Android/iOS/web/all): all
Apologies if this is not the right place, I’m having issues running unit tests with expo. I’m getting this error when I run my test (jest, jest-expo, testing-library/react-native) :
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)
The error seems to come from expo vector icons
. I believe I have correctly setup my tests:
- jest.config.js
module.exports = {
preset: 'jest-expo',
setupFilesAfterEnv: ['<rootDir>/setupTest.ts'],
transformIgnorePatterns: [
'node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)',
],
moduleDirectories: ['node_modules', 'src/testing-setup', '__dirname'],
};
- test:
describe('PageTest01', () => {
test('it should render', () => {
const { getByTestId } = render(<PageTest01 />);
expect(getByTestId('page')).toBeDefined();
});
});
The component under test does not even contain any icon