-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathjest.config.base.js
38 lines (35 loc) · 1.26 KB
/
jest.config.base.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
const path = require('path');
const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('../../tsconfig');
Object.entries(compilerOptions.paths).map(([key, value]) => {
compilerOptions.paths[key] = value.map((p) => path.resolve(__dirname, '../../', p));
})
module.exports = {
preset: 'react-native',
modulePathIgnorePatterns: ['/lib/'],
transform: {
'^.+\\.tsx?$': ['ts-jest', {
tsconfig: 'tsconfig.json',
}]
},
testMatch: [
"**/__tests__/**/*.[jt]s?(x)", // Anything under __tests__
"**/?(*.)+(spec|test).[jt]s?(x)", // Test files with .spect.ts(x) or .test.ts(x)
"!**/__helpers__/**", // Do not run helpers as tests
"!**/__mocks__/**" // Do not run mocks as tests
],
transformIgnorePatterns: [
'node_modules/.pnpm/(?!@react-native|react-native)',
'node_modules/(?!@react-native|react-native)',
],
roots:[
path.resolve(__dirname, '__mocks__'), // Include shared mocks
'<rootDir>' // Include the source code of the current package
],
setupFiles: [
path.resolve(__dirname, 'src/setup.ts')
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
modulePaths: [compilerOptions.baseUrl],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
};