-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
129 lines (114 loc) · 4.25 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
117
118
119
120
121
122
123
124
125
126
127
128
129
/**
* Jest configuration file for the Fitness Tracker MVP.
*
* This file defines the configuration options for Jest,
* a JavaScript testing framework, to be used for unit testing
* the components and utilities of the MVP.
*
* @see https://jestjs.io/docs/configuration
*/
module.exports = {
// The root directory that Jest should search for tests.
// This should typically be the root of your project.
rootDir: '.',
// The directory where Jest should output its coverage reports.
// This is typically set to 'coverage'.
coverageDirectory: 'coverage',
// The test environment that Jest should use.
// This is typically set to 'node' for server-side code
// or 'jsdom' for browser-based code.
testEnvironment: 'jsdom',
// A list of paths to modules that Jest should mock.
// This is useful for mocking external dependencies or
// complex modules within the MVP.
// Example:
// moduleNameMapper: {
// '^.+\\.(css|less|sass|scss)$': '<rootDir>/__mocks__/styleMock.js',
// '^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js',
// },
moduleNameMapper: {
'^.+\\.(css|less|sass|scss)$': 'identity-obj-proxy',
'^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js',
},
// A list of paths to modules that Jest should ignore.
// This can be used to exclude specific directories or
// files from the testing process.
// Example:
// testPathIgnorePatterns: [
// '/node_modules/',
// '/dist/',
// '/build/',
// ],
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/build/',
'/coverage/',
'/cypress/',
'/prisma/',
'/public/',
],
// The file extension for test files.
// This is typically set to 'js' or 'jsx'.
testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'],
// A list of paths to modules that Jest should transform.
// This is used to configure transpilation or other
// code transformations for different file types.
transform: {
'^.+\\.(ts|tsx)?$': 'babel-jest',
},
// The preset to be used for Jest configuration.
// This can be a string or an object.
// Example:
// preset: 'ts-jest',
preset: 'ts-jest',
// A list of paths to modules that Jest should use
// as setup files. These files are executed before
// each test file.
// Example:
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
// The default timeout for tests in milliseconds.
// This is typically set to 5000 (5 seconds).
testTimeout: 10000,
// Whether to collect coverage information from tests.
// This is typically set to true.
collectCoverage: true,
// A list of globs to use when collecting coverage.
// This can be used to specify the files to be
// included in coverage reports.
// Example:
// collectCoverageFrom: ['src/**/*.+(ts|tsx|js)'],
collectCoverageFrom: ['src/**/*.+(ts|tsx|js)'],
// Whether to use the experimental `snapshotSerializers` option.
// This allows you to use custom serializers for snapshot testing.
// Example:
// snapshotSerializers: ['enzyme-to-json/serializer'],
// snapshotSerializers: ['enzyme-to-json/serializer'],
// This option allows you to customize the behavior of Jest
// when running tests in a specific environment.
// Example:
// globals: {
// 'ts-jest': {
// tsconfig: '<rootDir>/tsconfig.json',
// },
// },
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.json',
},
},
// A list of paths to modules that Jest should use
// as transformIgnorePatterns. These patterns are used
// to specify which modules should not be transformed
// by Jest.
// Example:
// transformIgnorePatterns: ['node_modules/(?!.*\\.(js|jsx|ts|tsx|mjs|cjs)$)'],
// transformIgnorePatterns: ['node_modules/(?!.*\\.(js|jsx|ts|tsx|mjs|cjs)$)'],
// A list of paths to modules that Jest should use
// as watchPlugins. These plugins are used to
// customize the behavior of Jest's watch mode.
// Example:
// watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
// watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
};