-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
44 lines (40 loc) · 1.3 KB
/
jest.config.js
File metadata and controls
44 lines (40 loc) · 1.3 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
const { pathsToModuleNameMapper } = require('ts-jest');
const jestExpoPreset = require('jest-expo/jest-preset');
const { compilerOptions } = require('./tsconfig.json');
const tscPaths = Object.entries(compilerOptions.paths)
.filter(([key]) => key !== 'react')
.reduce((acc, [key, value]) => ({...acc, [key]: value }), {})
const babelJestTransform = jestExpoPreset.transform['\\.[jt]sx?$'];
const transformIgnorePatterns = [
'react-native',
'@react-native',
'expo',
'@expo',
'@react-navigation',
'@lingui',
'@messageformat',
];
module.exports = {
preset: 'jest-expo',
// Lingui v6 ships .mjs; jest-expo only transforms .[jt]sx? by default.
transform: {
...jestExpoPreset.transform,
'^.+\\.mjs$': babelJestTransform,
},
setupFilesAfterEnv: [
'@testing-library/jest-native/extend-expect',
'react-native-unistyles/mocks',
'<rootDir>/src/i18n/jest-setup.ts',
'<rootDir>/src/uilib/index.ts',
'<rootDir>/src/log/log.service.mock.ts',
'<rootDir>/src/modal/modal.service.mock.tsx',
'<rootDir>/src/router/router.mock.ts',
],
moduleNameMapper: pathsToModuleNameMapper(tscPaths, { prefix: '<rootDir>' }),
transformIgnorePatterns: [
'/node_modules/(?!(' + transformIgnorePatterns.join('|') + '))',
],
testMatch: [
'<rootDir>/src/**/*.spec.(ts|tsx)',
],
};