-
Notifications
You must be signed in to change notification settings - Fork 19
/
jest.config.js
116 lines (116 loc) · 4.72 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
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
108
109
110
111
112
113
114
115
116
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
displayName: 'did',
preset: 'ts-jest',
testEnvironment: 'jsdom',
coverageDirectory: 'coverage',
collectCoverageFrom: [
'**/packages/hooks/hooks-ca/*.{ts,tsx}',
'**/packages/store/store-ca/**/slice.{ts,tsx}',
'**/packages/utils/wallet/index.ts',
'**/packages/utils/activity.ts',
'**/packages/web-extension-did/app/web/store/reducers/**/*.{ts,tsx}',
'**/packages/web-extension-did/app/web/controllers/approval/*.ts',
'**/packages/web-extension-did/app/web/controllers/methodController/*.ts',
'**/packages/web-extension-did/app/web/utils/device.ts',
'**/packages/web-extension-did/app/web/utils/errorHandler.ts',
// '**/packages/web-extension-did/app/web/hooks/useActiveLockStatus.ts',
// '**/packages/web-extension-did/app/web/hooks/useCaInfoOnChain.ts',
// '**/packages/web-extension-did/app/web/hooks/useNetwork.ts',
'!**/packages/store/store-ca/{cms,dapp,discover,misc,txFee}/*.{ts,tsx}',
'!**/packages/hooks/hooks-ca/{contact,useTxFee,wallet}.{ts,tsx}',
'!**/node_modules/**',
'!**/*.test.{ts,tsx}',
],
coverageReporters: ['text', 'json-summary', 'json', 'lcov'],
coverageThreshold: {
global: {
branches: 95,
functions: 95,
lines: 95,
statements: 95,
},
},
moduleNameMapper: {
'\\.(css|less)$': 'identity-obj-proxy',
},
projects: [
{
displayName: 'hooks',
preset: 'ts-jest',
testMatch: ['<rootDir>/packages/hooks/hooks-ca/*.test.{ts,tsx}'],
testPathIgnorePatterns: ['<rootDir>/packages/hooks/hooks-ca/wallet.test.ts'],
testEnvironment: 'jsdom',
},
{
displayName: 'store',
preset: 'ts-jest',
testMatch: ['<rootDir>/packages/store/store-ca/**/*.test.{ts,tsx}'],
testEnvironment: 'jsdom',
},
{
displayName: 'utils',
preset: 'ts-jest',
testMatch: ['<rootDir>/packages/utils/**/*.test.{ts,tsx}'],
testEnvironment: 'jsdom',
},
{
displayName: 'web-extension-did',
preset: 'ts-jest',
testMatch: [
// '<rootDir>/packages/web-extension-did/app/web/hooks/*.test.{ts,tsx}',
'<rootDir>/packages/web-extension-did/app/web/store/**/*.test.{ts,tsx}',
'<rootDir>/packages/web-extension-did/app/web/controllers/approval/*.test.ts',
'<rootDir>/packages/web-extension-did/app/web/controllers/methodController/*.test.ts',
'<rootDir>/packages/web-extension-did/app/web/utils/*.test.ts',
],
testEnvironment: 'jsdom',
transform: {
'^.+\\.(ts|tsx)$': [
`ts-jest`,
{ isolatedModules: true, tsconfig: './packages/web-extension-did/tsconfig.json' },
],
},
roots: ['<rootDir>/packages/web-extension-did'],
moduleNameMapper: {
'^react$': '<rootDir>/node_modules/react',
'^utils$': '<rootDir>/packages/web-extension-did/app/web/utils',
'^utils/(.*)$': '<rootDir>/packages/web-extension-did/app/web/utils/$1',
'^store/(.*)$': '<rootDir>/packages/web-extension-did/app/web/store/$1',
'^constants/(.*)$': '<rootDir>/packages/web-extension-did/app/web/constants/$1',
'^messages/(.*)$': '<rootDir>/packages/web-extension-did/app/web/messages/$1',
'^service/(.*)$': '<rootDir>/packages/web-extension-did/app/web/service/$1',
'^controllers/(.*)$': '<rootDir>/packages/web-extension-did/app/web/controllers/$1',
},
coveragePathIgnorePatterns: [
'/node_modules/',
'/packages/store/store-ca/',
'/packages/hooks/hooks-ca/',
'/packages/utils/',
],
},
// {
// displayName: 'mobile-app-did',
// roots: ['<rootDir>/packages/mobile-app-did'],
// preset: 'react-native',
// transform: {
// '^.+\\.(ts|tsx)$': [`ts-jest`, { isolatedModules: true, tsconfig: './packages/mobile-app-did/tsconfig.json' }],
// },
// transformIgnorePatterns: ['<rootDir>/node_modules/(?!((jest-)?react-native|@react-native(-community)?)/)'],
// testEnvironment: 'react-native',
// globals: {
// __DEV__: true,
// },
// setupFilesAfterEnv: ['./packages/mobile-app-did/jest-setup/mockAsyncStorage.ts'],
// moduleNameMapper: {
// '^react$': '<rootDir>/node_modules/react',
// '^utils/(.*)$': '<rootDir>/packages/mobile-app-did/js/utils/$1',
// '^store/(.*)$': '<rootDir>/packages/mobile-app-did/js/store/$1',
// '^@portkey-wallet/store/(.*)$': '<rootDir>/packages/store/$1',
// store: '<rootDir>/packages/mobile-app-did/js/store/index',
// '^dapp/(.*)$': '<rootDir>/packages/mobile-app-did/js/dapp/$1',
// },
// coveragePathIgnorePatterns: ['/node_modules/', '/store/', '/Test/', '/utils/'],
// },
],
};