-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjest.config.ts
50 lines (48 loc) · 1.79 KB
/
jest.config.ts
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { pathsToModuleNameMapper } from 'ts-jest';
import type { JestConfigWithTsJest } from 'ts-jest';
const jestConfig: JestConfigWithTsJest = {
preset: 'react-native',
moduleFileExtensions: ['ts', 'tsx', 'js'],
transform: {
'^.+\\.(js|jsx)$': '<rootDir>/node_modules/babel-jest',
'\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: 'tsconfig.spec.json',
},
],
},
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$',
testPathIgnorePatterns: ['\\.snap$', '<rootDir>/node_modules/'],
cacheDirectory: '.jest/cache',
transformIgnorePatterns: [
'node_modules/(?!(jest-)?@?react-native|@react-native-community|@react-navigation|@react-native-device-info|@notifee|@miblanchard/react-native-slider|victory-*|@shopify/react-native-skia|react-native-reanimated|react-redux)',
],
setupFiles: [
'<rootDir>/jest.vendor-mocks.js',
'<rootDir>/node_modules/react-native-gesture-handler/jestSetup.js',
'<rootDir>/node_modules/react-native-reanimated/src/reanimated2/jestUtils.ts',
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
moduleDirectories: ['node_modules', '<rootDir>'],
moduleNameMapper: {
...pathsToModuleNameMapper({
'@app/*': ['src/*'],
'@assets/*': ['assets/*'],
'@shared/*': ['src/shared/*'],
'@images': ['assets/images/index'],
'@features/*': ['src/features/*'],
'@screens': ['src/screens/index'],
'@screens/*': ['src/screens/*'],
'@entities/*': ['src/entities/*'],
'@jobs/*': ['src/jobs/*'],
'@widgets/*': ['src/widgets/*'],
}),
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|html)$':
'<rootDir>/assetsTransformer.js',
'^uuid$': require.resolve('uuid'),
},
restoreMocks: true,
clearMocks: true,
};
export default jestConfig;