-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
99 lines (78 loc) · 2.78 KB
/
jest.config.ts
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
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
import { Config } from 'jest';
const config: Config = {
// Automatically clear mock calls, instances, contexts and results before every test
clearMocks: true,
// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: true,
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: [
'/node_modules/',
'<rootDir>/src/__mocks__/',
'<rootDir>/src/configs/',
'<rootDir>/dist/'
],
collectCoverageFrom: [
'<rootDir>/src/modules/**/*.ts',
'<rootDir>/src/providers/**/*.ts',
'<rootDir>/src/middlewares/**/*.ts',
'!<rootDir>/src/**/interfaces/*.ts'
],
// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
// An array of file extensions your modules use
moduleFileExtensions: [
'js',
'mjs',
'cjs',
'jsx',
'ts',
'tsx',
'json',
'node'
],
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
moduleNameMapper: {
'@src/(.*)': '<rootDir>/src/$1',
'@mocks/(.*)': '<rootDir>/src/__mocks__/$1'
},
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],
// A preset that is used as a base for Jest's configuration
// preset: 'ts-jest',
// Automatically reset mock state before every test
resetMocks: false,
// Automatically restore mock state and implementation before every test
restoreMocks: true,
// The root directory that Jest should scan for tests and modules within
// rootDir: './'
// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],
// The test environment that will be used for testing
testEnvironment: 'jest-environment-node',
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/src/__mocks__/',
'<rootDir>/src/configs/',
'<rootDir>/dist/'
],
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/",
// "\\.pnp\\.[^\\/]+$"
// ],
modulePathIgnorePatterns: ['<rootDir>/dist/'],
// A map from regular expressions to paths to transformers
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest'
}
};
export default config;