|
1 | | -// For a detailed explanation regarding each configuration property, visit: |
2 | | -// https://jestjs.io/docs/en/configuration.html |
3 | | - |
4 | | -const path = require('path'); |
5 | | - |
6 | 1 | module.exports = { |
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 | | - // Respect "browser" field in package.json when resolving modules |
14 | | - // browser: false, |
15 | | - |
16 | | - // The directory where Jest should store its cached dependency information |
17 | | - // cacheDirectory: "/tmp/jest_rs", |
18 | | - |
19 | | - // Automatically clear mock calls and instances between every test |
20 | | - clearMocks: true, |
21 | | - |
22 | | - // Indicates whether the coverage information should be collected while executing the test |
23 | | - // collectCoverage: false, |
24 | | - |
25 | | - // An array of glob patterns indicating a set of files for which coverage information should be collected |
26 | | - // collectCoverageFrom: null, |
27 | | - |
28 | | - // The directory where Jest should output its coverage files |
29 | | - coverageDirectory: 'coverage', |
30 | | - |
31 | | - // An array of regexp pattern strings used to skip coverage collection |
32 | | - // coveragePathIgnorePatterns: [ |
33 | | - // "/node_modules/" |
34 | | - // ], |
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: null, |
46 | | - |
47 | | - // A path to a custom dependency extractor |
48 | | - // dependencyExtractor: null, |
49 | | - |
50 | | - // Make calling deprecated APIs throw helpful error messages |
51 | | - // errorOnDeprecated: false, |
52 | | - |
53 | | - // Force coverage collection from ignored files using an array of glob patterns |
54 | | - // forceCoverageMatch: [], |
55 | | - |
56 | | - // A path to a module which exports an async function that is triggered once before all test suites |
57 | | - // globalSetup: null, |
58 | | - |
59 | | - // A path to a module which exports an async function that is triggered once after all test suites |
60 | | - // globalTeardown: null, |
61 | | - |
62 | | - // A set of global variables that need to be available in all test environments |
63 | | - // globals: {}, |
64 | | - |
65 | | - // An array of directory names to be searched recursively up from the requiring module's location |
66 | | - // moduleDirectories: [ |
67 | | - // "node_modules" |
68 | | - // ], |
69 | | - |
70 | | - // An array of file extensions your modules use |
71 | | - // moduleFileExtensions: [ |
72 | | - // "js", |
73 | | - // "json", |
74 | | - // "jsx", |
75 | | - // "ts", |
76 | | - // "tsx", |
77 | | - // "node" |
78 | | - // ], |
79 | | - |
80 | | - // A map from regular expressions to module names that allow to stub out resources with a single module |
81 | | - // moduleNameMapper: {}, |
82 | | - |
83 | | - // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader |
84 | | - // modulePathIgnorePatterns: [], |
85 | | - |
86 | | - // Activates notifications for test results |
87 | | - // notify: false, |
88 | | - |
89 | | - // An enum that specifies notification mode. Requires { notify: true } |
90 | | - // notifyMode: "failure-change", |
91 | | - |
92 | | - // A preset that is used as a base for Jest's configuration |
93 | | - // preset: 'ts-jest', |
94 | | - |
95 | | - // Run tests from one or more projects |
96 | | - // projects: null, |
97 | | - |
98 | | - // Use this configuration option to add custom reporters to Jest |
99 | | - // reporters: undefined, |
100 | | - |
101 | | - // Automatically reset mock state between every test |
102 | | - // resetMocks: false, |
103 | | - |
104 | | - // Reset the module registry before running each individual test |
105 | | - // resetModules: false, |
106 | | - |
107 | | - // A path to a custom resolver |
108 | | - // resolver: null, |
109 | | - |
110 | | - // Automatically restore mock state between every test |
111 | | - // restoreMocks: false, |
112 | | - |
113 | | - // The root directory that Jest should scan for tests and modules within |
114 | | - // rootDir: null, |
115 | | - |
116 | | - // A list of paths to directories that Jest should use to search for files in |
117 | | - // roots: [ |
118 | | - // "<rootDir>" |
119 | | - // ], |
120 | | - |
121 | | - // Allows you to use a custom runner instead of Jest's default test runner |
122 | | - // runner: "jest-runner", |
123 | | - |
124 | | - // The paths to modules that run some code to configure or set up the testing environment before each test |
125 | | - // setupFiles: [], |
126 | | - |
127 | | - // A list of paths to modules that run some code to configure or set up the testing framework before each test |
128 | | - setupFilesAfterEnv: ['./test/setupTestFramework.ts'], |
129 | | - |
130 | | - // A list of paths to snapshot serializer modules Jest should use for snapshot testing |
131 | | - // snapshotSerializers: [], |
132 | | - |
133 | | - // The test environment that will be used for testing |
| 2 | + preset: 'ts-jest', |
134 | 3 | testEnvironment: 'node', |
135 | | - |
136 | | - // Options that will be passed to the testEnvironment |
137 | | - // testEnvironmentOptions: {}, |
138 | | - |
139 | | - // Adds a location field to test results |
140 | | - // testLocationInResults: false, |
141 | | - |
142 | | - // The glob patterns Jest uses to detect test files |
143 | | - // testMatch: [ |
144 | | - // "**/__tests__/**/*.[jt]s?(x)", |
145 | | - // "**/?(*.)+(spec|test).[tj]s?(x)" |
146 | | - // ], |
147 | | - testMatch: ['**/?(*.)+(spec).[tj]s?(x)'] |
148 | | - |
149 | | - // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped |
150 | | - // testPathIgnorePatterns: [ |
151 | | - // "/node_modules/" |
152 | | - // ], |
153 | | - |
154 | | - // The regexp pattern or array of patterns that Jest uses to detect test files |
155 | | - // testRegex: [], |
156 | | - |
157 | | - // This option allows the use of a custom results processor |
158 | | - // testResultsProcessor: null, |
159 | | - |
160 | | - // This option allows use of a custom test runner |
161 | | - // testRunner: "jasmine2", |
162 | | - |
163 | | - // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href |
164 | | - // testURL: "http://localhost", |
165 | | - |
166 | | - // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout" |
167 | | - // timers: "real", |
168 | | - |
169 | | - // A map from regular expressions to paths to transformers |
170 | | - // transform: null, |
171 | | - |
172 | | - // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation |
173 | | - // transformIgnorePatterns: [ |
174 | | - // "/node_modules/" |
175 | | - // ], |
176 | | - |
177 | | - // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them |
178 | | - // unmockedModulePathPatterns: undefined, |
179 | | - |
180 | | - // Indicates whether each individual test should be reported during the run |
181 | | - // verbose: null, |
182 | | - |
183 | | - // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode |
184 | | - // watchPathIgnorePatterns: [], |
185 | | - |
186 | | - // Whether to use watchman for file crawling |
187 | | - // watchman: true, |
| 4 | + setupFilesAfterEnv: ['./test/setup.ts'] |
188 | 5 | }; |
0 commit comments