ts-jest 27.0.0-next.6 → 27.0.0
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 +1 -1
- package/CHANGELOG.md +244 -7
- package/README.md +4 -5
- package/dist/cli/config/migrate.js +12 -8
- package/dist/compiler/compiler-utils.d.ts +1 -1
- package/dist/compiler/compiler-utils.js +9 -3
- package/dist/compiler/ts-compiler.d.ts +7 -5
- package/dist/compiler/ts-compiler.js +170 -94
- package/dist/compiler/ts-jest-compiler.d.ts +8 -1
- package/dist/compiler/ts-jest-compiler.js +6 -8
- package/dist/config/config-set.d.ts +4 -4
- package/dist/config/config-set.js +25 -24
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -5
- package/dist/raw-compiler-options.d.ts +106 -0
- package/dist/raw-compiler-options.js +2 -0
- package/dist/transformers/hoist-jest.js +8 -6
- package/dist/ts-jest-transformer.d.ts +13 -17
- package/dist/ts-jest-transformer.js +36 -16
- package/dist/types.d.ts +25 -17
- package/dist/utils/importer.js +8 -7
- package/dist/utils/json.js +5 -2
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/ts-error.js +2 -0
- package/dist/utils/version-checkers.js +2 -2
- package/package.json +31 -19
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a1376fb91cb7def505cacd7981109827042bd189
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,247 @@
|
|
|
1
|
+
# [27.0.0](https://github.com/kulshekhar/ts-jest/compare/v26.5.6...v27.0.0) (2021-05-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **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)
|
|
7
|
+
* **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)
|
|
8
|
+
* **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)
|
|
9
|
+
* **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)
|
|
10
|
+
* **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)
|
|
11
|
+
* 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)
|
|
12
|
+
* **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)
|
|
13
|
+
* **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)
|
|
14
|
+
* **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)
|
|
15
|
+
* **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))
|
|
16
|
+
* **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)
|
|
17
|
+
* **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)
|
|
18
|
+
* **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))
|
|
19
|
+
* 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))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* **config:** allow disable sourcemap ([#2544](https://github.com/kulshekhar/ts-jest/issues/2544)) ([47da6ad](https://github.com/kulshekhar/ts-jest/commit/47da6ada5089e58e9bc68ce8e9bc9e17aaa127ae))
|
|
25
|
+
* **compiler:** expose `TsCompiler` as public api ([#2344](https://github.com/kulshekhar/ts-jest/issues/2344)) ([871cd6a](https://github.com/kulshekhar/ts-jest/commit/871cd6a3abb10569a04d05f72bbb41c952665ed4))
|
|
26
|
+
* **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))
|
|
27
|
+
* **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))
|
|
28
|
+
* **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))
|
|
29
|
+
* **config:** replace `pathRegex` with `exclude` ([#2295](https://github.com/kulshekhar/ts-jest/issues/2295)) ([f2f99c3](https://github.com/kulshekhar/ts-jest/commit/f2f99c3a46ac18a1fd6cc98922329b71a7e8c4e8))
|
|
30
|
+
* **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))
|
|
31
|
+
* **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)
|
|
32
|
+
* **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)
|
|
33
|
+
* **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))
|
|
34
|
+
* 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))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Performance Improvements
|
|
38
|
+
|
|
39
|
+
* 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))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Code Refactoring
|
|
43
|
+
|
|
44
|
+
* **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))
|
|
45
|
+
* **config:** remove support for `packageJson` option ([#2128](https://github.com/kulshekhar/ts-jest/issues/2128)) ([05916b9](https://github.com/kulshekhar/ts-jest/commit/05916b920160da5b43a20b47025eea43b4a1a5c3))
|
|
46
|
+
* 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))
|
|
47
|
+
* **config:** remove support for `tsConfig` option ([#2127](https://github.com/kulshekhar/ts-jest/issues/2127)) ([3cc9b80](https://github.com/kulshekhar/ts-jest/commit/3cc9b806be2b2096b981253d39ca40df65bb0f7b))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## BREAKING CHANGES
|
|
51
|
+
|
|
52
|
+
* 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`.
|
|
53
|
+
* follow Jest support Node engines ([#2478](https://github.com/kulshekhar/ts-jest/pull/2478)) ([1fecf7f](https://github.com/kulshekhar/ts-jest/commit/1fecf7ff92a5f1a0cc6ea1d27026f9f54a3d5ead))
|
|
54
|
+
* 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))
|
|
55
|
+
* `ts-jest` custom AST transformer function signature has changed to
|
|
56
|
+
```
|
|
57
|
+
import type { TsCompilerInstance } from 'ts-jest/dist/types'
|
|
58
|
+
|
|
59
|
+
export function factory(compilerInstance: TsCompilerInstance) {
|
|
60
|
+
//...
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
* One is currently using `pathRegex` should use `exclude` with `glob` patterns.
|
|
64
|
+
* If one currently relies on type check for `js` files, please set `checkJs: true` in your tsconfig.
|
|
65
|
+
* 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`.
|
|
66
|
+
* **config:** `packageJson` config option is not used in internal `ts-jest` so this option is now removed.
|
|
67
|
+
* **config:** One is defining ast transformers in `jest.config.js`/`package.json` should change to
|
|
68
|
+
```
|
|
69
|
+
// jest.config.js
|
|
70
|
+
module.exports = {
|
|
71
|
+
//...
|
|
72
|
+
globals: {
|
|
73
|
+
'ts-jest': {
|
|
74
|
+
astTransformers: {
|
|
75
|
+
before: ['your_before_transformer_path'],
|
|
76
|
+
after: ['your_after_transformer_path'],
|
|
77
|
+
afterDeclarations: ['your_afterDeclarations_transformer_path'],
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
or
|
|
85
|
+
```
|
|
86
|
+
// package.json
|
|
87
|
+
{
|
|
88
|
+
"jest": {
|
|
89
|
+
"globals": {
|
|
90
|
+
"ts-jest": {
|
|
91
|
+
"astTransformers": {
|
|
92
|
+
"before": ["your_before_transformer_path"],
|
|
93
|
+
"after": ["your_after_transformer_path"],
|
|
94
|
+
"afterDeclarations": ["your_afterDeclarations_transformer_path"]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
* One currently refers type in `jest.config.js`
|
|
102
|
+
```
|
|
103
|
+
/** @typedef {import('ts-jest')} */
|
|
104
|
+
module.exports = {
|
|
105
|
+
//...
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
should change to
|
|
110
|
+
```
|
|
111
|
+
/** @typedef {import('ts-jest/dist/types')} */
|
|
112
|
+
module.exports = {
|
|
113
|
+
//...
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
* Remove possibilities to import `mocked`, `createJestPreset`, `pathsToModuleNameMapper` from package entry. One should change to
|
|
117
|
+
```
|
|
118
|
+
import { mocked, createJestPreset, pathsToModuleNameMapper` } from 'ts-jest/utils'
|
|
119
|
+
```
|
|
120
|
+
* **config:** One currently uses `tsConfig` should change to `tsconfig` in your `jest.config.js` or `package.json`.
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## [26.5.6](https://github.com/kulshekhar/ts-jest/compare/v26.5.5...v26.5.6) (2021-05-05)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Code Refactoring
|
|
128
|
+
|
|
129
|
+
* 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)).
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
# [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)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### Features
|
|
137
|
+
|
|
138
|
+
* **config:** allow disable sourcemap ([#2544](https://github.com/kulshekhar/ts-jest/issues/2544)) ([47da6ad](https://github.com/kulshekhar/ts-jest/commit/47da6ada5089e58e9bc68ce8e9bc9e17aaa127ae))
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
## BREAKING CHANGES
|
|
142
|
+
|
|
143
|
+
* 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`
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
## [26.5.5](https://github.com/kulshekhar/ts-jest/compare/v26.5.4...v26.5.5) (2021-04-15)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### Bug Fixes
|
|
151
|
+
|
|
152
|
+
* **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)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# [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)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
### Bug Fixes
|
|
160
|
+
|
|
161
|
+
* **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)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# [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)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
### Bug Fixes
|
|
169
|
+
|
|
170
|
+
* **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)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
## BREAKING CHANGES
|
|
174
|
+
|
|
175
|
+
* follow Jest node engines ([#2478](https://github.com/kulshekhar/ts-jest/pull/2478)) ([1fecf7f](https://github.com/kulshekhar/ts-jest/commit/1fecf7ff92a5f1a0cc6ea1d27026f9f54a3d5ead))
|
|
176
|
+
* 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))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
# [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)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
### Bug Fixes
|
|
184
|
+
|
|
185
|
+
* **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)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
## [26.5.4](https://github.com/kulshekhar/ts-jest/compare/v26.5.3...v26.5.4) (2021-03-17)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### Bug Fixes
|
|
193
|
+
|
|
194
|
+
* **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)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
# [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)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
### Bug Fixes
|
|
202
|
+
|
|
203
|
+
* **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)
|
|
204
|
+
* **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)
|
|
205
|
+
* 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)
|
|
206
|
+
* **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)
|
|
207
|
+
* **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)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
## [26.5.3](https://github.com/kulshekhar/ts-jest/compare/v26.5.2...v26.5.3) (2021-03-03)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
### Bug Fixes
|
|
215
|
+
|
|
216
|
+
* **config:** create fallback jest config when jest config is undefined ([#2421](https://github.com/kulshekhar/ts-jest/issues/2421)) ([0fb6b45](https://github.com/kulshekhar/ts-jest/commit/0fb6b45e7dc3dd7588d27f09ac9a8849dff470cb)), closes [#2085](https://github.com/kulshekhar/ts-jest/issues/2085)
|
|
217
|
+
* remove `@types/jest` from direct dep ([#2416](https://github.com/kulshekhar/ts-jest/issues/2416)) ([060302e](https://github.com/kulshekhar/ts-jest/commit/060302ed1eb8708df0acd7ab1d613ff06fc08cf3)), closes [#2406](https://github.com/kulshekhar/ts-jest/issues/2406) [#2411](https://github.com/kulshekhar/ts-jest/issues/2411)
|
|
218
|
+
* **compiler:** return original file content on emit skip ([#2408](https://github.com/kulshekhar/ts-jest/issues/2408)) ([cfba8f4](https://github.com/kulshekhar/ts-jest/commit/cfba8f423dd59536d8b1e1374ef2b20bff2ed857)), closes [#2407](https://github.com/kulshekhar/ts-jest/issues/2407)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
# [27.0.0-next.7](https://github.com/kulshekhar/ts-jest/compare/v27.0.0-next.6...v27.0.0-next.7) (2021-02-24)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
### Bug Fixes
|
|
226
|
+
|
|
227
|
+
* **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)
|
|
228
|
+
* **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))
|
|
229
|
+
* **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)
|
|
230
|
+
* **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)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## [26.5.2](https://github.com/kulshekhar/ts-jest/compare/v26.5.1...v26.5.2) (2021-02-21)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
### Bug Fixes
|
|
238
|
+
|
|
239
|
+
* **compiler:** exclude files in `outDir` from compiler source files ([#2376](https://github.com/kulshekhar/ts-jest/issues/2376)) ([9034677](https://github.com/kulshekhar/ts-jest/commit/9034677f9ce0968339d3d942a70e888996fac532)), closes [#2350](https://github.com/kulshekhar/ts-jest/issues/2350) [#2374](https://github.com/kulshekhar/ts-jest/issues/2374)
|
|
240
|
+
* **config:** define `matchTestFilePath` before `setupTsJestCfg` ([#2373](https://github.com/kulshekhar/ts-jest/issues/2373)) ([c427fea](https://github.com/kulshekhar/ts-jest/commit/c427fea48a24b5ce6e8b9260d3c322583b062a77)), closes [#2371](https://github.com/kulshekhar/ts-jest/issues/2371)
|
|
241
|
+
* **config:** improve emit skipped error message ([#2357](https://github.com/kulshekhar/ts-jest/issues/2357)) ([f2808bb](https://github.com/kulshekhar/ts-jest/commit/f2808bb0b15231c67ccb9a97ed606741213c03e6))
|
|
242
|
+
* **typings:** set correct typing for `tsconfig`/`tsConfig` option ([#2377](https://github.com/kulshekhar/ts-jest/issues/2377)) ([d4f6aff](https://github.com/kulshekhar/ts-jest/commit/d4f6aff3f181761bf25c64ff1a97dd19a69196f9)), closes [#2368](https://github.com/kulshekhar/ts-jest/issues/2368)
|
|
243
|
+
|
|
244
|
+
|
|
1
245
|
# [27.0.0-next.6](https://github.com/kulshekhar/ts-jest/compare/v27.0.0-next.5...v27.0.0-next.6) (2021-02-11)
|
|
2
246
|
|
|
3
247
|
|
|
@@ -121,7 +365,6 @@ export function factory(compilerInstance: TsCompilerInstance) {
|
|
|
121
365
|
|
|
122
366
|
### BREAKING CHANGES
|
|
123
367
|
|
|
124
|
-
* By default, when no `target` is defined in `tsconfig`, `ts-jest` will transform codes to ES2015 syntax
|
|
125
368
|
* 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`.
|
|
126
369
|
|
|
127
370
|
|
|
@@ -130,11 +373,6 @@ export function factory(compilerInstance: TsCompilerInstance) {
|
|
|
130
373
|
# [27.0.0-alpha.0](https://github.com/kulshekhar/ts-jest/compare/v26.4.4...v27.0.0-alpha.0) (2020-11-11)
|
|
131
374
|
|
|
132
375
|
|
|
133
|
-
### Build System
|
|
134
|
-
|
|
135
|
-
* **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))
|
|
136
|
-
|
|
137
|
-
|
|
138
376
|
### Code Refactoring
|
|
139
377
|
|
|
140
378
|
* **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))
|
|
@@ -146,7 +384,6 @@ export function factory(compilerInstance: TsCompilerInstance) {
|
|
|
146
384
|
### BREAKING CHANGES
|
|
147
385
|
|
|
148
386
|
* **config:** `packageJson` config option is not used in internal `ts-jest` so this option is now removed
|
|
149
|
-
* **devs-infra:** `ts-jest` no longer ships with `es5` build but now with `es2015`
|
|
150
387
|
* **config:** One is defining ast transformers in `jest.config.js`/`package.json` should change to
|
|
151
388
|
```
|
|
152
389
|
// 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
|
|
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
|
|
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
|
|
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
|
|
|
@@ -51,16 +51,20 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
51
51
|
}
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
|
-
var
|
|
55
|
-
for (var
|
|
56
|
-
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
55
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
56
|
+
to[j] = from[i];
|
|
57
|
+
return to;
|
|
58
|
+
};
|
|
59
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
60
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
57
61
|
};
|
|
58
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
63
|
exports.help = exports.run = void 0;
|
|
60
64
|
var fs_1 = require("fs");
|
|
61
65
|
var path_1 = require("path");
|
|
62
66
|
var bs_logger_1 = require("bs-logger");
|
|
63
|
-
var
|
|
67
|
+
var fast_json_stable_stringify_1 = __importDefault(require("fast-json-stable-stringify"));
|
|
64
68
|
var json5_1 = require("json5");
|
|
65
69
|
var backports_1 = require("../../utils/backports");
|
|
66
70
|
var presets_1 = require("../helpers/presets");
|
|
@@ -99,7 +103,7 @@ var run = function (args) { return __awaiter(void 0, void 0, void 0, function ()
|
|
|
99
103
|
transformer = 'babel-jest';
|
|
100
104
|
else if (/\ts-jest\b/.test(transformer))
|
|
101
105
|
transformer = 'ts-jest';
|
|
102
|
-
return
|
|
106
|
+
return __spreadArray(__spreadArray([], __read(list)), [transformer]);
|
|
103
107
|
}
|
|
104
108
|
return list;
|
|
105
109
|
}, []);
|
|
@@ -157,13 +161,13 @@ var run = function (args) { return __awaiter(void 0, void 0, void 0, function ()
|
|
|
157
161
|
}
|
|
158
162
|
if (preset &&
|
|
159
163
|
migratedConfig.transform &&
|
|
160
|
-
|
|
164
|
+
fast_json_stable_stringify_1.default(migratedConfig.transform) === fast_json_stable_stringify_1.default(preset.value.transform)) {
|
|
161
165
|
delete migratedConfig.transform;
|
|
162
166
|
}
|
|
163
167
|
cleanupConfig(actualConfig);
|
|
164
168
|
cleanupConfig(migratedConfig);
|
|
165
|
-
before =
|
|
166
|
-
after =
|
|
169
|
+
before = fast_json_stable_stringify_1.default(actualConfig);
|
|
170
|
+
after = fast_json_stable_stringify_1.default(migratedConfig);
|
|
167
171
|
if (after === before) {
|
|
168
172
|
process.stderr.write("\nNo migration needed for given Jest configuration\n ");
|
|
169
173
|
return [2];
|
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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,18 +1,20 @@
|
|
|
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 {
|
|
4
|
+
import type { StringMap, TsCompilerInstance, TsJestAstTransformer, TsJestCompileOptions, TTypeScript } from '../types';
|
|
5
5
|
export declare class TsCompiler implements TsCompilerInstance {
|
|
6
6
|
readonly configSet: ConfigSet;
|
|
7
|
-
readonly
|
|
7
|
+
readonly runtimeCacheFS: StringMap;
|
|
8
8
|
protected readonly _logger: Logger;
|
|
9
9
|
protected readonly _ts: TTypeScript;
|
|
10
10
|
protected readonly _initialCompilerOptions: CompilerOptions;
|
|
11
11
|
protected _compilerOptions: CompilerOptions;
|
|
12
|
+
private _runtimeCacheFS;
|
|
13
|
+
private _fileContentCache;
|
|
12
14
|
program: Program | undefined;
|
|
13
|
-
constructor(configSet: ConfigSet,
|
|
14
|
-
|
|
15
|
-
getCompiledOutput(fileContent: string, fileName: string,
|
|
15
|
+
constructor(configSet: ConfigSet, runtimeCacheFS: StringMap);
|
|
16
|
+
getResolvedModules(fileContent: string, fileName: string, runtimeCacheFS: StringMap): string[];
|
|
17
|
+
getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): string;
|
|
16
18
|
protected _transpileOutput(fileContent: string, fileName: string): TranspileOutput;
|
|
17
19
|
protected _makeTransformers(customTransformers: TsJestAstTransformer): CustomTransformers;
|
|
18
20
|
}
|