ts-jest 27.0.0-next.9 → 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 +176 -14
- package/README.md +4 -5
- package/dist/compiler/compiler-utils.d.ts +1 -1
- package/dist/compiler/compiler-utils.js +9 -3
- package/dist/compiler/ts-compiler.d.ts +2 -2
- package/dist/compiler/ts-compiler.js +126 -82
- package/dist/compiler/ts-jest-compiler.d.ts +2 -2
- package/dist/compiler/ts-jest-compiler.js +2 -2
- package/dist/config/config-set.js +7 -7
- package/dist/raw-compiler-options.d.ts +6 -5
- package/dist/ts-jest-transformer.d.ts +1 -0
- package/dist/ts-jest-transformer.js +10 -1
- package/dist/types.d.ts +6 -1
- package/dist/utils/version-checkers.js +2 -2
- package/package.json +22 -15
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a1376fb91cb7def505cacd7981109827042bd189
|
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,188 @@
|
|
|
1
|
-
# [27.0.0
|
|
1
|
+
# [27.0.0](https://github.com/kulshekhar/ts-jest/compare/v26.5.6...v27.0.0) (2021-05-25)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
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)
|
|
6
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)
|
|
7
134
|
|
|
8
135
|
|
|
9
136
|
### Features
|
|
10
137
|
|
|
11
|
-
*
|
|
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)
|
|
12
186
|
|
|
13
187
|
|
|
14
188
|
|
|
@@ -33,11 +207,6 @@
|
|
|
33
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)
|
|
34
208
|
|
|
35
209
|
|
|
36
|
-
### Features
|
|
37
|
-
|
|
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))
|
|
39
|
-
|
|
40
|
-
|
|
41
210
|
|
|
42
211
|
## [26.5.3](https://github.com/kulshekhar/ts-jest/compare/v26.5.2...v26.5.3) (2021-03-03)
|
|
43
212
|
|
|
@@ -196,7 +365,6 @@ export function factory(compilerInstance: TsCompilerInstance) {
|
|
|
196
365
|
|
|
197
366
|
### BREAKING CHANGES
|
|
198
367
|
|
|
199
|
-
* By default, when no `target` is defined in `tsconfig`, `ts-jest` will transform codes to ES2015 syntax
|
|
200
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`.
|
|
201
369
|
|
|
202
370
|
|
|
@@ -205,11 +373,6 @@ export function factory(compilerInstance: TsCompilerInstance) {
|
|
|
205
373
|
# [27.0.0-alpha.0](https://github.com/kulshekhar/ts-jest/compare/v26.4.4...v27.0.0-alpha.0) (2020-11-11)
|
|
206
374
|
|
|
207
375
|
|
|
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
376
|
### Code Refactoring
|
|
214
377
|
|
|
215
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))
|
|
@@ -221,7 +384,6 @@ export function factory(compilerInstance: TsCompilerInstance) {
|
|
|
221
384
|
### BREAKING CHANGES
|
|
222
385
|
|
|
223
386
|
* **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
387
|
* **config:** One is defining ast transformers in `jest.config.js`/`package.json` should change to
|
|
226
388
|
```
|
|
227
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
|
|
|
@@ -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,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,
|
|
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,16 @@ 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
|
|
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.
|
|
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
|
+
if (options.supportsStaticESM && this.configSet.useESM) {
|
|
167
110
|
moduleKind =
|
|
168
111
|
!moduleKind ||
|
|
169
112
|
(moduleKind &&
|
|
@@ -182,18 +125,24 @@ var TsCompiler = (function () {
|
|
|
182
125
|
this._logger.debug({ fileName: fileName }, 'getCompiledOutput(): compiling using language service');
|
|
183
126
|
this._updateMemoryCache(fileContent, fileName);
|
|
184
127
|
var output = this._languageService.getEmitOutput(fileName);
|
|
185
|
-
this.
|
|
186
|
-
this._doTypeChecking(fileName);
|
|
128
|
+
this._doTypeChecking(fileName, options.depGraphs, options.watchMode);
|
|
187
129
|
if (output.emitSkipped) {
|
|
188
|
-
|
|
189
|
-
|
|
130
|
+
if (constants_1.TS_TSX_REGEX.test(fileName)) {
|
|
131
|
+
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 }));
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
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 }));
|
|
135
|
+
return compiler_utils_1.updateOutput(fileContent, fileName, undefined);
|
|
136
|
+
}
|
|
190
137
|
}
|
|
191
138
|
if (!output.outputFiles.length) {
|
|
192
139
|
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
140
|
file: path_1.basename(fileName),
|
|
194
141
|
}));
|
|
195
142
|
}
|
|
196
|
-
return
|
|
143
|
+
return this._compilerOptions.sourceMap
|
|
144
|
+
? compiler_utils_1.updateOutput(output.outputFiles[1].text, fileName, output.outputFiles[0].text)
|
|
145
|
+
: compiler_utils_1.updateOutput(output.outputFiles[0].text, fileName, undefined);
|
|
197
146
|
}
|
|
198
147
|
else {
|
|
199
148
|
this._logger.debug({ fileName: fileName }, 'getCompiledOutput(): compiling as isolated module');
|
|
@@ -226,13 +175,84 @@ var TsCompiler = (function () {
|
|
|
226
175
|
}),
|
|
227
176
|
};
|
|
228
177
|
};
|
|
178
|
+
TsCompiler.prototype._createLanguageService = function () {
|
|
179
|
+
var _this = this;
|
|
180
|
+
this._parsedTsConfig.fileNames
|
|
181
|
+
.filter(function (fileName) { return constants_1.TS_TSX_REGEX.test(fileName) && !_this.configSet.isTestFile(fileName); })
|
|
182
|
+
.forEach(function (fileName) { return _this._fileVersionCache.set(fileName, 0); });
|
|
183
|
+
var serviceHost = {
|
|
184
|
+
getProjectVersion: function () { return String(_this._projectVersion); },
|
|
185
|
+
getScriptFileNames: function () { return __spreadArray([], __read(_this._fileVersionCache.keys())); },
|
|
186
|
+
getScriptVersion: function (fileName) {
|
|
187
|
+
var normalizedFileName = path_1.normalize(fileName);
|
|
188
|
+
var version = _this._fileVersionCache.get(normalizedFileName);
|
|
189
|
+
return version === undefined ? undefined : String(version);
|
|
190
|
+
},
|
|
191
|
+
getScriptSnapshot: function (fileName) {
|
|
192
|
+
var _a, _b, _c, _d;
|
|
193
|
+
var normalizedFileName = path_1.normalize(fileName);
|
|
194
|
+
var hit = _this._isFileInCache(normalizedFileName);
|
|
195
|
+
_this._logger.trace({ normalizedFileName: normalizedFileName, cacheHit: hit }, 'getScriptSnapshot():', 'cache', hit ? 'hit' : 'miss');
|
|
196
|
+
if (!hit) {
|
|
197
|
+
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;
|
|
198
|
+
if (fileContent) {
|
|
199
|
+
_this._fileContentCache.set(normalizedFileName, fileContent);
|
|
200
|
+
_this._fileVersionCache.set(normalizedFileName, 1);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
var contents = _this._fileContentCache.get(normalizedFileName);
|
|
204
|
+
if (contents === undefined)
|
|
205
|
+
return;
|
|
206
|
+
return _this._ts.ScriptSnapshot.fromString(contents);
|
|
207
|
+
},
|
|
208
|
+
fileExists: memoize_1.default(this._ts.sys.fileExists),
|
|
209
|
+
readFile: this._cachedReadFile,
|
|
210
|
+
readDirectory: memoize_1.default(this._ts.sys.readDirectory),
|
|
211
|
+
getDirectories: memoize_1.default(this._ts.sys.getDirectories),
|
|
212
|
+
directoryExists: memoize_1.default(this._ts.sys.directoryExists),
|
|
213
|
+
realpath: this._ts.sys.realpath && memoize_1.default(this._ts.sys.realpath),
|
|
214
|
+
getNewLine: function () { return constants_1.LINE_FEED; },
|
|
215
|
+
getCurrentDirectory: function () { return _this.configSet.cwd; },
|
|
216
|
+
getCompilationSettings: function () { return _this._compilerOptions; },
|
|
217
|
+
getDefaultLibFileName: function () { return _this._ts.getDefaultLibFilePath(_this._compilerOptions); },
|
|
218
|
+
getCustomTransformers: function () { return _this._makeTransformers(_this.configSet.resolvedTransformers); },
|
|
219
|
+
resolveModuleNames: function (moduleNames, containingFile) {
|
|
220
|
+
return moduleNames.map(function (moduleName) { return _this._resolveModuleName(moduleName, containingFile).resolvedModule; });
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
this._logger.debug('created language service');
|
|
224
|
+
this._languageService = this._ts.createLanguageService(serviceHost, this._ts.createDocumentRegistry());
|
|
225
|
+
this.program = this._languageService.getProgram();
|
|
226
|
+
};
|
|
227
|
+
TsCompiler.prototype._getFileContentFromCache = function (filePath) {
|
|
228
|
+
var normalizedFilePath = path_1.normalize(filePath);
|
|
229
|
+
var resolvedFileContent = this._runtimeCacheFS.get(normalizedFilePath);
|
|
230
|
+
if (!resolvedFileContent) {
|
|
231
|
+
resolvedFileContent = this._moduleResolutionHost.readFile(normalizedFilePath);
|
|
232
|
+
this._runtimeCacheFS.set(normalizedFilePath, resolvedFileContent);
|
|
233
|
+
}
|
|
234
|
+
return resolvedFileContent;
|
|
235
|
+
};
|
|
236
|
+
TsCompiler.prototype._getImportedModulePaths = function (resolvedFileContent, containingFile) {
|
|
237
|
+
var _this = this;
|
|
238
|
+
return this._ts
|
|
239
|
+
.preProcessFile(resolvedFileContent, true, true)
|
|
240
|
+
.importedFiles.map(function (importedFile) {
|
|
241
|
+
var resolvedModule = _this._resolveModuleName(importedFile.fileName, containingFile).resolvedModule;
|
|
242
|
+
var resolvedFileName = resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.resolvedFileName;
|
|
243
|
+
return resolvedFileName && !(resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.isExternalLibraryImport) ? resolvedFileName : '';
|
|
244
|
+
})
|
|
245
|
+
.filter(function (resolveFileName) { return !!resolveFileName; });
|
|
246
|
+
};
|
|
247
|
+
TsCompiler.prototype._resolveModuleName = function (moduleNameToResolve, containingFile) {
|
|
248
|
+
return this._ts.resolveModuleName(moduleNameToResolve, containingFile, this._compilerOptions, this._moduleResolutionHost, this._moduleResolutionCache);
|
|
249
|
+
};
|
|
229
250
|
TsCompiler.prototype._isFileInCache = function (fileName) {
|
|
230
251
|
return (this._fileContentCache.has(fileName) &&
|
|
231
252
|
this._fileVersionCache.has(fileName) &&
|
|
232
253
|
this._fileVersionCache.get(fileName) !== 0);
|
|
233
254
|
};
|
|
234
255
|
TsCompiler.prototype._updateMemoryCache = function (contents, fileName) {
|
|
235
|
-
var _a;
|
|
236
256
|
this._logger.debug({ fileName: fileName }, 'updateMemoryCache: update memory cache for language service');
|
|
237
257
|
var shouldIncrementProjectVersion = false;
|
|
238
258
|
var hit = this._isFileInCache(fileName);
|
|
@@ -241,13 +261,12 @@ var TsCompiler = (function () {
|
|
|
241
261
|
shouldIncrementProjectVersion = true;
|
|
242
262
|
}
|
|
243
263
|
else {
|
|
244
|
-
var prevVersion =
|
|
264
|
+
var prevVersion = this._fileVersionCache.get(fileName);
|
|
245
265
|
var previousContents = this._fileContentCache.get(fileName);
|
|
246
266
|
if (previousContents !== contents) {
|
|
247
267
|
this._fileVersionCache.set(fileName, prevVersion + 1);
|
|
248
268
|
this._fileContentCache.set(fileName, contents);
|
|
249
|
-
|
|
250
|
-
shouldIncrementProjectVersion = true;
|
|
269
|
+
shouldIncrementProjectVersion = true;
|
|
251
270
|
}
|
|
252
271
|
if (!this._parsedTsConfig.fileNames.includes(fileName)) {
|
|
253
272
|
shouldIncrementProjectVersion = true;
|
|
@@ -256,11 +275,36 @@ var TsCompiler = (function () {
|
|
|
256
275
|
if (shouldIncrementProjectVersion)
|
|
257
276
|
this._projectVersion++;
|
|
258
277
|
};
|
|
259
|
-
TsCompiler.prototype._doTypeChecking = function (fileName) {
|
|
278
|
+
TsCompiler.prototype._doTypeChecking = function (fileName, depGraphs, watchMode) {
|
|
279
|
+
var e_1, _a;
|
|
260
280
|
if (this.configSet.shouldReportDiagnostics(fileName)) {
|
|
261
|
-
|
|
281
|
+
this._logger.debug({ fileName: fileName }, '_doTypeChecking(): computing diagnostics using language service');
|
|
282
|
+
var diagnostics = __spreadArray(__spreadArray([], __read(this._languageService.getSemanticDiagnostics(fileName))), __read(this._languageService.getSyntacticDiagnostics(fileName)));
|
|
262
283
|
this.configSet.raiseDiagnostics(diagnostics, fileName, this._logger);
|
|
263
284
|
}
|
|
285
|
+
if (watchMode) {
|
|
286
|
+
this._logger.debug({ fileName: fileName }, '_doTypeChecking(): starting watch mode computing diagnostics');
|
|
287
|
+
try {
|
|
288
|
+
for (var _b = __values(depGraphs.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
289
|
+
var entry = _c.value;
|
|
290
|
+
var normalizedModuleNames = entry[1].resolvedModuleNames.map(function (moduleName) { return path_1.normalize(moduleName); });
|
|
291
|
+
var fileToReTypeCheck = entry[0];
|
|
292
|
+
if (normalizedModuleNames.includes(fileName) && this.configSet.shouldReportDiagnostics(fileToReTypeCheck)) {
|
|
293
|
+
this._logger.debug({ fileToReTypeCheck: fileToReTypeCheck }, '_doTypeChecking(): computing diagnostics using language service');
|
|
294
|
+
this._updateMemoryCache(this._getFileContentFromCache(fileToReTypeCheck), fileToReTypeCheck);
|
|
295
|
+
var importedModulesDiagnostics = __spreadArray(__spreadArray([], __read(this._languageService.getSemanticDiagnostics(fileToReTypeCheck))), __read(this._languageService.getSyntacticDiagnostics(fileToReTypeCheck)));
|
|
296
|
+
this.configSet.raiseDiagnostics(importedModulesDiagnostics, fileName, this._logger);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
301
|
+
finally {
|
|
302
|
+
try {
|
|
303
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
304
|
+
}
|
|
305
|
+
finally { if (e_1) throw e_1.error; }
|
|
306
|
+
}
|
|
307
|
+
}
|
|
264
308
|
};
|
|
265
309
|
return TsCompiler;
|
|
266
310
|
}());
|
|
@@ -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,
|
|
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,
|
|
13
|
-
return this._compilerInstance.getCompiledOutput(fileContent, fileName,
|
|
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,
|
|
@@ -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
|
|
310
|
-
var key =
|
|
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 (
|
|
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
|
-
|
|
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) };
|
|
@@ -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,
|
|
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,
|
|
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
|
|
10
|
+
jest: createVersionChecker('jest', ">=27.0.0 <28"),
|
|
11
11
|
typescript: createVersionChecker('typescript', ">=3.8 <5"),
|
|
12
|
-
babelJest: createVersionChecker('babel-jest', ">=27.0.0
|
|
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,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-jest",
|
|
3
|
-
"version": "27.0.0
|
|
3
|
+
"version": "27.0.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/index.js",
|
|
8
|
+
"./dist/*": "./dist/*.js",
|
|
9
|
+
"./jest-preset": "./jest-preset.js",
|
|
10
|
+
"./preset": "./presets/index.js",
|
|
11
|
+
"./utils": "./utils/index.js",
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
6
14
|
"bin": {
|
|
7
15
|
"ts-jest": "cli.js"
|
|
8
16
|
},
|
|
9
|
-
"description": "A
|
|
17
|
+
"description": "A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript",
|
|
10
18
|
"scripts": {
|
|
11
19
|
"prebuild": "node scripts/pre-build.js",
|
|
12
20
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -21,9 +29,8 @@
|
|
|
21
29
|
"test:external-repos": "npm run test:external external-repos",
|
|
22
30
|
"lint": "node_modules/.bin/eslint --ext .js,.ts .",
|
|
23
31
|
"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-
|
|
26
|
-
"lint:prettier-ci": "yarn lint:prettier --check --ignore-path .gitignore",
|
|
32
|
+
"lint:prettier": "prettier 'scripts/**' '**/*.{yml,yaml}' 'website/**/*.{css,js,md}' 'CONTRIBUTING.md' 'README.md' 'TROUBLESHOOTING.md' --write --ignore-path .gitignore",
|
|
33
|
+
"lint:prettier-ci": "prettier 'scripts/**' '**/*.{yml,yaml}' 'website/**/*.{css,js,md}' 'CONTRIBUTING.md' 'README.md' 'TROUBLESHOOTING.md' --check --ignore-path .gitignore",
|
|
27
34
|
"doc": "cd website && npm run start",
|
|
28
35
|
"doc:build": "cd website && npm run build",
|
|
29
36
|
"changelog": "node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
|
|
@@ -60,7 +67,7 @@
|
|
|
60
67
|
"bs-logger": "0.x",
|
|
61
68
|
"buffer-from": "1.x",
|
|
62
69
|
"fast-json-stable-stringify": "2.x",
|
|
63
|
-
"jest-util": "27.0.0
|
|
70
|
+
"jest-util": "^27.0.0",
|
|
64
71
|
"json5": "2.x",
|
|
65
72
|
"lodash": "4.x",
|
|
66
73
|
"make-error": "1.x",
|
|
@@ -69,7 +76,7 @@
|
|
|
69
76
|
"yargs-parser": "20.x"
|
|
70
77
|
},
|
|
71
78
|
"peerDependencies": {
|
|
72
|
-
"jest": "27.0.0
|
|
79
|
+
"jest": "^27.0.0",
|
|
73
80
|
"typescript": ">=3.8 <5.0"
|
|
74
81
|
},
|
|
75
82
|
"husky": {
|
|
@@ -82,8 +89,8 @@
|
|
|
82
89
|
"devDependencies": {
|
|
83
90
|
"@commitlint/cli": "12.x",
|
|
84
91
|
"@commitlint/config-angular": "^12.0.0",
|
|
85
|
-
"@jest/transform": "27.0.0
|
|
86
|
-
"@jest/types": "27.0.0
|
|
92
|
+
"@jest/transform": "^27.0.0",
|
|
93
|
+
"@jest/types": "^27.0.0",
|
|
87
94
|
"@types/babel__core": "7.x",
|
|
88
95
|
"@types/buffer-from": "latest",
|
|
89
96
|
"@types/cross-spawn": "latest",
|
|
@@ -93,7 +100,7 @@
|
|
|
93
100
|
"@types/lodash": "4.x",
|
|
94
101
|
"@types/micromatch": "4.x",
|
|
95
102
|
"@types/mkdirp": "latest",
|
|
96
|
-
"@types/node": "14.
|
|
103
|
+
"@types/node": "14.14.43",
|
|
97
104
|
"@types/node-fetch": "^2.5.8",
|
|
98
105
|
"@types/react": "17.x",
|
|
99
106
|
"@types/semver": "latest",
|
|
@@ -111,16 +118,16 @@
|
|
|
111
118
|
"eslint-plugin-prefer-arrow": "latest",
|
|
112
119
|
"eslint-plugin-prettier": "latest",
|
|
113
120
|
"execa": "latest",
|
|
114
|
-
"fs-extra": "
|
|
121
|
+
"fs-extra": "10.x",
|
|
115
122
|
"glob-gitignore": "latest",
|
|
116
123
|
"husky": "4.x",
|
|
117
|
-
"jest": "27.0.0
|
|
124
|
+
"jest": "^27.0.0",
|
|
118
125
|
"js-yaml": "latest",
|
|
119
|
-
"json-schema-to-typescript": "^10.1.
|
|
126
|
+
"json-schema-to-typescript": "^10.1.4",
|
|
120
127
|
"lint-staged": "latest",
|
|
121
128
|
"node-fetch": "^2.6.1",
|
|
122
129
|
"npm-run-all": "latest",
|
|
123
|
-
"prettier": "2.
|
|
130
|
+
"prettier": "2.3.0",
|
|
124
131
|
"source-map": "latest",
|
|
125
132
|
"typescript": "^4.1.2"
|
|
126
133
|
},
|
|
@@ -131,6 +138,6 @@
|
|
|
131
138
|
]
|
|
132
139
|
},
|
|
133
140
|
"engines": {
|
|
134
|
-
"node": ">=
|
|
141
|
+
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
|
|
135
142
|
}
|
|
136
143
|
}
|