forked from pass-culture/pass-culture-app-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
62 lines (61 loc) · 2.13 KB
/
jest.config.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const { excludeCollectCoverageFrom } = require('./jest.excludeCollectCoverageFrom.config')
module.exports = {
preset: 'react-native',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'^api(.*)$': '<rootDir>/src/api$1',
'^features(.*)$': '<rootDir>/src/features$1',
'^fixtures(.*)$': '<rootDir>/src/fixtures$1',
'^libs(.*)$': '<rootDir>/src/libs$1',
'^shared(.*)$': '<rootDir>/src/shared$1',
'^theme(.*)$': '<rootDir>/src/theme$1',
'^types(.*)$': '<rootDir>/src/types$1',
'^tests(.*)$': '<rootDir>/src/tests$1',
'^ui(.*)$': '<rootDir>/src/ui$1',
'^__mocks__(.*)$': '<rootDir>/__mocks__$1',
},
snapshotResolver: '<rootDir>/jest/custom-snapshot-resolver-native.js',
setupFiles: [
'<rootDir>/jest/jest.setup.ts',
'react-native-gesture-handler/jestSetup.js',
'@react-native-google-signin/google-signin/jest/build/setup.js',
],
setupFilesAfterEnv: ['./src/tests/setupTests.js'],
transform: {
'^.+\\.[jt]sx?$': 'babel-jest',
},
transformIgnorePatterns: [
'node_modules/(?!(jest-)?react-native' +
'|@react-navigation' +
'|@react-native' +
'|@ptomasroos/react-native-multi-slider' +
'|react-navigation' +
'|@react-native-firebase/analytics' +
'|@react-native-firebase/app' +
'|@react-native-firebase/remote-config' +
'|@sentry/react-native' +
'|react-native-geolocation-service' +
'|instantsearch.js' +
'/(?!(lib)))',
],
testMatch: ['**/*(?<!.(web|perf)).(?:test|spec).[jt]s?(x)'],
testPathIgnorePatterns: [
'\\.snap$',
'\\.native-snap$',
'\\.web-snap$',
'<rootDir>/node_modules/',
'<rootDir>/server/',
],
cacheDirectory: '.jest/cache',
clearMocks: true,
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'eslint-custom-rules/*.{js,jsx,ts,tsx}',
'!src/**/*.web.{js,jsx,ts,tsx}',
...excludeCollectCoverageFrom,
],
coveragePathIgnorePatterns: ['\\.web\\.(test|spec)', '/node_modules/', '/src/environment'],
collectCoverage: false,
// TODO(PC-20887): Investigate how to avoid timeouts in CI without increasing default timeout
testTimeout: 10_000,
}