-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.setup.js
34 lines (30 loc) · 1.11 KB
/
jest.setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { jest } from '@jest/globals';
jest.mock('@react-native-async-storage/async-storage', () =>
require('@react-native-async-storage/async-storage/jest/async-storage-mock')
);
jest.mock('@expo/vector-icons', () => {
return { Ionicons: () => 'Ionicons' }
});
jest.mock('expo-font', () => ({
useFonts: jest.fn().mockReturnValue([true]), // Simulate fonts are loaded
}));
module.exports = {
preset: "jest-expo",
testEnvironment: "jsdom",
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|svg)$': '<rootDir>/__mocks__/fileMock.js',
'^@expo/vector-icons(.*)$': '<rootDir>/node_modules/@expo/vector-icons$1'
},
transformIgnorePatterns: [
"node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)"
],
testMatch: [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[tj]s?(x)"
],
clearMocks: true,
preset: "react-native",
setupFilesAfterEnv: [
"@testing-library/jest-native/extend-expect",
"<rootDir>/jest.setup.js"],
};