|
4 | 4 | */ |
5 | 5 |
|
6 | 6 | export default { |
7 | | - // All imported modules in your tests should be mocked automatically |
8 | | - // automock: false, |
9 | | - |
10 | | - // Stop running tests after `n` failures |
11 | | - // bail: 0, |
12 | | - |
13 | | - // The directory where Jest should store its cached dependency information |
14 | | - // cacheDirectory: "/private/var/folders/pd/mpctclh50bd0bxp2n1th3z_w0000gn/T/jest_dx", |
15 | | - |
16 | 7 | // Automatically clear mock calls, instances, contexts and results before every test |
17 | 8 | clearMocks: true, |
18 | 9 |
|
19 | | - // Indicates whether the coverage information should be collected while executing the test |
20 | | - // collectCoverage: false, |
21 | | - |
22 | | - // An array of glob patterns indicating a set of files for which coverage information should be collected |
23 | | - // collectCoverageFrom: undefined, |
24 | | - |
25 | | - // The directory where Jest should output its coverage files |
26 | | - // coverageDirectory: undefined, |
27 | | - |
28 | | - // An array of regexp pattern strings used to skip coverage collection |
29 | | - // coveragePathIgnorePatterns: [ |
30 | | - // "/node_modules/" |
31 | | - // ], |
32 | | - |
33 | | - // Indicates which provider should be used to instrument code for coverage |
34 | | - coverageProvider: "v8", |
35 | | - |
36 | | - // A list of reporter names that Jest uses when writing coverage reports |
37 | | - // coverageReporters: [ |
38 | | - // "json", |
39 | | - // "text", |
40 | | - // "lcov", |
41 | | - // "clover" |
42 | | - // ], |
43 | | - |
44 | | - // An object that configures minimum threshold enforcement for coverage results |
45 | | - // coverageThreshold: undefined, |
46 | | - |
47 | | - // A path to a custom dependency extractor |
48 | | - // dependencyExtractor: undefined, |
49 | | - |
50 | | - // Make calling deprecated APIs throw helpful error messages |
51 | | - // errorOnDeprecated: false, |
52 | | - |
53 | | - // The default configuration for fake timers |
54 | | - // fakeTimers: { |
55 | | - // "enableGlobally": false |
56 | | - // }, |
57 | | - |
58 | | - // Force coverage collection from ignored files using an array of glob patterns |
59 | | - // forceCoverageMatch: [], |
60 | | - |
61 | | - // A path to a module which exports an async function that is triggered once before all test suites |
62 | | - // globalSetup: undefined, |
63 | | - |
64 | | - // A path to a module which exports an async function that is triggered once after all test suites |
65 | | - // globalTeardown: undefined, |
66 | | - |
67 | | - // A set of global variables that need to be available in all test environments |
68 | | - globals: { |
69 | | - "ts-jest": { |
70 | | - useESM: true, |
71 | | - }, |
72 | | - }, |
73 | | - |
74 | | - // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. |
75 | | - // maxWorkers: "50%", |
76 | | - |
77 | | - // An array of directory names to be searched recursively up from the requiring module's location |
78 | | - // moduleDirectories: [ |
79 | | - // "node_modules" |
80 | | - // ], |
81 | | - |
82 | | - // An array of file extensions your modules use |
83 | | - // moduleFileExtensions: [ |
84 | | - // "js", |
85 | | - // "mjs", |
86 | | - // "cjs", |
87 | | - // "jsx", |
88 | | - // "ts", |
89 | | - // "tsx", |
90 | | - // "json", |
91 | | - // "node" |
92 | | - // ], |
93 | | - |
94 | 10 | // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module |
95 | 11 | moduleNameMapper: { |
| 12 | + // We compile TypeScript to ES6 which requires extensions in module specifiers, |
| 13 | + // however adding the extension fails under jest tests. Remove the ".js" extension |
| 14 | + // from module names when running tests. |
96 | 15 | "^(\\.{1,2}/.*)\\.js$": "$1", |
97 | 16 | }, |
98 | 17 |
|
99 | | - // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader |
100 | | - // modulePathIgnorePatterns: [], |
101 | | - |
102 | | - // Activates notifications for test results |
103 | | - // notify: false, |
104 | | - |
105 | | - // An enum that specifies notification mode. Requires { notify: true } |
106 | | - // notifyMode: "failure-change", |
107 | | - |
108 | | - // A preset that is used as a base for Jest's configuration |
109 | | - // preset: undefined, |
110 | | - |
111 | | - // Run tests from one or more projects |
112 | | - // projects: undefined, |
113 | | - |
114 | | - // Use this configuration option to add custom reporters to Jest |
115 | | - // reporters: undefined, |
116 | | - |
117 | | - // Automatically reset mock state before every test |
118 | | - // resetMocks: false, |
119 | | - |
120 | | - // Reset the module registry before running each individual test |
121 | | - // resetModules: false, |
122 | | - |
123 | | - // A path to a custom resolver |
124 | | - // resolver: undefined, |
125 | | - |
126 | | - // Automatically restore mock state and implementation before every test |
127 | | - // restoreMocks: false, |
128 | | - |
129 | | - // The root directory that Jest should scan for tests and modules within |
130 | | - // rootDir: undefined, |
131 | | - |
132 | | - // A list of paths to directories that Jest should use to search for files in |
133 | | - roots: ["src", "e2e"], |
134 | | - |
135 | | - // Allows you to use a custom runner instead of Jest's default test runner |
136 | | - // runner: "jest-runner", |
137 | | - |
138 | | - // The paths to modules that run some code to configure or set up the testing environment before each test |
139 | | - // setupFiles: [], |
| 18 | + // An array of regexp pattern strings that are matched against all module paths before those paths are to be considered 'visible' to the module loader. |
| 19 | + modulePathIgnorePatterns: ["<rootDir>/dist"], |
140 | 20 |
|
141 | 21 | // A list of paths to modules that run some code to configure or set up the testing framework before each test |
142 | | - // setupFilesAfterEnv: [], |
143 | | - |
144 | | - // The number of seconds after which a test is considered as slow and reported as such in the results. |
145 | | - // slowTestThreshold: 5, |
146 | | - |
147 | | - // A list of paths to snapshot serializer modules Jest should use for snapshot testing |
148 | | - // snapshotSerializers: [], |
149 | | - |
150 | | - // The test environment that will be used for testing |
151 | | - // testEnvironment: "jest-environment-node", |
152 | | - |
153 | | - // Options that will be passed to the testEnvironment |
154 | | - // testEnvironmentOptions: {}, |
155 | | - |
156 | | - // Adds a location field to test results |
157 | | - // testLocationInResults: false, |
158 | | - |
159 | | - // The glob patterns Jest uses to detect test files |
160 | | - // testMatch: [ |
161 | | - // "**/__tests__/**/*.[jt]s?(x)", |
162 | | - // "**/?(*.)+(spec|test).[tj]s?(x)" |
163 | | - // ], |
164 | | - |
165 | | - // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped |
166 | | - // testPathIgnorePatterns: [ |
167 | | - // "/node_modules/" |
168 | | - // ], |
169 | | - |
170 | | - // The regexp pattern or array of patterns that Jest uses to detect test files |
171 | | - // testRegex: [], |
172 | | - |
173 | | - // This option allows the use of a custom results processor |
174 | | - // testResultsProcessor: undefined, |
175 | | - |
176 | | - // This option allows use of a custom test runner |
177 | | - // testRunner: "jest-circus/runner", |
| 22 | + setupFilesAfterEnv: ["./jest.setup.ts"], |
178 | 23 |
|
179 | 24 | // A map from regular expressions to paths to transformers |
180 | 25 | transform: { |
181 | 26 | "^.+\\.ts?$": "ts-jest", |
182 | 27 | }, |
183 | | - |
184 | | - // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation |
185 | | - // transformIgnorePatterns: [ |
186 | | - // "/node_modules/", |
187 | | - // "\\.pnp\\.[^\\/]+$" |
188 | | - // ], |
189 | | - |
190 | | - // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them |
191 | | - // unmockedModulePathPatterns: undefined, |
192 | | - |
193 | | - // Indicates whether each individual test should be reported during the run |
194 | | - // verbose: undefined, |
195 | | - |
196 | | - // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode |
197 | | - // watchPathIgnorePatterns: [], |
198 | | - |
199 | | - // Whether to use watchman for file crawling |
200 | | - // watchman: true, |
201 | 28 | }; |
0 commit comments