-
Notifications
You must be signed in to change notification settings - Fork 24
/
jest.web.config.js
53 lines (51 loc) · 1.98 KB
/
jest.web.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
const base = require('./jest.config')
const { excludeCollectCoverageFrom } = require('./jest.excludeCollectCoverageFrom.config')
module.exports = {
...base,
preset: '',
testEnvironment: './jest/fixJestEnvironmentJsdom.ts',
snapshotResolver: '<rootDir>/jest/custom-snapshot-resolver-web.js',
setupFiles: [...base.setupFiles, '<rootDir>/jest/jest.web.setup.ts'],
setupFilesAfterEnv: [...base.setupFilesAfterEnv, '<rootDir>/jest/jest.web.setupAfterEnv.ts'],
testMatch: ['**/*(?<!.(?:native|ios|android|perf)).(?:test|spec).[jt]s?(x)'],
moduleFileExtensions: ['web.tsx', 'web.ts', 'web.js', 'web.jsx', ...base.moduleFileExtensions],
moduleNameMapper: {
...base.moduleNameMapper,
'^react-native$': 'react-native-web',
'^react-native-svg$': 'react-native-svg-web',
'^react-native-linear-gradient$': 'react-native-web-linear-gradient',
'\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.ts',
'\\.(css|less)$': '<rootDir>/__mocks__/fileMock.ts',
// temporary mock things until implemented
'react-native-fast-image': '<rootDir>/__mocks__/fragmentMock.ts',
},
collectCoverageFrom: ['src/**/*.web.{js,jsx,ts,tsx}', ...excludeCollectCoverageFrom],
testPathIgnorePatterns: [
...base.testPathIgnorePatterns,
'.*(/tests?/.*.(native|ios|android).(test|spec)).(tsx?)$',
],
transform: { ...base.transform },
transformIgnorePatterns: [
'node_modules/(?!' +
'firebase' +
'|@firebase' +
'|@ptomasroos/react-native-multi-slider' +
'|react-native-svg-web' +
'|react-native-animatable' +
'|react-native-web' +
'|react-native-modal' +
'|react-native-calendars' +
'|react-native-swipe-gestures' +
'|react-native-permissions' +
'|react-native-qrcode-svg' +
'|instantsearch.js' +
'|react-native-intersection-observer' +
'|react-native-reanimated' +
')',
],
verbose: true,
globals: {
__DEV__: true,
},
}