-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjest.config.js
More file actions
107 lines (104 loc) · 2.74 KB
/
jest.config.js
File metadata and controls
107 lines (104 loc) · 2.74 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// @ts-check
const NODE_MODULE_PATTERNS_TO_TRANSFORM = [
// React Native
'(?:jest-)?react-native',
'@react-native',
'@?expo',
'@?react-navigation',
'@sentry/react-native',
'native-base',
'@rnmapbox/maps',
// Awana modules distributed as ESM
'@comapeo/',
'@mapeo/',
'custom-error-creator',
'rpc-reflector',
// Intl modules distributed as ESM
'react-intl',
'@formatjs/',
'intl-messageformat',
// Helper modules distributed as ESM
'@sindresorhus/merge-streams',
'bcp-47',
'cheap-ruler',
'comapeocat',
'compress-commons',
'crc32-stream',
'dot-prop',
'ensure-error',
'filter-obj',
'index-to-position',
'into-stream',
'is-alphabetical',
'is-alphanumerical',
'is-decimal',
'is-plain-obj',
'is-stream',
'iso-3166',
'ky',
'map-obj',
'mbtiles-reader',
'mime',
'nanoid',
'p-defer',
'p-event',
'p-limit',
'p-queue',
'p-timeout',
'parse-json',
'serialize-error',
'string-timing-safe-equal',
'styled-map-package',
'uint8array-extras',
'un-m49',
'yocto-queue',
'zip-stream-promise',
'zip-stream',
'@lodev09/react-native-exify',
];
/** @type {import('jest').Config} */
const config = {
preset: 'jest-expo',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
// https://react-native-documents.github.io/docs/sponsor-only/jest-mocks
setupFiles: [
'./node_modules/@react-native-documents/picker/jest/build/jest/setup.js',
],
setupFilesAfterEnv: ['@rnmapbox/maps/setup-jest', './jest.setup.js'],
transform: {
'\\.[jt]sx?$': [
'babel-jest',
{
extends: './babel.config.js',
plugins: [['babel-plugin-transform-import-meta', {module: 'ES6'}]],
},
],
},
transformIgnorePatterns: [
`/node_modules/(?!${NODE_MODULE_PATTERNS_TO_TRANSFORM.join('|')})`,
'/node_modules/react-native-reanimated/plugin/',
],
moduleNameMapper: {
'\\.svg$': '<rootDir>/src/frontend/__mocks__/svg.tsx',
'^@comapeo/core/package\\.json$':
'<rootDir>/node_modules/@comapeo/core/package.json',
'^@comapeo/ipc$': '<rootDir>/node_modules/@comapeo/ipc/dist/index.js',
'^custom-error-creator$':
'<rootDir>/node_modules/custom-error-creator/index.js',
'^@comapeo/map-server/constants\\.js$':
'<rootDir>/node_modules/@comapeo/map-server/dist/lib/constants.js',
'^comapeocat/reader\\.js$':
'<rootDir>/node_modules/comapeocat/src/reader.js',
'^comapeocat/writer\\.js$':
'<rootDir>/node_modules/comapeocat/src/writer.js',
},
// Avoid `jest-haste-map: Haste module naming collision` warnings
modulePathIgnorePatterns: [
'<rootDir>/android',
'<rootDir>/ios',
'<rootDir>/nodejs-assets',
'<rootDir>/assets',
],
testPathIgnorePatterns: ['<rootDir>/tests/e2e/'],
};
module.exports = config;