-
Notifications
You must be signed in to change notification settings - Fork 2
/
jest.config.cjs
42 lines (40 loc) · 1.06 KB
/
jest.config.cjs
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
const generateJestConfig = ({ esModules }) => {
const esModulesList = Array.isArray(esModules) ? esModules.join('|') : esModules
return {
coverageThreshold: {
global: {
branches: 50,
functions: 70,
lines: 70,
statements: 70,
},
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
preset: 'ts-jest/presets/default-esm',
setupFiles: ['dotenv/config'],
setupFilesAfterEnv: ['jest-extended/all', 'jest-sorted'],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
testTimeout: 30000,
transform: {
[`(${esModulesList}).+\\.js$`]: [
'babel-jest',
{
babelConfig: 'babel.config.json',
useESM: true,
},
],
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: 'tsconfig.test.json',
useESM: true,
},
],
},
transformIgnorePatterns: [`./node_modules/(?!${esModulesList})`],
}
}
// eslint-disable-next-line no-undef
module.exports = generateJestConfig({ esModules: ['is-ip', 'ip-regex'] })