-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathjest.preset-mobile.js
More file actions
51 lines (48 loc) · 1.35 KB
/
jest.preset-mobile.js
File metadata and controls
51 lines (48 loc) · 1.35 KB
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
51
// A preset cant extend another preset, so we need to import and inherit the RN config
// https://github.com/facebook/react-native/blob/main/jest-preset.js
const reactNativePreset = require('react-native/jest-preset');
const esModules = [
'jest-react-native',
'react-native',
'@react-native',
'@react-native-community',
'@coinbase/cds-mobile',
'react-native-webview',
'@bugsnag/react-native',
];
const config = {
...reactNativePreset,
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif)$': 'identity-obj-proxy',
},
setupFiles: [...reactNativePreset.setupFiles],
setupFilesAfterEnv: ['jest-extended', '@testing-library/jest-native/extend-expect'],
testMatch: ['**/*.test.[jt]s?(x)'],
testPathIgnorePatterns: [
'/node_modules/',
'/cjs/',
'/dts/',
'/esm/',
'/lib/',
'/mjs/',
'/__fixtures__/',
'.*\\.d\\.ts',
],
testRunner: 'jest-circus/runner',
transform: {
...reactNativePreset.transform,
// Required to find the root babel config when jest is ran in sub-folders
'^.+\\.(js|ts|tsx)$': ['babel-jest', { rootMode: 'upward' }],
},
transformIgnorePatterns: [`node_modules/(?!(${esModules.join('|')}))`],
cacheDirectory: '.nx/cache/tools/jestTransforms',
coverageThreshold: {
global: {
branches: 5,
functions: 5,
lines: 5,
statements: 5,
},
},
};
module.exports = config;