-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathjest.config.js
More file actions
141 lines (137 loc) · 3.8 KB
/
Copy pathjest.config.js
File metadata and controls
141 lines (137 loc) · 3.8 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// Next loads next.config.mjs while creating its Jest configuration. Supply the
// non-secret testnet defaults required by startup validation for test runs.
process.env.NEXT_PUBLIC_STELLAR_NETWORK ??= 'testnet'
process.env.STELLAR_HORIZON_URL ??= 'https://horizon-testnet.stellar.org'
const nextJest = require('next/jest')
const createJestConfig = nextJest({
dir: './',
})
/** @type {import('jest').Config} */
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
// jest-environment-jsdom doesn't provide fetch/Request/Response/Headers at
// all (not even via Node's globals — jsdom runs in its own VM sandbox).
// jest-fixed-jsdom is the same environment with those bridged back in from
// the real Node runtime, needed by tests that jest.spyOn(global, 'fetch').
testEnvironment: 'jest-fixed-jsdom',
coverageProvider: 'v8',
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/', '<rootDir>/tests/e2e/'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
transformIgnorePatterns: [
// Kept in sync with next.config.mjs's transpilePackages (uint8array-extras
// added there for Issue #63 — see the comment on that array). next-intl and
// use-intl ship ESM-only builds and need transforming too.
'/node_modules/(?!(@stellar/stellar-sdk|@noble|@stellar|uint8array-extras|next-intl|use-intl|@formatjs|intl-messageformat)/)',
],
moduleNameMapper: {
'^.+\\.(css|less|scss|sass)$': 'identity-obj-proxy',
},
collectCoverageFrom: [
'lib/**/*.{js,jsx,ts,tsx}',
'hooks/**/*.{js,jsx,ts,tsx}',
'components/**/*.{js,jsx,ts,tsx}',
'app/api/**/*.{js,jsx,ts,tsx}',
'!**/*.d.ts',
],
coverageThreshold: {
'lib/fixtures/factory.ts': {
branches: 80,
functions: 90,
lines: 90,
statements: 90,
},
'lib/transaction-utils.ts': {
branches: 60,
functions: 85,
lines: 80,
statements: 80,
},
'hooks/useTransactions.ts': {
branches: 50,
functions: 80,
lines: 80,
statements: 80,
},
'lib/services/fiat.service.ts': {
branches: 90,
functions: 90,
lines: 90,
statements: 90,
},
'lib/services/wallet.service.ts': {
branches: 85,
functions: 80,
lines: 85,
statements: 85,
},
'lib/receive-utils.ts': {
branches: 90,
functions: 90,
lines: 90,
statements: 90,
},
'lib/services/receive.service.ts': {
branches: 80,
functions: 90,
lines: 90,
statements: 90,
},
'app/api/transactions/route.ts': {
branches: 75,
functions: 75,
lines: 75,
statements: 75,
},
'app/api/wallet/balances/route.ts': {
branches: 75,
functions: 75,
lines: 75,
statements: 75,
},
'app/api/wallet/transactions/route.ts': {
branches: 75,
functions: 75,
lines: 75,
statements: 75,
},
'app/api/wallet/send/route.ts': {
branches: 75,
functions: 75,
lines: 75,
statements: 75,
},
'app/api/rates/route.ts': {
branches: 75,
functions: 75,
lines: 75,
statements: 75,
},
'lib/services/asset.service.ts': {
branches: 85,
functions: 90,
lines: 90,
statements: 90,
},
'lib/helpers/conversion-math.ts': {
branches: 90,
functions: 100,
lines: 95,
statements: 95,
},
'hooks/useOffRamp.ts': {
branches: 80,
functions: 85,
lines: 85,
statements: 85,
},
},
}
module.exports = async () => {
const baseConfig = await createJestConfig(customJestConfig)()
return {
...baseConfig,
transformIgnorePatterns: [
'/node_modules/(?!(@stellar/stellar-sdk|@noble|@stellar|uint8array-extras|next-intl|use-intl|@formatjs|intl-messageformat)/)',
],
}
}