ts-jest 27.0.0-next.9 → 27.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.ts-jest-digest CHANGED
@@ -1 +1 @@
1
- fb11a28c290731cf09c1667c608d006e5197ee47
1
+ 43a4882bb5f0a05bfcf95a3ba25ace21917ca828
package/CHANGELOG.md CHANGED
@@ -1,41 +1,245 @@
1
- # [27.0.0-next.9](https://github.com/kulshekhar/ts-jest/compare/v27.0.0-next.8...v27.0.0-next.9) (2021-03-19)
1
+ ## [27.0.3](https://github.com/kulshekhar/ts-jest/compare/v27.0.2...v27.0.3) (2021-06-06)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * **compiler:** initialize compiler with `.ts`/`.tsx`/`.d.ts` files only ([#2458](https://github.com/kulshekhar/ts-jest/issues/2458)) ([a89f0e2](https://github.com/kulshekhar/ts-jest/commit/a89f0e2061e01440337dde4134639ff6a2d69936)), closes [#2445](https://github.com/kulshekhar/ts-jest/issues/2445)
6
+ * revert `exports` field to support all node versions ([#2658](https://github.com/kulshekhar/ts-jest/issues/2658)) ([132c8ba](https://github.com/kulshekhar/ts-jest/commit/132c8ba85c3e61b7d9ede0dc9730580b79618ab7))
7
7
 
8
8
 
9
9
  ### Features
10
10
 
11
- * adopt `jest@27.0.0-next.5` ([#2450](https://github.com/kulshekhar/ts-jest/issues/2450)) ([b714da3](https://github.com/kulshekhar/ts-jest/commit/b714da36e2cb9fa7cc22591b12f301d904334a3f)), closes [#2459](https://github.com/kulshekhar/ts-jest/issues/2459)
11
+ * emit ESM codes if using ESM mode with Babel ([#2661](https://github.com/kulshekhar/ts-jest/issues/2661)) ([9b55404](https://github.com/kulshekhar/ts-jest/commit/9b55404a8dfc760238e19786da98a2edf043b9da)), closes [#2650](https://github.com/kulshekhar/ts-jest/issues/2650)
12
12
 
13
13
 
14
14
 
15
- ## [26.5.4](https://github.com/kulshekhar/ts-jest/compare/v26.5.3...v26.5.4) (2021-03-17)
15
+ ## [27.0.2](https://github.com/kulshekhar/ts-jest/compare/v27.0.1...v27.0.2) (2021-05-30)
16
16
 
17
17
 
18
18
  ### Bug Fixes
19
19
 
20
- * **compiler:** initialize compiler with `.ts`/`.tsx`/`.d.ts` files only ([#2457](https://github.com/kulshekhar/ts-jest/issues/2457)) ([1dc731a](https://github.com/kulshekhar/ts-jest/commit/1dc731a5faf7cda59db1cc642eb99fae973b1246)), closes [#2445](https://github.com/kulshekhar/ts-jest/issues/2445)
20
+ * **compiler:** add empty string file content to compiler cache ([#2633](https://github.com/kulshekhar/ts-jest/issues/2633)) ([0feb556](https://github.com/kulshekhar/ts-jest/commit/0feb5560a588f87d1d989bf521859fba0fda20fe)), closes [#2625](https://github.com/kulshekhar/ts-jest/issues/2625)
21
+ * **config:** `exclude` should only exclude files which match glob values ([#2637](https://github.com/kulshekhar/ts-jest/issues/2637)) ([c5ce979](https://github.com/kulshekhar/ts-jest/commit/c5ce97902c1b84dc354f270a4f596a6f5f634611)), closes [#2634](https://github.com/kulshekhar/ts-jest/issues/2634)
21
22
 
22
23
 
23
24
 
24
- # [27.0.0-next.8](https://github.com/kulshekhar/ts-jest/compare/v27.0.0-next.7...v27.0.0-next.8) (2021-03-11)
25
+ ## [27.0.1](https://github.com/kulshekhar/ts-jest/compare/v27.0.0...v27.0.1) (2021-05-26)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **cli:** keep `testMatch` if old jest config contains it ([#2618](https://github.com/kulshekhar/ts-jest/issues/2618)) ([c568f49](https://github.com/kulshekhar/ts-jest/commit/c568f49907fb5559ba1e8c67f1ec5d5eb4af920a)), closes [#2616](https://github.com/kulshekhar/ts-jest/issues/2616)
31
+ * **compiler:** make sure `isolatedModules: false` use updated compiler options ([#2628](https://github.com/kulshekhar/ts-jest/issues/2628)) ([348e30f](https://github.com/kulshekhar/ts-jest/commit/348e30f426803efc51ecba26ab42619938fcb5af)), closes [#2629](https://github.com/kulshekhar/ts-jest/issues/2629)
32
+ * add missing export `presets` ([#2624](https://github.com/kulshekhar/ts-jest/issues/2624)) ([0ea025e](https://github.com/kulshekhar/ts-jest/commit/0ea025ebb456d3a31671e31fac0b401c2734a2b1)), closes [#2623](https://github.com/kulshekhar/ts-jest/issues/2623)
33
+
34
+
35
+
36
+ # [27.0.0](https://github.com/kulshekhar/ts-jest/compare/v26.5.6...v27.0.0) (2021-05-25)
25
37
 
26
38
 
27
39
  ### Bug Fixes
28
40
 
41
+ * **compiler:** return file content on emitSkipped for non ts/tsx files ([#2519](https://github.com/kulshekhar/ts-jest/issues/2519)) ([a4e5640](https://github.com/kulshekhar/ts-jest/commit/a4e5640f54a7810c9b7aba32663ce4a53893d22f)), closes [#2513](https://github.com/kulshekhar/ts-jest/issues/2513)
42
+ * **compiler:** retype check other files if processing file is used by those ones in watch mode ([#2481](https://github.com/kulshekhar/ts-jest/issues/2481)) ([ac8f3d0](https://github.com/kulshekhar/ts-jest/commit/ac8f3d025de67bfc2708a8422ee657fc42455513)), closes [#943](https://github.com/kulshekhar/ts-jest/issues/943)
43
+ * **compiler:** initialize compiler with `.ts`/`.tsx`/`.d.ts` files only ([#2458](https://github.com/kulshekhar/ts-jest/issues/2458)) ([a89f0e2](https://github.com/kulshekhar/ts-jest/commit/a89f0e2061e01440337dde4134639ff6a2d69936)), closes [#2445](https://github.com/kulshekhar/ts-jest/issues/2445)
29
44
  * **compiler:** resolve nested imported modules for each processing file ([#2436](https://github.com/kulshekhar/ts-jest/issues/2436)) ([3cb9019](https://github.com/kulshekhar/ts-jest/commit/3cb9019289bb64deecffaf52e840faf6a4656092)), closes [#1390](https://github.com/kulshekhar/ts-jest/issues/1390) [#1747](https://github.com/kulshekhar/ts-jest/issues/1747)
30
45
  * **config:** create fallback jest config when jest config is `undefined` ([#2433](https://github.com/kulshekhar/ts-jest/issues/2433)) ([c6d6e4c](https://github.com/kulshekhar/ts-jest/commit/c6d6e4cd534e1c368fcb7141784ee43584525ca4)), closes [#2085](https://github.com/kulshekhar/ts-jest/issues/2085)
31
46
  * remove `@types/jest` from direct dep ([#2409](https://github.com/kulshekhar/ts-jest/issues/2409)) ([8913120](https://github.com/kulshekhar/ts-jest/commit/89131203c358c8f9e89655800e500a9e88a17334)), closes [#2406](https://github.com/kulshekhar/ts-jest/issues/2406) [#2411](https://github.com/kulshekhar/ts-jest/issues/2411)
32
47
  * **compiler:** return original file content and show warning on emit skip ([#2410](https://github.com/kulshekhar/ts-jest/issues/2410)) ([c2b2164](https://github.com/kulshekhar/ts-jest/commit/c2b2164ddd1e606fc2490326244a6efc63f6c4a0)), closes [#2407](https://github.com/kulshekhar/ts-jest/issues/2407)
33
48
  * **compiler:** type check correctly in watch mode when a file content itself has changed ([#2405](https://github.com/kulshekhar/ts-jest/issues/2405)) ([064bf3a](https://github.com/kulshekhar/ts-jest/commit/064bf3a73e9a304aa9366d27db8973b68be23ffd)), closes [#2118](https://github.com/kulshekhar/ts-jest/issues/2118)
49
+ * **compiler:** exclude files in `outDir` from compiler source files ([#2375](https://github.com/kulshekhar/ts-jest/issues/2375)) ([ec68c74](https://github.com/kulshekhar/ts-jest/commit/ec68c74bccf56d682a7ed9e5c48ea676dcf3fbf9)), closes [#2350](https://github.com/kulshekhar/ts-jest/issues/2350) [#2374](https://github.com/kulshekhar/ts-jest/issues/2374)
50
+ * **config:** cache config and compiler correctly between runs ([#2356](https://github.com/kulshekhar/ts-jest/issues/2356)) ([5f91336](https://github.com/kulshekhar/ts-jest/commit/5f91336b9023da1051cc85b509ad02c525679fcb))
51
+ * **config:** improve emit skipped error message ([#2358](https://github.com/kulshekhar/ts-jest/issues/2358)) ([2ae8df4](https://github.com/kulshekhar/ts-jest/commit/2ae8df4515d6f6e975e57719a89184b5583f9e2f)), closes [#2350](https://github.com/kulshekhar/ts-jest/issues/2350)
52
+ * **typings:** set correct typing for `tsconfig` option ([#2383](https://github.com/kulshekhar/ts-jest/issues/2383)) ([584324a](https://github.com/kulshekhar/ts-jest/commit/584324a60c0784275e9bf8bcfd0814735a250d24)), closes [#2368](https://github.com/kulshekhar/ts-jest/issues/2368)
53
+ * **config:** invalidate Jest transform cache when `astTransformers` value changes ([#2345](https://github.com/kulshekhar/ts-jest/issues/2345)) ([d726016](https://github.com/kulshekhar/ts-jest/commit/d726016a17a26215fad782cf57bb9b9bec807307))
54
+ * reduce size of `node_modules` when adding `ts-jest` ([#2263](https://github.com/kulshekhar/ts-jest/issues/2263)) ([8e0675c](https://github.com/kulshekhar/ts-jest/commit/8e0675c02b6095af6656df50c8782c01ad9e87a3))
55
+
56
+
57
+ ### Features
58
+
59
+ * **config:** allow disable sourcemap ([#2544](https://github.com/kulshekhar/ts-jest/issues/2544)) ([47da6ad](https://github.com/kulshekhar/ts-jest/commit/47da6ada5089e58e9bc68ce8e9bc9e17aaa127ae))
60
+ * **compiler:** expose `TsCompiler` as public api ([#2344](https://github.com/kulshekhar/ts-jest/issues/2344)) ([871cd6a](https://github.com/kulshekhar/ts-jest/commit/871cd6a3abb10569a04d05f72bbb41c952665ed4))
61
+ * **config:** support typed config options for jest config typescript ([#2335](https://github.com/kulshekhar/ts-jest/issues/2335)) ([3cfc37b](https://github.com/kulshekhar/ts-jest/commit/3cfc37b1eba125fe861cea0415095dbe1f538520))
62
+ * **presets:** add typing for `presets` entry point ([#2337](https://github.com/kulshekhar/ts-jest/issues/2337)) ([1a3058f](https://github.com/kulshekhar/ts-jest/commit/1a3058f3b7f8a2e377cb6a7e829cea310a06d4fa))
63
+ * **compiler:** allow custom transformers to access internal `Program` ([#2299](https://github.com/kulshekhar/ts-jest/issues/2299)) ([387964f](https://github.com/kulshekhar/ts-jest/commit/387964faed14ce24d2cf8170a04eee244d69b8b9))
64
+ * **config:** replace `pathRegex` with `exclude` ([#2295](https://github.com/kulshekhar/ts-jest/issues/2295)) ([f2f99c3](https://github.com/kulshekhar/ts-jest/commit/f2f99c3a46ac18a1fd6cc98922329b71a7e8c4e8))
65
+ * **config:** type checking `js` files based on `checkJs` ([#2283](https://github.com/kulshekhar/ts-jest/issues/2283)) ([1e04433](https://github.com/kulshekhar/ts-jest/commit/1e044335a38907ff5c06eb43efeb2e5fd9769a0c))
66
+ * **compiler:** support ESM for `isolatedModules: false` ([#2269](https://github.com/kulshekhar/ts-jest/issues/2269)) ([9bb0c05](https://github.com/kulshekhar/ts-jest/commit/9bb0c054a3a7bd8949b0c12b2bb42348f69e2e2e)), closes [#1709](https://github.com/kulshekhar/ts-jest/issues/1709)
67
+ * **compiler:** support ESM for `isolatedModule: true` ([#2219](https://github.com/kulshekhar/ts-jest/issues/2219)) ([e101db0](https://github.com/kulshekhar/ts-jest/commit/e101db01095ce75ce9a48e27a1d9bf84bb8e19ee)), closes [#1709](https://github.com/kulshekhar/ts-jest/issues/1709)
68
+ * **presets:** add 3 new presets to work with ESM ([#2207](https://github.com/kulshekhar/ts-jest/issues/2207)) ([c277858](https://github.com/kulshekhar/ts-jest/commit/c277858c7820d8873c2d7d0c6e3704a47868d600))
69
+ * allow subclasses of `TsJestTransformer` to have version checking ([#2176](https://github.com/kulshekhar/ts-jest/issues/2176)) ([ca8d7c4](https://github.com/kulshekhar/ts-jest/commit/ca8d7c44779105ef208d17cdd8c6baaf96b479ad))
70
+
71
+
72
+ ### Performance Improvements
73
+
74
+ * reuse jest file system cache for `isolatedModules: false` ([#2189](https://github.com/kulshekhar/ts-jest/issues/2189)) ([68f446b](https://github.com/kulshekhar/ts-jest/commit/68f446b8351bb8925ac4822aa631aa6b23f2f711))
75
+
76
+
77
+ ### Code Refactoring
78
+
79
+ * **config:** remove support for `astTransformers` string array ([#2129](https://github.com/kulshekhar/ts-jest/issues/2129)) ([1e0b2ce](https://github.com/kulshekhar/ts-jest/commit/1e0b2ce5599a35c108712456e455bf29c8c5fd24))
80
+ * **config:** remove support for `packageJson` option ([#2128](https://github.com/kulshekhar/ts-jest/issues/2128)) ([05916b9](https://github.com/kulshekhar/ts-jest/commit/05916b920160da5b43a20b47025eea43b4a1a5c3))
81
+ * move jest transformer class to package entry ([#2122](https://github.com/kulshekhar/ts-jest/issues/2122)) ([5bbfd06](https://github.com/kulshekhar/ts-jest/commit/5bbfd06a0c114dbecd75b763bcfa76d4a6203ab1))
82
+ * **config:** remove support for `tsConfig` option ([#2127](https://github.com/kulshekhar/ts-jest/issues/2127)) ([3cc9b80](https://github.com/kulshekhar/ts-jest/commit/3cc9b806be2b2096b981253d39ca40df65bb0f7b))
83
+
84
+
85
+ ## BREAKING CHANGES
86
+
87
+ * By default, `ts-jest` will use `sourceMap` option from your `tsconfig`. If users want to have sourcemap on, they need to set `sourceMap: true` in `tsconfig`.
88
+ * follow Jest support Node engines ([#2478](https://github.com/kulshekhar/ts-jest/pull/2478)) ([1fecf7f](https://github.com/kulshekhar/ts-jest/commit/1fecf7ff92a5f1a0cc6ea1d27026f9f54a3d5ead))
89
+ * add `exports` field to `package.json`, see https://nodejs.org/api/packages.html#packages_package_entry_points ([#2467](https://github.com/kulshekhar/ts-jest/pull/2467)) ([d3aba3e](https://github.com/kulshekhar/ts-jest/commit/d3aba3e103f85b3a42d0e2ecaea9d3457917319e))
90
+ * `ts-jest` custom AST transformer function signature has changed to
91
+ ```
92
+ import type { TsCompilerInstance } from 'ts-jest/dist/types'
93
+
94
+ export function factory(compilerInstance: TsCompilerInstance) {
95
+ //...
96
+ }
97
+ ```
98
+ * One is currently using `pathRegex` should use `exclude` with `glob` patterns.
99
+ * If one currently relies on type check for `js` files, please set `checkJs: true` in your tsconfig.
100
+ * Now both `isolatedModules: true` and `isolatedModule: false` codes are in one single class `TsCompiler` which is an instance created in `TsJestCompiler` based on config option `compiler` with value `typescript` or `ttypescript`.
101
+ * **config:** `packageJson` config option is not used in internal `ts-jest` so this option is now removed.
102
+ * **config:** One is defining ast transformers in `jest.config.js`/`package.json` should change to
103
+ ```
104
+ // jest.config.js
105
+ module.exports = {
106
+ //...
107
+ globals: {
108
+ 'ts-jest': {
109
+ astTransformers: {
110
+ before: ['your_before_transformer_path'],
111
+ after: ['your_after_transformer_path'],
112
+ afterDeclarations: ['your_afterDeclarations_transformer_path'],
113
+ }
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ or
120
+ ```
121
+ // package.json
122
+ {
123
+ "jest": {
124
+ "globals": {
125
+ "ts-jest": {
126
+ "astTransformers": {
127
+ "before": ["your_before_transformer_path"],
128
+ "after": ["your_after_transformer_path"],
129
+ "afterDeclarations": ["your_afterDeclarations_transformer_path"]
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+ ```
136
+ * One currently refers type in `jest.config.js`
137
+ ```
138
+ /** @typedef {import('ts-jest')} */
139
+ module.exports = {
140
+ //...
141
+ }
142
+ ```
143
+
144
+ should change to
145
+ ```
146
+ /** @typedef {import('ts-jest/dist/types')} */
147
+ module.exports = {
148
+ //...
149
+ }
150
+ ```
151
+ * Remove possibilities to import `mocked`, `createJestPreset`, `pathsToModuleNameMapper` from package entry. One should change to
152
+ ```
153
+ import { mocked, createJestPreset, pathsToModuleNameMapper } from 'ts-jest/utils'
154
+ ```
155
+ * **config:** One currently uses `tsConfig` should change to `tsconfig` in your `jest.config.js` or `package.json`.
156
+
157
+
158
+
159
+ ## [26.5.6](https://github.com/kulshekhar/ts-jest/compare/v26.5.5...v26.5.6) (2021-05-05)
160
+
161
+
162
+ ### Code Refactoring
163
+
164
+ * refactor(config): show warning message for `sourceMap: false` ([#2557](https://github.com/kulshekhar/ts-jest/pull/2557)) ([cf60990](https://github.com/kulshekhar/ts-jest/commit/cf609900e2c5937755123bd08ca2c5f2ff5e0651)).
165
+
166
+
167
+
168
+ # [27.0.0-next.12](https://github.com/kulshekhar/ts-jest/compare/v27.0.0-next.11...v27.0.0-next.12) (2021-05-05)
34
169
 
35
170
 
36
171
  ### Features
37
172
 
38
- * adopt jest **27.0.0-next.4** ([#2435](https://github.com/kulshekhar/ts-jest/issues/2435)) ([1d411f2](https://github.com/kulshekhar/ts-jest/commit/1d411f285e4f7eff7982c3917b6b91b5af617e8a))
173
+ * **config:** allow disable sourcemap ([#2544](https://github.com/kulshekhar/ts-jest/issues/2544)) ([47da6ad](https://github.com/kulshekhar/ts-jest/commit/47da6ada5089e58e9bc68ce8e9bc9e17aaa127ae))
174
+
175
+
176
+ ## BREAKING CHANGES
177
+
178
+ * By default, `ts-jest` will use `sourceMap` option from your `tsconfig`. If users want to have sourcemap on, they need to either remove `sourceMap` or set `sourceMap: true` in `tsconfig`
179
+
180
+
181
+
182
+ ## [26.5.5](https://github.com/kulshekhar/ts-jest/compare/v26.5.4...v26.5.5) (2021-04-15)
183
+
184
+
185
+ ### Bug Fixes
186
+
187
+ * **compiler:** return file content on emitSkipped for non ts/tsx files ([#2515](https://github.com/kulshekhar/ts-jest/issues/2515)) ([0320fb3](https://github.com/kulshekhar/ts-jest/commit/0320fb3ac22056aafe4d7ae966eab84dbf23fda9)), closes [#2513](https://github.com/kulshekhar/ts-jest/issues/2513)
188
+
189
+
190
+
191
+ # [27.0.0-next.11](https://github.com/kulshekhar/ts-jest/compare/v27.0.0-next.10...v27.0.0-next.11) (2021-04-15)
192
+
193
+
194
+ ### Bug Fixes
195
+
196
+ * **compiler:** return file content on emitSkipped for non ts/tsx files ([#2519](https://github.com/kulshekhar/ts-jest/issues/2519)) ([a4e5640](https://github.com/kulshekhar/ts-jest/commit/a4e5640f54a7810c9b7aba32663ce4a53893d22f)), closes [#2513](https://github.com/kulshekhar/ts-jest/issues/2513)
197
+
198
+
199
+
200
+ # [27.0.0-next.10](https://github.com/kulshekhar/ts-jest/compare/v27.0.0-next.9...v27.0.0-next.10) (2021-03-30)
201
+
202
+
203
+ ### Bug Fixes
204
+
205
+ * **compiler:** retype check other files if processing file is used by those ones in watch mode ([#2481](https://github.com/kulshekhar/ts-jest/issues/2481)) ([ac8f3d0](https://github.com/kulshekhar/ts-jest/commit/ac8f3d025de67bfc2708a8422ee657fc42455513)), closes [#943](https://github.com/kulshekhar/ts-jest/issues/943)
206
+
207
+
208
+ ## BREAKING CHANGES
209
+
210
+ * follow Jest node engines ([#2478](https://github.com/kulshekhar/ts-jest/pull/2478)) ([1fecf7f](https://github.com/kulshekhar/ts-jest/commit/1fecf7ff92a5f1a0cc6ea1d27026f9f54a3d5ead))
211
+ * add `exports` field to `package.json`, see https://nodejs.org/api/packages.html#packages_package_entry_points ([#2467](https://github.com/kulshekhar/ts-jest/pull/2467)) ([d3aba3e](https://github.com/kulshekhar/ts-jest/commit/d3aba3e103f85b3a42d0e2ecaea9d3457917319e))
212
+
213
+
214
+
215
+ # [27.0.0-next.9](https://github.com/kulshekhar/ts-jest/compare/v27.0.0-next.8...v27.0.0-next.9) (2021-03-19)
216
+
217
+
218
+ ### Bug Fixes
219
+
220
+ * **compiler:** initialize compiler with `.ts`/`.tsx`/`.d.ts` files only ([#2458](https://github.com/kulshekhar/ts-jest/issues/2458)) ([a89f0e2](https://github.com/kulshekhar/ts-jest/commit/a89f0e2061e01440337dde4134639ff6a2d69936)), closes [#2445](https://github.com/kulshekhar/ts-jest/issues/2445)
221
+
222
+
223
+
224
+ ## [26.5.4](https://github.com/kulshekhar/ts-jest/compare/v26.5.3...v26.5.4) (2021-03-17)
225
+
226
+
227
+ ### Bug Fixes
228
+
229
+ * **compiler:** initialize compiler with `.ts`/`.tsx`/`.d.ts` files only ([#2457](https://github.com/kulshekhar/ts-jest/issues/2457)) ([1dc731a](https://github.com/kulshekhar/ts-jest/commit/1dc731a5faf7cda59db1cc642eb99fae973b1246)), closes [#2445](https://github.com/kulshekhar/ts-jest/issues/2445)
230
+
231
+
232
+
233
+ # [27.0.0-next.8](https://github.com/kulshekhar/ts-jest/compare/v27.0.0-next.7...v27.0.0-next.8) (2021-03-11)
234
+
235
+
236
+ ### Bug Fixes
237
+
238
+ * **compiler:** resolve nested imported modules for each processing file ([#2436](https://github.com/kulshekhar/ts-jest/issues/2436)) ([3cb9019](https://github.com/kulshekhar/ts-jest/commit/3cb9019289bb64deecffaf52e840faf6a4656092)), closes [#1390](https://github.com/kulshekhar/ts-jest/issues/1390) [#1747](https://github.com/kulshekhar/ts-jest/issues/1747)
239
+ * **config:** create fallback jest config when jest config is `undefined` ([#2433](https://github.com/kulshekhar/ts-jest/issues/2433)) ([c6d6e4c](https://github.com/kulshekhar/ts-jest/commit/c6d6e4cd534e1c368fcb7141784ee43584525ca4)), closes [#2085](https://github.com/kulshekhar/ts-jest/issues/2085)
240
+ * remove `@types/jest` from direct dep ([#2409](https://github.com/kulshekhar/ts-jest/issues/2409)) ([8913120](https://github.com/kulshekhar/ts-jest/commit/89131203c358c8f9e89655800e500a9e88a17334)), closes [#2406](https://github.com/kulshekhar/ts-jest/issues/2406) [#2411](https://github.com/kulshekhar/ts-jest/issues/2411)
241
+ * **compiler:** return original file content and show warning on emit skip ([#2410](https://github.com/kulshekhar/ts-jest/issues/2410)) ([c2b2164](https://github.com/kulshekhar/ts-jest/commit/c2b2164ddd1e606fc2490326244a6efc63f6c4a0)), closes [#2407](https://github.com/kulshekhar/ts-jest/issues/2407)
242
+ * **compiler:** type check correctly in watch mode when a file content itself has changed ([#2405](https://github.com/kulshekhar/ts-jest/issues/2405)) ([064bf3a](https://github.com/kulshekhar/ts-jest/commit/064bf3a73e9a304aa9366d27db8973b68be23ffd)), closes [#2118](https://github.com/kulshekhar/ts-jest/issues/2118)
39
243
 
40
244
 
41
245
 
@@ -196,7 +400,6 @@ export function factory(compilerInstance: TsCompilerInstance) {
196
400
 
197
401
  ### BREAKING CHANGES
198
402
 
199
- * By default, when no `target` is defined in `tsconfig`, `ts-jest` will transform codes to ES2015 syntax
200
403
  * Now both `isolatedModules: true` and `isolatedModule: false` codes are in one single class `TsCompiler` which is an instance created in `TsJestCompiler` based on config option `compiler` with value `typescript` or `ttypescript`.
201
404
 
202
405
 
@@ -205,11 +408,6 @@ export function factory(compilerInstance: TsCompilerInstance) {
205
408
  # [27.0.0-alpha.0](https://github.com/kulshekhar/ts-jest/compare/v26.4.4...v27.0.0-alpha.0) (2020-11-11)
206
409
 
207
410
 
208
- ### Build System
209
-
210
- * **devs-infra:** build package with target `es2015` ([#2130](https://github.com/kulshekhar/ts-jest/issues/2130)) ([6bd101c](https://github.com/kulshekhar/ts-jest/commit/6bd101ccde60e263352de5bee4a6bd38987eb0ca))
211
-
212
-
213
411
  ### Code Refactoring
214
412
 
215
413
  * **config:** remove support for `astTransformers` string array ([#2129](https://github.com/kulshekhar/ts-jest/issues/2129)) ([1e0b2ce](https://github.com/kulshekhar/ts-jest/commit/1e0b2ce5599a35c108712456e455bf29c8c5fd24))
@@ -221,7 +419,6 @@ export function factory(compilerInstance: TsCompilerInstance) {
221
419
  ### BREAKING CHANGES
222
420
 
223
421
  * **config:** `packageJson` config option is not used in internal `ts-jest` so this option is now removed
224
- * **devs-infra:** `ts-jest` no longer ships with `es5` build but now with `es2015`
225
422
  * **config:** One is defining ast transformers in `jest.config.js`/`package.json` should change to
226
423
  ```
227
424
  // jest.config.js
package/README.md CHANGED
@@ -1,15 +1,14 @@
1
1
  <h1 align="center">ts-jest</h1>
2
2
 
3
- <p align="center">A TypeScript preprocessor with source map support for Jest that lets you use Jest to test projects written in TypeScript.</p>
3
+ <p align="center">A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript.</p>
4
4
 
5
5
  <p align="center">
6
6
  <a href="https://www.npmjs.com/package/ts-jest"><img src="https://img.shields.io/npm/v/ts-jest/latest.svg?style=flat-square" alt="NPM version" /> </a>
7
- <a href="https://www.npmjs.com/package/ts-jest"><img src="https://img.shields.io/npm/v/ts-jest/next.svg?style=flat-square" alt="NPM version" /> </a>
8
7
  <a href="https://www.npmjs.com/package/ts-jest"><img src="https://img.shields.io/npm/dm/ts-jest.svg?style=flat-square" alt="NPM downloads"/> </a>
9
8
  <a href="https://snyk.io/test/github/kulshekhar/ts-jest"><img src="https://snyk.io/test/github/kulshekhar/ts-jest/badge.svg?style=flat-square" alt="Known vulnerabilities"/> </a>
10
9
  <a href="https://coveralls.io/github/kulshekhar/ts-jest?branch=master"><img src="https://coveralls.io/repos/github/kulshekhar/ts-jest/badge.svg?branch=master" alt="Coverage status"/> </a>
11
10
  <a href="https://actions-badge.atrox.dev/kulshekhar/ts-jest/goto?ref=master"><img alt="GitHub actions" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fkulshekhar%2Fts-jest%2Fbadge%3Fref%3Dmaster&style=flat-square" /> </a>
12
- <a href="https://github.com/kulshekhar/ts-jest/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/ts-jest.svg?style=flat-square" alt="GitHub license"/> </a>
11
+ <a href="https://github.com/kulshekhar/ts-jest/blob/master/LICENSE.md"><img src="https://img.shields.io/npm/l/ts-jest.svg?style=flat-square" alt="GitHub license"/> </a>
13
12
  </p>
14
13
 
15
14
  <img src="./icon.png" align="right" title="ts-jest Logo" width="128" height="128">
@@ -25,7 +24,7 @@ It supports all features of TypeScript including type-checking. [Read more about
25
24
 
26
25
  [<img src="./website/static/img/discord.svg" align="left" height="24"> Ask for some help in the `Jest` Discord community](https://discord.gg/j6FKKQQrW9) or [`ts-jest` GitHub Discussion](https://github.com/kulshekhar/ts-jest/discussions)
27
26
 
28
- [<img src="./website/static/img/troubleshooting.png" align="left" height="24"> Before reporting any issue, be sure to check the troubleshooting page](TROUBLESHOOTING.md)
27
+ [<img src="./website/static/img/troubleshooting.png" align="left" height="24"> Before reporting any issues, be sure to check the troubleshooting page](TROUBLESHOOTING.md)
29
28
 
30
29
  [<img src="./website/static/img/pull-request.png" align="left" height="24"> We're looking for collaborators! Want to help improve `ts-jest`?](https://github.com/kulshekhar/ts-jest/issues/223)
31
30
 
@@ -46,7 +45,7 @@ These instructions will get you setup to use `ts-jest` in your project. For more
46
45
 
47
46
  - [TypeScript](https://www.typescriptlang.org/) - JavaScript that scales
48
47
  - [Jest](https://jestjs.io/) - Delightful JavaScript Testing
49
- - [`ts-jest`](https://kulshekhar.github.io/ts-jest) - Jest processor for TypeScript _(yes, `ts-jest` uses itself for its tests)_
48
+ - [`ts-jest`](https://kulshekhar.github.io/ts-jest) - Jest [transformer](https://jestjs.io/docs/next/code-transformation#writing-custom-transformers) for TypeScript _(yes, `ts-jest` uses itself for its tests)_
50
49
 
51
50
  ## Contributing
52
51
 
@@ -70,8 +70,8 @@ var backports_1 = require("../../utils/backports");
70
70
  var presets_1 = require("../helpers/presets");
71
71
  var run = function (args) { return __awaiter(void 0, void 0, void 0, function () {
72
72
  var nullLogger, file, filePath, footNotes, name, isPackage, actualConfig, migratedConfig, presetName, preset, jsTransformers, jsWithTs, jsWithBabel, presetValue, migratedValue, presetValue, migratedValue, before, after, stringify, prefix;
73
- var _a;
74
- return __generator(this, function (_b) {
73
+ var _a, _b, _c, _d, _e, _f, _g, _h;
74
+ return __generator(this, function (_j) {
75
75
  nullLogger = bs_logger_1.createLogger({ targets: [] });
76
76
  file = (_a = args._[0]) === null || _a === void 0 ? void 0 : _a.toString();
77
77
  filePath = path_1.resolve(process.cwd(), file);
@@ -119,32 +119,32 @@ var run = function (args) { return __awaiter(void 0, void 0, void 0, function ()
119
119
  presetName = "ts-jest/presets/default";
120
120
  }
121
121
  }
122
- presetName = presetName || "ts-jest/presets/default";
122
+ presetName = presetName !== null && presetName !== void 0 ? presetName : "ts-jest/presets/default";
123
123
  preset = presets_1.allPresets[presetName];
124
124
  footNotes.push("Detected preset '" + preset.label + "' as the best matching preset for your configuration.\nVisit https://kulshekhar.github.io/ts-jest/user/config/#jest-preset for more information about presets.\n");
125
125
  }
126
- else if (migratedConfig.preset && migratedConfig.preset.startsWith('ts-jest')) {
126
+ else if ((_b = migratedConfig.preset) === null || _b === void 0 ? void 0 : _b.startsWith('ts-jest')) {
127
127
  if (args.jestPreset === false) {
128
128
  delete migratedConfig.preset;
129
129
  }
130
130
  else {
131
- preset = presets_1.allPresets[migratedConfig.preset] || presets_1.defaults;
131
+ preset = (_c = presets_1.allPresets[migratedConfig.preset]) !== null && _c !== void 0 ? _c : presets_1.defaults;
132
132
  }
133
133
  }
134
134
  if (preset)
135
135
  migratedConfig.preset = preset.name;
136
- if (migratedConfig.moduleFileExtensions && migratedConfig.moduleFileExtensions.length && preset) {
137
- presetValue = dedupSort(preset.value.moduleFileExtensions || []).join('::');
136
+ if (((_d = migratedConfig.moduleFileExtensions) === null || _d === void 0 ? void 0 : _d.length) && preset) {
137
+ presetValue = dedupSort((_e = preset.value.moduleFileExtensions) !== null && _e !== void 0 ? _e : []).join('::');
138
138
  migratedValue = dedupSort(migratedConfig.moduleFileExtensions).join('::');
139
139
  if (presetValue === migratedValue) {
140
140
  delete migratedConfig.moduleFileExtensions;
141
141
  }
142
142
  }
143
- if (migratedConfig.testRegex && preset) {
144
- migratedConfig.testMatch = null;
143
+ if ((typeof migratedConfig.testRegex === 'string' || ((_f = migratedConfig.testRegex) === null || _f === void 0 ? void 0 : _f.length)) && preset) {
144
+ delete migratedConfig.testMatch;
145
145
  }
146
- else if (migratedConfig.testMatch && migratedConfig.testMatch.length && preset) {
147
- presetValue = dedupSort(preset.value.testMatch || []).join('::');
146
+ else if (((_g = migratedConfig.testMatch) === null || _g === void 0 ? void 0 : _g.length) && preset) {
147
+ presetValue = dedupSort((_h = preset.value.testMatch) !== null && _h !== void 0 ? _h : []).join('::');
148
148
  migratedValue = dedupSort(migratedConfig.testMatch).join('::');
149
149
  if (presetValue === migratedValue) {
150
150
  delete migratedConfig.testMatch;
@@ -191,21 +191,21 @@ function cleanupConfig(config) {
191
191
  if (config.globals['ts-jest'] && Object.keys(config.globals['ts-jest']).length === 0) {
192
192
  delete config.globals['ts-jest'];
193
193
  }
194
- if (Object.keys(config.globals).length === 0) {
194
+ if (!Object.keys(config.globals).length) {
195
195
  delete config.globals;
196
196
  }
197
197
  }
198
- if (config.transform && Object.keys(config.transform).length === 0) {
198
+ if (config.transform && !Object.keys(config.transform).length) {
199
199
  delete config.transform;
200
200
  }
201
201
  if (config.moduleFileExtensions) {
202
202
  config.moduleFileExtensions = dedupSort(config.moduleFileExtensions);
203
- if (config.moduleFileExtensions.length === 0)
203
+ if (!config.moduleFileExtensions.length)
204
204
  delete config.moduleFileExtensions;
205
205
  }
206
206
  if (config.testMatch) {
207
207
  config.testMatch = dedupSort(config.testMatch);
208
- if (config.testMatch.length === 0)
208
+ if (!config.testMatch.length)
209
209
  delete config.testMatch;
210
210
  }
211
211
  if (config.preset === "ts-jest/presets/default")
@@ -1,2 +1,2 @@
1
1
  export declare const SOURCE_MAPPING_PREFIX = "sourceMappingURL=";
2
- export declare function updateOutput(outputText: string, normalizedFileName: string, sourceMap: string): string;
2
+ export declare function updateOutput(outputText: string, normalizedFileName: string, sourceMap: string | undefined): string;
@@ -4,9 +4,15 @@ exports.updateOutput = exports.SOURCE_MAPPING_PREFIX = void 0;
4
4
  var json_1 = require("../utils/json");
5
5
  exports.SOURCE_MAPPING_PREFIX = 'sourceMappingURL=';
6
6
  function updateOutput(outputText, normalizedFileName, sourceMap) {
7
- var base64Map = Buffer.from(updateSourceMap(sourceMap, normalizedFileName), 'utf8').toString('base64');
8
- var sourceMapContent = "data:application/json;charset=utf-8;base64," + base64Map;
9
- return (outputText.slice(0, outputText.lastIndexOf(exports.SOURCE_MAPPING_PREFIX) + exports.SOURCE_MAPPING_PREFIX.length) + sourceMapContent);
7
+ if (sourceMap) {
8
+ var base64Map = Buffer.from(updateSourceMap(sourceMap, normalizedFileName), 'utf8').toString('base64');
9
+ var sourceMapContent = "data:application/json;charset=utf-8;base64," + base64Map;
10
+ return (outputText.slice(0, outputText.lastIndexOf(exports.SOURCE_MAPPING_PREFIX) + exports.SOURCE_MAPPING_PREFIX.length) +
11
+ sourceMapContent);
12
+ }
13
+ else {
14
+ return outputText;
15
+ }
10
16
  }
11
17
  exports.updateOutput = updateOutput;
12
18
  var updateSourceMap = function (sourceMapText, normalizedFileName) {
@@ -1,7 +1,7 @@
1
1
  import { Logger } from 'bs-logger';
2
2
  import type { TranspileOutput, CompilerOptions, Program, CustomTransformers } from 'typescript';
3
3
  import type { ConfigSet } from '../config/config-set';
4
- import type { StringMap, TsCompilerInstance, TsJestAstTransformer, TTypeScript } from '../types';
4
+ import type { StringMap, TsCompilerInstance, TsJestAstTransformer, TsJestCompileOptions, TTypeScript } from '../types';
5
5
  export declare class TsCompiler implements TsCompilerInstance {
6
6
  readonly configSet: ConfigSet;
7
7
  readonly runtimeCacheFS: StringMap;
@@ -14,7 +14,7 @@ export declare class TsCompiler implements TsCompilerInstance {
14
14
  program: Program | undefined;
15
15
  constructor(configSet: ConfigSet, runtimeCacheFS: StringMap);
16
16
  getResolvedModules(fileContent: string, fileName: string, runtimeCacheFS: StringMap): string[];
17
- getCompiledOutput(fileContent: string, fileName: string, supportsStaticESM: boolean): string;
17
+ getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): string;
18
18
  protected _transpileOutput(fileContent: string, fileName: string): TranspileOutput;
19
19
  protected _makeTransformers(customTransformers: TsJestAstTransformer): CustomTransformers;
20
20
  }
@@ -31,6 +31,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
31
31
  to[j] = from[i];
32
32
  return to;
33
33
  };
34
+ var __values = (this && this.__values) || function(o) {
35
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
36
+ if (m) return m.call(o);
37
+ if (o && typeof o.length === "number") return {
38
+ next: function () {
39
+ if (o && i >= o.length) o = void 0;
40
+ return { value: o && o[i++], done: !o };
41
+ }
42
+ };
43
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
44
+ };
34
45
  var __importDefault = (this && this.__importDefault) || function (mod) {
35
46
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
47
  };
@@ -77,55 +88,6 @@ var TsCompiler = (function () {
77
88
  this._createLanguageService();
78
89
  }
79
90
  }
80
- TsCompiler.prototype._createLanguageService = function () {
81
- var _this = this;
82
- this._parsedTsConfig.fileNames
83
- .filter(function (fileName) { return constants_1.TS_TSX_REGEX.test(fileName) && !_this.configSet.isTestFile(fileName); })
84
- .forEach(function (fileName) { return _this._fileVersionCache.set(fileName, 0); });
85
- var serviceHost = {
86
- getProjectVersion: function () { return String(_this._projectVersion); },
87
- getScriptFileNames: function () { return __spreadArray([], __read(_this._fileVersionCache.keys())); },
88
- getScriptVersion: function (fileName) {
89
- var normalizedFileName = path_1.normalize(fileName);
90
- var version = _this._fileVersionCache.get(normalizedFileName);
91
- return version === undefined ? undefined : String(version);
92
- },
93
- getScriptSnapshot: function (fileName) {
94
- var _a, _b, _c, _d;
95
- var normalizedFileName = path_1.normalize(fileName);
96
- var hit = _this._isFileInCache(normalizedFileName);
97
- _this._logger.trace({ normalizedFileName: normalizedFileName, cacheHit: hit }, 'getScriptSnapshot():', 'cache', hit ? 'hit' : 'miss');
98
- if (!hit) {
99
- var fileContent = (_d = (_b = (_a = _this._fileContentCache.get(normalizedFileName)) !== null && _a !== void 0 ? _a : _this._runtimeCacheFS.get(normalizedFileName)) !== null && _b !== void 0 ? _b : (_c = _this._cachedReadFile) === null || _c === void 0 ? void 0 : _c.call(_this, normalizedFileName)) !== null && _d !== void 0 ? _d : undefined;
100
- if (fileContent) {
101
- _this._fileContentCache.set(normalizedFileName, fileContent);
102
- _this._fileVersionCache.set(normalizedFileName, 1);
103
- }
104
- }
105
- var contents = _this._fileContentCache.get(normalizedFileName);
106
- if (contents === undefined)
107
- return;
108
- return _this._ts.ScriptSnapshot.fromString(contents);
109
- },
110
- fileExists: memoize_1.default(this._ts.sys.fileExists),
111
- readFile: this._cachedReadFile,
112
- readDirectory: memoize_1.default(this._ts.sys.readDirectory),
113
- getDirectories: memoize_1.default(this._ts.sys.getDirectories),
114
- directoryExists: memoize_1.default(this._ts.sys.directoryExists),
115
- realpath: this._ts.sys.realpath && memoize_1.default(this._ts.sys.realpath),
116
- getNewLine: function () { return constants_1.LINE_FEED; },
117
- getCurrentDirectory: function () { return _this.configSet.cwd; },
118
- getCompilationSettings: function () { return _this._compilerOptions; },
119
- getDefaultLibFileName: function () { return _this._ts.getDefaultLibFilePath(_this._compilerOptions); },
120
- getCustomTransformers: function () { return _this._makeTransformers(_this.configSet.resolvedTransformers); },
121
- resolveModuleNames: function (moduleNames, containingFile) {
122
- return moduleNames.map(function (moduleName) { return _this._resolveModuleName(moduleName, containingFile).resolvedModule; });
123
- },
124
- };
125
- this._logger.debug('created language service');
126
- this._languageService = this._ts.createLanguageService(serviceHost, this._ts.createDocumentRegistry());
127
- this.program = this._languageService.getProgram();
128
- };
129
91
  TsCompiler.prototype.getResolvedModules = function (fileContent, fileName, runtimeCacheFS) {
130
92
  var _this = this;
131
93
  if (!this.runtimeCacheFS.size) {
@@ -135,35 +97,18 @@ var TsCompiler = (function () {
135
97
  var importedModulePaths = Array.from(new Set(this._getImportedModulePaths(fileContent, fileName)));
136
98
  this._logger.debug({ fileName: fileName }, 'getResolvedModules(): resolve nested imported module paths from directed imported module paths');
137
99
  importedModulePaths.forEach(function (importedModulePath) {
138
- var normalizedImportedModulePath = path_1.normalize(importedModulePath);
139
- var resolvedFileContent = _this._runtimeCacheFS.get(normalizedImportedModulePath);
140
- if (!resolvedFileContent) {
141
- resolvedFileContent = _this._moduleResolutionHost.readFile(importedModulePath);
142
- _this._runtimeCacheFS.set(normalizedImportedModulePath, resolvedFileContent);
143
- }
100
+ var resolvedFileContent = _this._getFileContentFromCache(importedModulePath);
144
101
  importedModulePaths.push.apply(importedModulePaths, __spreadArray([], __read(_this._getImportedModulePaths(resolvedFileContent, importedModulePath).filter(function (modulePath) { return !importedModulePaths.includes(modulePath); }))));
145
102
  });
146
103
  return importedModulePaths;
147
104
  };
148
- TsCompiler.prototype._getImportedModulePaths = function (resolvedFileContent, containingFile) {
149
- var _this = this;
150
- return this._ts
151
- .preProcessFile(resolvedFileContent, true, true)
152
- .importedFiles.map(function (importedFile) {
153
- var resolvedModule = _this._resolveModuleName(importedFile.fileName, containingFile).resolvedModule;
154
- var resolvedFileName = resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.resolvedFileName;
155
- return resolvedFileName && !(resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.isExternalLibraryImport) ? resolvedFileName : '';
156
- })
157
- .filter(function (resolveFileName) { return !!resolveFileName; });
158
- };
159
- TsCompiler.prototype._resolveModuleName = function (moduleNameToResolve, containingFile) {
160
- return this._ts.resolveModuleName(moduleNameToResolve, containingFile, this._compilerOptions, this._moduleResolutionHost, this._moduleResolutionCache);
161
- };
162
- TsCompiler.prototype.getCompiledOutput = function (fileContent, fileName, supportsStaticESM) {
105
+ TsCompiler.prototype.getCompiledOutput = function (fileContent, fileName, options) {
163
106
  var moduleKind = this._initialCompilerOptions.module;
164
107
  var esModuleInterop = this._initialCompilerOptions.esModuleInterop;
165
108
  var allowSyntheticDefaultImports = this._initialCompilerOptions.allowSyntheticDefaultImports;
166
- if (supportsStaticESM && this.configSet.useESM) {
109
+ var currentModuleKind = this._compilerOptions.module;
110
+ if ((this.configSet.babelJestTransformer || (!this.configSet.babelJestTransformer && options.supportsStaticESM)) &&
111
+ this.configSet.useESM) {
167
112
  moduleKind =
168
113
  !moduleKind ||
169
114
  (moduleKind &&
@@ -180,20 +125,26 @@ var TsCompiler = (function () {
180
125
  esModuleInterop: esModuleInterop, module: moduleKind });
181
126
  if (this._languageService) {
182
127
  this._logger.debug({ fileName: fileName }, 'getCompiledOutput(): compiling using language service');
183
- this._updateMemoryCache(fileContent, fileName);
128
+ this._updateMemoryCache(fileContent, fileName, currentModuleKind === moduleKind);
184
129
  var output = this._languageService.getEmitOutput(fileName);
185
- this._logger.debug({ fileName: fileName }, 'getCompiledOutput(): computing diagnostics using language service');
186
- this._doTypeChecking(fileName);
130
+ this._doTypeChecking(fileName, options.depGraphs, options.watchMode);
187
131
  if (output.emitSkipped) {
188
- this._logger.warn(messages_1.interpolate("Unable to process '{{file}}', falling back to original file content. Please make sure that `outDir` in your tsconfig is neither `''` or `'.'`. You can also configure Jest config option `transformIgnorePatterns` to ignore {{file}} from transformation", { file: fileName }));
189
- return fileContent;
132
+ if (constants_1.TS_TSX_REGEX.test(fileName)) {
133
+ throw new Error(messages_1.interpolate("Unable to process '{{file}}', please make sure that `outDir` in your tsconfig is neither `''` or `'.'`. You can also configure Jest config option `transformIgnorePatterns` to inform `ts-jest` to transform {{file}}", { file: fileName }));
134
+ }
135
+ else {
136
+ this._logger.warn(messages_1.interpolate("Unable to process '{{file}}', falling back to original file content. You can also configure Jest config option `transformIgnorePatterns` to ignore {{file}} from transformation or make sure that `outDir` in your tsconfig is neither `''` or `'.'`", { file: fileName }));
137
+ return compiler_utils_1.updateOutput(fileContent, fileName, undefined);
138
+ }
190
139
  }
191
140
  if (!output.outputFiles.length) {
192
141
  throw new TypeError(messages_1.interpolate("Unable to require `.d.ts` file for file: {{file}}.\nThis is usually the result of a faulty configuration or import. Make sure there is a `.js`, `.json` or another executable extension available alongside `{{file}}`.", {
193
142
  file: path_1.basename(fileName),
194
143
  }));
195
144
  }
196
- return compiler_utils_1.updateOutput(output.outputFiles[1].text, fileName, output.outputFiles[0].text);
145
+ return this._compilerOptions.sourceMap
146
+ ? compiler_utils_1.updateOutput(output.outputFiles[1].text, fileName, output.outputFiles[0].text)
147
+ : compiler_utils_1.updateOutput(output.outputFiles[0].text, fileName, undefined);
197
148
  }
198
149
  else {
199
150
  this._logger.debug({ fileName: fileName }, 'getCompiledOutput(): compiling as isolated module');
@@ -226,13 +177,85 @@ var TsCompiler = (function () {
226
177
  }),
227
178
  };
228
179
  };
180
+ TsCompiler.prototype._createLanguageService = function () {
181
+ var _this = this;
182
+ this._parsedTsConfig.fileNames
183
+ .filter(function (fileName) { return constants_1.TS_TSX_REGEX.test(fileName) && !_this.configSet.isTestFile(fileName); })
184
+ .forEach(function (fileName) { return _this._fileVersionCache.set(fileName, 0); });
185
+ var serviceHost = {
186
+ getProjectVersion: function () { return String(_this._projectVersion); },
187
+ getScriptFileNames: function () { return __spreadArray([], __read(_this._fileVersionCache.keys())); },
188
+ getScriptVersion: function (fileName) {
189
+ var normalizedFileName = path_1.normalize(fileName);
190
+ var version = _this._fileVersionCache.get(normalizedFileName);
191
+ return version === undefined ? undefined : String(version);
192
+ },
193
+ getScriptSnapshot: function (fileName) {
194
+ var _a, _b, _c, _d;
195
+ var normalizedFileName = path_1.normalize(fileName);
196
+ var hit = _this._isFileInCache(normalizedFileName);
197
+ _this._logger.trace({ normalizedFileName: normalizedFileName, cacheHit: hit }, 'getScriptSnapshot():', 'cache', hit ? 'hit' : 'miss');
198
+ if (!hit) {
199
+ var fileContent = (_d = (_b = (_a = _this._fileContentCache.get(normalizedFileName)) !== null && _a !== void 0 ? _a : _this._runtimeCacheFS.get(normalizedFileName)) !== null && _b !== void 0 ? _b : (_c = _this._cachedReadFile) === null || _c === void 0 ? void 0 : _c.call(_this, normalizedFileName)) !== null && _d !== void 0 ? _d : undefined;
200
+ if (fileContent !== undefined) {
201
+ _this._fileContentCache.set(normalizedFileName, fileContent);
202
+ _this._fileVersionCache.set(normalizedFileName, 1);
203
+ }
204
+ }
205
+ var contents = _this._fileContentCache.get(normalizedFileName);
206
+ if (contents === undefined)
207
+ return;
208
+ return _this._ts.ScriptSnapshot.fromString(contents);
209
+ },
210
+ fileExists: memoize_1.default(this._ts.sys.fileExists),
211
+ readFile: this._cachedReadFile,
212
+ readDirectory: memoize_1.default(this._ts.sys.readDirectory),
213
+ getDirectories: memoize_1.default(this._ts.sys.getDirectories),
214
+ directoryExists: memoize_1.default(this._ts.sys.directoryExists),
215
+ realpath: this._ts.sys.realpath && memoize_1.default(this._ts.sys.realpath),
216
+ getNewLine: function () { return constants_1.LINE_FEED; },
217
+ getCurrentDirectory: function () { return _this.configSet.cwd; },
218
+ getCompilationSettings: function () { return _this._compilerOptions; },
219
+ getDefaultLibFileName: function () { return _this._ts.getDefaultLibFilePath(_this._compilerOptions); },
220
+ getCustomTransformers: function () { return _this._makeTransformers(_this.configSet.resolvedTransformers); },
221
+ resolveModuleNames: function (moduleNames, containingFile) {
222
+ return moduleNames.map(function (moduleName) { return _this._resolveModuleName(moduleName, containingFile).resolvedModule; });
223
+ },
224
+ };
225
+ this._logger.debug('created language service');
226
+ this._languageService = this._ts.createLanguageService(serviceHost, this._ts.createDocumentRegistry());
227
+ this.program = this._languageService.getProgram();
228
+ };
229
+ TsCompiler.prototype._getFileContentFromCache = function (filePath) {
230
+ var normalizedFilePath = path_1.normalize(filePath);
231
+ var resolvedFileContent = this._runtimeCacheFS.get(normalizedFilePath);
232
+ if (!resolvedFileContent) {
233
+ resolvedFileContent = this._moduleResolutionHost.readFile(normalizedFilePath);
234
+ this._runtimeCacheFS.set(normalizedFilePath, resolvedFileContent);
235
+ }
236
+ return resolvedFileContent;
237
+ };
238
+ TsCompiler.prototype._getImportedModulePaths = function (resolvedFileContent, containingFile) {
239
+ var _this = this;
240
+ return this._ts
241
+ .preProcessFile(resolvedFileContent, true, true)
242
+ .importedFiles.map(function (importedFile) {
243
+ var resolvedModule = _this._resolveModuleName(importedFile.fileName, containingFile).resolvedModule;
244
+ var resolvedFileName = resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.resolvedFileName;
245
+ return resolvedFileName && !(resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.isExternalLibraryImport) ? resolvedFileName : '';
246
+ })
247
+ .filter(function (resolveFileName) { return !!resolveFileName; });
248
+ };
249
+ TsCompiler.prototype._resolveModuleName = function (moduleNameToResolve, containingFile) {
250
+ return this._ts.resolveModuleName(moduleNameToResolve, containingFile, this._compilerOptions, this._moduleResolutionHost, this._moduleResolutionCache);
251
+ };
229
252
  TsCompiler.prototype._isFileInCache = function (fileName) {
230
253
  return (this._fileContentCache.has(fileName) &&
231
254
  this._fileVersionCache.has(fileName) &&
232
255
  this._fileVersionCache.get(fileName) !== 0);
233
256
  };
234
- TsCompiler.prototype._updateMemoryCache = function (contents, fileName) {
235
- var _a;
257
+ TsCompiler.prototype._updateMemoryCache = function (contents, fileName, isModuleKindTheSame) {
258
+ if (isModuleKindTheSame === void 0) { isModuleKindTheSame = true; }
236
259
  this._logger.debug({ fileName: fileName }, 'updateMemoryCache: update memory cache for language service');
237
260
  var shouldIncrementProjectVersion = false;
238
261
  var hit = this._isFileInCache(fileName);
@@ -241,26 +264,50 @@ var TsCompiler = (function () {
241
264
  shouldIncrementProjectVersion = true;
242
265
  }
243
266
  else {
244
- var prevVersion = (_a = this._fileVersionCache.get(fileName)) !== null && _a !== void 0 ? _a : 0;
267
+ var prevVersion = this._fileVersionCache.get(fileName);
245
268
  var previousContents = this._fileContentCache.get(fileName);
246
269
  if (previousContents !== contents) {
247
270
  this._fileVersionCache.set(fileName, prevVersion + 1);
248
271
  this._fileContentCache.set(fileName, contents);
249
- if (hit)
250
- shouldIncrementProjectVersion = true;
272
+ shouldIncrementProjectVersion = true;
251
273
  }
252
- if (!this._parsedTsConfig.fileNames.includes(fileName)) {
274
+ if (!this._parsedTsConfig.fileNames.includes(fileName) || !isModuleKindTheSame) {
253
275
  shouldIncrementProjectVersion = true;
254
276
  }
255
277
  }
256
278
  if (shouldIncrementProjectVersion)
257
279
  this._projectVersion++;
258
280
  };
259
- TsCompiler.prototype._doTypeChecking = function (fileName) {
281
+ TsCompiler.prototype._doTypeChecking = function (fileName, depGraphs, watchMode) {
282
+ var e_1, _a;
260
283
  if (this.configSet.shouldReportDiagnostics(fileName)) {
261
- var diagnostics = this._languageService.getSemanticDiagnostics(fileName).concat(this._languageService.getSyntacticDiagnostics(fileName));
284
+ this._logger.debug({ fileName: fileName }, '_doTypeChecking(): computing diagnostics using language service');
285
+ var diagnostics = __spreadArray(__spreadArray([], __read(this._languageService.getSemanticDiagnostics(fileName))), __read(this._languageService.getSyntacticDiagnostics(fileName)));
262
286
  this.configSet.raiseDiagnostics(diagnostics, fileName, this._logger);
263
287
  }
288
+ if (watchMode) {
289
+ this._logger.debug({ fileName: fileName }, '_doTypeChecking(): starting watch mode computing diagnostics');
290
+ try {
291
+ for (var _b = __values(depGraphs.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
292
+ var entry = _c.value;
293
+ var normalizedModuleNames = entry[1].resolvedModuleNames.map(function (moduleName) { return path_1.normalize(moduleName); });
294
+ var fileToReTypeCheck = entry[0];
295
+ if (normalizedModuleNames.includes(fileName) && this.configSet.shouldReportDiagnostics(fileToReTypeCheck)) {
296
+ this._logger.debug({ fileToReTypeCheck: fileToReTypeCheck }, '_doTypeChecking(): computing diagnostics using language service');
297
+ this._updateMemoryCache(this._getFileContentFromCache(fileToReTypeCheck), fileToReTypeCheck);
298
+ var importedModulesDiagnostics = __spreadArray(__spreadArray([], __read(this._languageService.getSemanticDiagnostics(fileToReTypeCheck))), __read(this._languageService.getSyntacticDiagnostics(fileToReTypeCheck)));
299
+ this.configSet.raiseDiagnostics(importedModulesDiagnostics, fileName, this._logger);
300
+ }
301
+ }
302
+ }
303
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
304
+ finally {
305
+ try {
306
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
307
+ }
308
+ finally { if (e_1) throw e_1.error; }
309
+ }
310
+ }
264
311
  };
265
312
  return TsCompiler;
266
313
  }());
@@ -1,8 +1,8 @@
1
1
  import type { ConfigSet } from '../config/config-set';
2
- import type { CompilerInstance, StringMap } from '../types';
2
+ import type { CompilerInstance, StringMap, TsJestCompileOptions } from '../types';
3
3
  export declare class TsJestCompiler implements CompilerInstance {
4
4
  private readonly _compilerInstance;
5
5
  constructor(configSet: ConfigSet, runtimeCacheFS: StringMap);
6
6
  getResolvedModules(fileContent: string, fileName: string, runtimeCacheFS: StringMap): string[];
7
- getCompiledOutput(fileContent: string, fileName: string, supportsStaticESM: boolean): string;
7
+ getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): string;
8
8
  }
@@ -9,8 +9,8 @@ var TsJestCompiler = (function () {
9
9
  TsJestCompiler.prototype.getResolvedModules = function (fileContent, fileName, runtimeCacheFS) {
10
10
  return this._compilerInstance.getResolvedModules(fileContent, fileName, runtimeCacheFS);
11
11
  };
12
- TsJestCompiler.prototype.getCompiledOutput = function (fileContent, fileName, supportsStaticESM) {
13
- return this._compilerInstance.getCompiledOutput(fileContent, fileName, supportsStaticESM);
12
+ TsJestCompiler.prototype.getCompiledOutput = function (fileContent, fileName, options) {
13
+ return this._compilerInstance.getCompiledOutput(fileContent, fileName, options);
14
14
  };
15
15
  return TsJestCompiler;
16
16
  }());
@@ -115,9 +115,7 @@ var ConfigSet = (function () {
115
115
  };
116
116
  this.useESM = false;
117
117
  this._overriddenCompilerOptions = {
118
- sourceMap: true,
119
118
  inlineSourceMap: false,
120
- inlineSources: true,
121
119
  declaration: false,
122
120
  noEmit: false,
123
121
  removeComments: false,
@@ -209,9 +207,9 @@ var ConfigSet = (function () {
209
207
  throws: diagnosticsOpt,
210
208
  };
211
209
  }
212
- this._shouldGetDiagnosticsForFile = this._diagnostics.exclude.length
210
+ this._shouldIgnoreDiagnosticsForFile = this._diagnostics.exclude.length
213
211
  ? jest_util_1.globsToMatcher(this._diagnostics.exclude)
214
- : function () { return true; };
212
+ : function () { return false; };
215
213
  this.logger.debug({ diagnostics: this._diagnostics }, 'normalized diagnostics config via ts-jest option');
216
214
  var tsconfigOpt = options.tsconfig;
217
215
  var configFilePath = typeof tsconfigOpt === 'string' ? this.resolvePath(tsconfigOpt) : undefined;
@@ -275,7 +273,7 @@ var ConfigSet = (function () {
275
273
  };
276
274
  ConfigSet.prototype._getAndResolveTsConfig = function (compilerOptions, resolvedConfigFile) {
277
275
  var e_2, _a, _b;
278
- var _c, _d;
276
+ var _c, _d, _e;
279
277
  var result = this._resolveTsConfig(compilerOptions, resolvedConfigFile);
280
278
  var forcedOptions = this._overriddenCompilerOptions;
281
279
  var finalOptions = result.options;
@@ -306,8 +304,8 @@ var ConfigSet = (function () {
306
304
  finalOptions.outDir = exports.TS_JEST_OUT_DIR;
307
305
  }
308
306
  try {
309
- for (var _e = __values(Object.keys(forcedOptions)), _f = _e.next(); !_f.done; _f = _e.next()) {
310
- var key = _f.value;
307
+ for (var _f = __values(Object.keys(forcedOptions)), _g = _f.next(); !_g.done; _g = _f.next()) {
308
+ var key = _g.value;
311
309
  var val = forcedOptions[key];
312
310
  if (val === undefined) {
313
311
  delete finalOptions[key];
@@ -320,7 +318,7 @@ var ConfigSet = (function () {
320
318
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
321
319
  finally {
322
320
  try {
323
- if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
321
+ if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
324
322
  }
325
323
  finally { if (e_2) throw e_2.error; }
326
324
  }
@@ -342,7 +340,9 @@ var ConfigSet = (function () {
342
340
  });
343
341
  this.logger.warn(message);
344
342
  }
345
- return __assign(__assign({}, result), { options: __assign(__assign({}, result.options), { module: (_d = result.options.module) !== null && _d !== void 0 ? _d : this.compilerModule.ModuleKind.CommonJS }) });
343
+ var resultOptions = result.options;
344
+ var sourceMap = (_d = resultOptions.sourceMap) !== null && _d !== void 0 ? _d : true;
345
+ return __assign(__assign({}, result), { options: __assign(__assign({}, resultOptions), { sourceMap: sourceMap, inlineSources: sourceMap, module: (_e = resultOptions.module) !== null && _e !== void 0 ? _e : this.compilerModule.ModuleKind.CommonJS }) });
346
346
  };
347
347
  ConfigSet.prototype._resolveTsConfig = function (compilerOptions, resolvedConfigFile) {
348
348
  var config = { compilerOptions: Object.create(null) };
@@ -397,8 +397,8 @@ var ConfigSet = (function () {
397
397
  ConfigSet.prototype.shouldReportDiagnostics = function (filePath) {
398
398
  var fileExtension = path_1.extname(filePath);
399
399
  return constants_1.JS_JSX_EXTENSIONS.includes(fileExtension)
400
- ? this.parsedTsConfig.options.checkJs && this._shouldGetDiagnosticsForFile(filePath)
401
- : this._shouldGetDiagnosticsForFile(filePath);
400
+ ? this.parsedTsConfig.options.checkJs && !this._shouldIgnoreDiagnosticsForFile(filePath)
401
+ : !this._shouldIgnoreDiagnosticsForFile(filePath);
402
402
  };
403
403
  ConfigSet.prototype._createTsError = function (diagnostics) {
404
404
  var _this = this;
@@ -5,6 +5,7 @@ export interface RawCompilerOptions {
5
5
  declarationDir?: string | null;
6
6
  diagnostics?: boolean;
7
7
  disableReferencedProjectLoad?: boolean;
8
+ noPropertyAccessFromIndexSignature?: boolean;
8
9
  emitBOM?: boolean;
9
10
  emitDeclarationOnly?: boolean;
10
11
  incremental?: boolean;
@@ -18,9 +19,9 @@ export interface RawCompilerOptions {
18
19
  jsxImportSource?: string;
19
20
  listFiles?: boolean;
20
21
  mapRoot?: string;
21
- module?: 'CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None' | string;
22
- moduleResolution?: 'Classic' | 'Node';
23
- newLine?: 'crlf' | 'lf';
22
+ module?: ('CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None') | string;
23
+ moduleResolution?: ('Classic' | 'Node') | string;
24
+ newLine?: ('crlf' | 'lf') | string;
24
25
  noEmit?: boolean;
25
26
  noEmitHelpers?: boolean;
26
27
  noEmitOnError?: boolean;
@@ -46,7 +47,7 @@ export interface RawCompilerOptions {
46
47
  sourceRoot?: string;
47
48
  suppressExcessPropertyErrors?: boolean;
48
49
  suppressImplicitAnyIndexErrors?: boolean;
49
- target?: 'ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ESNext' | string;
50
+ target?: ('ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ESNext') | string;
50
51
  watch?: boolean;
51
52
  fallbackPolling?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling';
52
53
  watchDirectory?: 'useFsEvents' | 'fixedPollingInterval' | 'dynamicPriorityPolling';
@@ -78,7 +79,7 @@ export interface RawCompilerOptions {
78
79
  noImplicitUseStrict?: boolean;
79
80
  listEmittedFiles?: boolean;
80
81
  disableSizeLimit?: boolean;
81
- lib?: Array<'ES5' | 'ES6' | 'ES2015' | 'ES2015.Collection' | 'ES2015.Core' | 'ES2015.Generator' | 'ES2015.Iterable' | 'ES2015.Promise' | 'ES2015.Proxy' | 'ES2015.Reflect' | 'ES2015.Symbol.WellKnown' | 'ES2015.Symbol' | 'ES2016' | 'ES2016.Array.Include' | 'ES2017' | 'ES2017.Intl' | 'ES2017.Object' | 'ES2017.SharedMemory' | 'ES2017.String' | 'ES2017.TypedArrays' | 'ES2018' | 'ES2018.AsyncGenerator' | 'ES2018.AsyncIterable' | 'ES2018.Intl' | 'ES2018.Promise' | 'ES2018.Regexp' | 'ES2019' | 'ES2019.Array' | 'ES2019.Object' | 'ES2019.String' | 'ES2019.Symbol' | 'ES2020' | 'ES2020.BigInt' | 'ES2020.Promise' | 'ES2020.String' | 'ES2020.Symbol.WellKnown' | 'ESNext' | 'ESNext.Array' | 'ESNext.AsyncIterable' | 'ESNext.BigInt' | 'ESNext.Intl' | 'ESNext.Promise' | 'ESNext.String' | 'ESNext.Symbol' | 'DOM' | 'DOM.Iterable' | 'ScriptHost' | 'WebWorker' | 'WebWorker.ImportScripts'>;
82
+ lib?: Array<('ES5' | 'ES6' | 'ES2015' | 'ES2015.Collection' | 'ES2015.Core' | 'ES2015.Generator' | 'ES2015.Iterable' | 'ES2015.Promise' | 'ES2015.Proxy' | 'ES2015.Reflect' | 'ES2015.Symbol.WellKnown' | 'ES2015.Symbol' | 'ES2016' | 'ES2016.Array.Include' | 'ES2017' | 'ES2017.Intl' | 'ES2017.Object' | 'ES2017.SharedMemory' | 'ES2017.String' | 'ES2017.TypedArrays' | 'ES2018' | 'ES2018.AsyncGenerator' | 'ES2018.AsyncIterable' | 'ES2018.Intl' | 'ES2018.Promise' | 'ES2018.Regexp' | 'ES2019' | 'ES2019.Array' | 'ES2019.Object' | 'ES2019.String' | 'ES2019.Symbol' | 'ES2020' | 'ES2020.BigInt' | 'ES2020.Promise' | 'ES2020.String' | 'ES2020.Symbol.WellKnown' | 'ESNext' | 'ESNext.Array' | 'ESNext.AsyncIterable' | 'ESNext.BigInt' | 'ESNext.Intl' | 'ESNext.Promise' | 'ESNext.String' | 'ESNext.Symbol' | 'DOM' | 'DOM.Iterable' | 'ScriptHost' | 'WebWorker' | 'WebWorker.ImportScripts') | string>;
82
83
  strictNullChecks?: boolean;
83
84
  maxNodeModuleJsDepth?: number;
84
85
  importHelpers?: boolean;
@@ -8,6 +8,7 @@ export declare class TsJestTransformer implements SyncTransformer {
8
8
  private _tsResolvedModulesCachePath;
9
9
  private _transformCfgStr;
10
10
  private _depGraphs;
11
+ private _watchMode;
11
12
  constructor();
12
13
  private _configsFor;
13
14
  protected _createConfigSet(config: ProjectConfigTsJest | undefined): ConfigSet;
@@ -53,6 +53,7 @@ exports.CACHE_KEY_EL_SEPARATOR = '\x00';
53
53
  var TsJestTransformer = (function () {
54
54
  function TsJestTransformer() {
55
55
  this._depGraphs = new Map();
56
+ this._watchMode = false;
56
57
  this._logger = logger_1.rootLogger.child({ namespace: 'ts-jest-transformer' });
57
58
  version_checkers_1.VersionCheckers.jest.warn();
58
59
  this.getCacheKey = this.getCacheKey.bind(this);
@@ -68,6 +69,7 @@ var TsJestTransformer = (function () {
68
69
  this._compiler = ccs.compiler;
69
70
  this._depGraphs = ccs.depGraphs;
70
71
  this._tsResolvedModulesCachePath = ccs.tsResolvedModulesCachePath;
72
+ this._watchMode = ccs.watchMode;
71
73
  configSet = ccs.configSet;
72
74
  }
73
75
  else {
@@ -79,6 +81,7 @@ var TsJestTransformer = (function () {
79
81
  this._compiler = serializedCcs.compiler;
80
82
  this._depGraphs = serializedCcs.depGraphs;
81
83
  this._tsResolvedModulesCachePath = serializedCcs.tsResolvedModulesCachePath;
84
+ this._watchMode = serializedCcs.watchMode;
82
85
  configSet = serializedCcs.configSet;
83
86
  }
84
87
  else {
@@ -90,6 +93,7 @@ var TsJestTransformer = (function () {
90
93
  this._transformCfgStr = "" + new jsonable_value_1.JsonableValue(jest_1).serialized + configSet.cacheSuffix;
91
94
  this._createCompiler(configSet, cacheFS);
92
95
  this._getFsCachedResolvedModules(configSet);
96
+ this._watchMode = process.argv.includes('--watch');
93
97
  TsJestTransformer._cachedConfigSets.push({
94
98
  jestConfig: new jsonable_value_1.JsonableValue(config),
95
99
  configSet: configSet,
@@ -97,6 +101,7 @@ var TsJestTransformer = (function () {
97
101
  compiler: this._compiler,
98
102
  depGraphs: this._depGraphs,
99
103
  tsResolvedModulesCachePath: this._tsResolvedModulesCachePath,
104
+ watchMode: this._watchMode,
100
105
  });
101
106
  }
102
107
  }
@@ -138,7 +143,11 @@ var TsJestTransformer = (function () {
138
143
  result = fileContent;
139
144
  }
140
145
  else if (isJsFile || isTsFile) {
141
- result = this._compiler.getCompiledOutput(fileContent, filePath, transformOptions.supportsStaticESM);
146
+ result = this._compiler.getCompiledOutput(fileContent, filePath, {
147
+ depGraphs: this._depGraphs,
148
+ supportsStaticESM: transformOptions.supportsStaticESM,
149
+ watchMode: this._watchMode,
150
+ });
142
151
  }
143
152
  else {
144
153
  var message = babelJest ? "Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore. If you still want Babel to process it, add another entry to the `transform` option with value `babel-jest` which key matches this type of files." : "Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore.";
package/dist/types.d.ts CHANGED
@@ -62,9 +62,14 @@ export interface DepGraphInfo {
62
62
  fileContent: string;
63
63
  resolvedModuleNames: string[];
64
64
  }
65
+ export interface TsJestCompileOptions {
66
+ depGraphs: Map<string, DepGraphInfo>;
67
+ watchMode: boolean;
68
+ supportsStaticESM: boolean;
69
+ }
65
70
  export interface CompilerInstance {
66
71
  getResolvedModules(fileContent: string, fileName: string, runtimeCacheFS: StringMap): string[];
67
- getCompiledOutput(fileContent: string, fileName: string, supportsStaticESM: boolean): string;
72
+ getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): string;
68
73
  }
69
74
  export interface TsCompilerInstance extends CompilerInstance {
70
75
  configSet: ConfigSet;
@@ -7,9 +7,9 @@ var logger_1 = require("./logger");
7
7
  var messages_1 = require("./messages");
8
8
  var logger = logger_1.rootLogger.child({ namespace: 'versions' });
9
9
  exports.VersionCheckers = {
10
- jest: createVersionChecker('jest', ">=27.0.0-next.5 <28"),
10
+ jest: createVersionChecker('jest', ">=27.0.0 <28"),
11
11
  typescript: createVersionChecker('typescript', ">=3.8 <5"),
12
- babelJest: createVersionChecker('babel-jest', ">=27.0.0-next.5 <28"),
12
+ babelJest: createVersionChecker('babel-jest', ">=27.0.0 <28"),
13
13
  babelCore: createVersionChecker('@babel/core', ">=7.0.0-beta.0 <8"),
14
14
  };
15
15
  function checkVersion(name, expectedRange, action) {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "27.0.0-next.9",
3
+ "version": "27.0.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": {
7
7
  "ts-jest": "cli.js"
8
8
  },
9
- "description": "A preprocessor with source maps support to help use TypeScript with Jest",
9
+ "description": "A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript",
10
10
  "scripts": {
11
11
  "prebuild": "node scripts/pre-build.js",
12
12
  "build": "tsc -p tsconfig.build.json",
@@ -21,9 +21,8 @@
21
21
  "test:external-repos": "npm run test:external external-repos",
22
22
  "lint": "node_modules/.bin/eslint --ext .js,.ts .",
23
23
  "lint:fix": "node_modules/.bin/eslint --fix --ext .js,.ts .",
24
- "lint:prettier": "prettier '**/*.{yml,yaml}' 'website/**/*.{css,js,md}' 'CONTRIBUTING.md' 'README.md' 'TROUBLESHOOTING.md'",
25
- "lint:prettier-format": "yarn lint:prettier --write --ignore-path .gitignore",
26
- "lint:prettier-ci": "yarn lint:prettier --check --ignore-path .gitignore",
24
+ "lint:prettier": "prettier 'scripts/**' '**/*.{yml,yaml}' 'website/**/*.{css,js,md}' 'CONTRIBUTING.md' 'README.md' 'TROUBLESHOOTING.md' --write --ignore-path .gitignore",
25
+ "lint:prettier-ci": "prettier 'scripts/**' '**/*.{yml,yaml}' 'website/**/*.{css,js,md}' 'CONTRIBUTING.md' 'README.md' 'TROUBLESHOOTING.md' --check --ignore-path .gitignore",
27
26
  "doc": "cd website && npm run start",
28
27
  "doc:build": "cd website && npm run build",
29
28
  "changelog": "node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
@@ -60,7 +59,7 @@
60
59
  "bs-logger": "0.x",
61
60
  "buffer-from": "1.x",
62
61
  "fast-json-stable-stringify": "2.x",
63
- "jest-util": "27.0.0-next.3",
62
+ "jest-util": "^27.0.0",
64
63
  "json5": "2.x",
65
64
  "lodash": "4.x",
66
65
  "make-error": "1.x",
@@ -69,7 +68,7 @@
69
68
  "yargs-parser": "20.x"
70
69
  },
71
70
  "peerDependencies": {
72
- "jest": "27.0.0-next.5",
71
+ "jest": "^27.0.0",
73
72
  "typescript": ">=3.8 <5.0"
74
73
  },
75
74
  "husky": {
@@ -82,8 +81,8 @@
82
81
  "devDependencies": {
83
82
  "@commitlint/cli": "12.x",
84
83
  "@commitlint/config-angular": "^12.0.0",
85
- "@jest/transform": "27.0.0-next.5",
86
- "@jest/types": "27.0.0-next.3",
84
+ "@jest/transform": "^27.0.0",
85
+ "@jest/types": "^27.0.0",
87
86
  "@types/babel__core": "7.x",
88
87
  "@types/buffer-from": "latest",
89
88
  "@types/cross-spawn": "latest",
@@ -93,7 +92,7 @@
93
92
  "@types/lodash": "4.x",
94
93
  "@types/micromatch": "4.x",
95
94
  "@types/mkdirp": "latest",
96
- "@types/node": "14.x",
95
+ "@types/node": "14.14.43",
97
96
  "@types/node-fetch": "^2.5.8",
98
97
  "@types/react": "17.x",
99
98
  "@types/semver": "latest",
@@ -111,18 +110,19 @@
111
110
  "eslint-plugin-prefer-arrow": "latest",
112
111
  "eslint-plugin-prettier": "latest",
113
112
  "execa": "latest",
114
- "fs-extra": "9.x",
113
+ "fs-extra": "10.x",
114
+ "glob": "^7.1.7",
115
115
  "glob-gitignore": "latest",
116
116
  "husky": "4.x",
117
- "jest": "27.0.0-next.5",
117
+ "jest": "^27.0.0",
118
118
  "js-yaml": "latest",
119
- "json-schema-to-typescript": "^10.1.3",
119
+ "json-schema-to-typescript": "^10.1.4",
120
120
  "lint-staged": "latest",
121
121
  "node-fetch": "^2.6.1",
122
122
  "npm-run-all": "latest",
123
- "prettier": "2.x",
123
+ "prettier": "2.3.0",
124
124
  "source-map": "latest",
125
- "typescript": "^4.1.2"
125
+ "typescript": "~4.2.4"
126
126
  },
127
127
  "lint-staged": {
128
128
  "*.{ts,tsx,js,jsx}": [
@@ -131,6 +131,6 @@
131
131
  ]
132
132
  },
133
133
  "engines": {
134
- "node": ">= 10"
134
+ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
135
135
  }
136
136
  }