ts-jest 24.0.0 → 24.2.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 +65 -20
- package/README.md +5 -1
- package/dist/cli/config/init.js +5 -5
- package/dist/cli/config/migrate.js +8 -11
- package/dist/cli/help.js +3 -3
- package/dist/cli/index.js +5 -7
- package/dist/compiler.js +22 -20
- package/dist/config/config-set.d.ts +23 -22
- package/dist/config/config-set.js +65 -35
- package/dist/config/create-jest-preset.js +3 -3
- package/dist/config/paths-to-module-name-mapper.js +8 -7
- package/dist/index.js +3 -3
- package/dist/transformers/hoist-jest.js +1 -1
- package/dist/transformers/index.js +1 -8
- package/dist/ts-jest-transformer.d.ts +1 -1
- package/dist/ts-jest-transformer.js +1 -1
- package/dist/types.d.ts +13 -1
- package/dist/util/backports.js +3 -3
- package/dist/util/testing.d.ts +16 -17
- package/dist/util/ts-error.js +1 -1
- package/package.json +11 -13
- package/.gitattributes +0 -2
- package/icon.png +0 -0
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
ad072c803aec84099b7756fe8e9cf274887d03bd
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
+
<a name="24.2.0"></a>
|
|
2
|
+
# [24.2.0](https://github.com/kulshekhar/ts-jest/compare/v24.1.0...v24.2.0) (2019-11-22)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **compiler:** pass filename to sha function instead of file extension ([ac1ac97](https://github.com/kulshekhar/ts-jest/commit/ac1ac97))
|
|
8
|
+
* **transformers:** hoist jest.enableAutomock and jest.disableAutomock ([ac50bc3](https://github.com/kulshekhar/ts-jest/commit/ac50bc3))
|
|
9
|
+
* typescript serviceHost cache miss on Windows operating systems ([26ee731](https://github.com/kulshekhar/ts-jest/commit/26ee731))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<a name="24.1.0"></a>
|
|
14
|
+
# [24.1.0](https://github.com/kulshekhar/ts-jest/compare/v24.0.2...v24.1.0) (2019-09-12)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **perf:** add cache for fs calls ([#908](https://github.com/kulshekhar/ts-jest/issues/908)) ([3dada81](https://github.com/kulshekhar/ts-jest/commit/3dada81))
|
|
20
|
+
* [#825](https://github.com/kulshekhar/ts-jest/issues/825) handle symlinked modules (ala pnpm) correctly ([e190b23](https://github.com/kulshekhar/ts-jest/commit/e190b23))
|
|
21
|
+
* handle tsBuildInfoFile option ([f9583e9](https://github.com/kulshekhar/ts-jest/commit/f9583e9)), closes [#1095](https://github.com/kulshekhar/ts-jest/issues/1095)
|
|
22
|
+
* **types:** unforce esModuleInterop in tsconfig.json ([c2d39b6](https://github.com/kulshekhar/ts-jest/commit/c2d39b6))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<a name="24.0.2"></a>
|
|
27
|
+
## [24.0.2](https://github.com/kulshekhar/ts-jest/compare/v24.0.1...v24.0.2) (2019-04-05)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
<a name="24.0.1"></a>
|
|
32
|
+
## [24.0.1](https://github.com/kulshekhar/ts-jest/compare/v24.0.0...v24.0.1) (2019-03-30)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* update call to globIgnore ([#1002](https://github.com/kulshekhar/ts-jest/issues/1002)) ([#1003](https://github.com/kulshekhar/ts-jest/issues/1003)) ([05b63af](https://github.com/kulshekhar/ts-jest/commit/05b63af))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
* **config:** specify package.json location ([#823](https://github.com/kulshekhar/ts-jest/issues/823)) ([#1013](https://github.com/kulshekhar/ts-jest/issues/1013)) ([fb7dd55](https://github.com/kulshekhar/ts-jest/commit/fb7dd55))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
1
46
|
<a name="24.0.0"></a>
|
|
2
47
|
# [24.0.0](https://github.com/kulshekhar/ts-jest/compare/v23.10.5...v24.0.0) (2019-02-18)
|
|
3
48
|
|
|
@@ -185,23 +230,23 @@
|
|
|
185
230
|
|
|
186
231
|
### Bug Fixes
|
|
187
232
|
|
|
188
|
-
* typos + node 6 compat ([0ed1587](https://github.com/kulshekhar/ts-jest/commit/0ed1587))
|
|
189
233
|
* **ci:** can't use runInBand for e2e: cache collision ([db650f4](https://github.com/kulshekhar/ts-jest/commit/db650f4))
|
|
190
|
-
* jest 22 did not have default config ([cbaddc3](https://github.com/kulshekhar/ts-jest/commit/cbaddc3))
|
|
191
234
|
* **ci:** do not run e2e sub-tests in band ([18ad865](https://github.com/kulshekhar/ts-jest/commit/18ad865))
|
|
192
235
|
* **ci:** ensure npm is present with ci ([edb6eda](https://github.com/kulshekhar/ts-jest/commit/edb6eda))
|
|
193
236
|
* **logger:** removes cyclic imports ([5ef980f](https://github.com/kulshekhar/ts-jest/commit/5ef980f))
|
|
194
237
|
* babel-config + adds test ([12146c3](https://github.com/kulshekhar/ts-jest/commit/12146c3))
|
|
195
|
-
* **tests:** CI fixes ([34a41ea](https://github.com/kulshekhar/ts-jest/commit/34a41ea))
|
|
196
238
|
* fixes js style to be node < 10 compatible ([83d7517](https://github.com/kulshekhar/ts-jest/commit/83d7517))
|
|
197
239
|
* hoisting per level + memoize fix ([31847b0](https://github.com/kulshekhar/ts-jest/commit/31847b0))
|
|
240
|
+
* jest 22 did not have default config ([cbaddc3](https://github.com/kulshekhar/ts-jest/commit/cbaddc3))
|
|
198
241
|
* makes node6 happy ([f170285](https://github.com/kulshekhar/ts-jest/commit/f170285))
|
|
199
242
|
* node 6 unhappy again... ([703ad0b](https://github.com/kulshekhar/ts-jest/commit/703ad0b))
|
|
200
243
|
* normalizes bundle hash on any node version ([ce7afaf](https://github.com/kulshekhar/ts-jest/commit/ce7afaf))
|
|
201
244
|
* source maps ([89a30c9](https://github.com/kulshekhar/ts-jest/commit/89a30c9))
|
|
245
|
+
* typos + node 6 compat ([0ed1587](https://github.com/kulshekhar/ts-jest/commit/0ed1587))
|
|
202
246
|
* updates templates ([f2e1da2](https://github.com/kulshekhar/ts-jest/commit/f2e1da2))
|
|
203
247
|
* uses cross-platform spawn + fix pkg versions ([ac1599c](https://github.com/kulshekhar/ts-jest/commit/ac1599c))
|
|
204
248
|
* we are not writing files, use normalized EOL ([47fff43](https://github.com/kulshekhar/ts-jest/commit/47fff43))
|
|
249
|
+
* **tests:** CI fixes ([34a41ea](https://github.com/kulshekhar/ts-jest/commit/34a41ea))
|
|
205
250
|
* **tests:** detect npm version to use or not ci ([683a1e5](https://github.com/kulshekhar/ts-jest/commit/683a1e5))
|
|
206
251
|
* **tests:** do not use babel in our tests + new API for simple ([3e4de3e](https://github.com/kulshekhar/ts-jest/commit/3e4de3e))
|
|
207
252
|
* **tests:** more sanitizing for windows compat ([faae274](https://github.com/kulshekhar/ts-jest/commit/faae274))
|
|
@@ -209,32 +254,32 @@
|
|
|
209
254
|
|
|
210
255
|
### Features
|
|
211
256
|
|
|
212
|
-
* diagnostics, different compilers, ... ([f26ebf0](https://github.com/kulshekhar/ts-jest/commit/f26ebf0))
|
|
213
257
|
* **config:** adds a helper to build moduleNameMapper from paths ([7b8598e](https://github.com/kulshekhar/ts-jest/commit/7b8598e)), closes [#364](https://github.com/kulshekhar/ts-jest/issues/364)
|
|
214
258
|
* **logging:** improves log messages + tests ([5d03c4d](https://github.com/kulshekhar/ts-jest/commit/5d03c4d))
|
|
215
|
-
* jest preset ([beb50b5](https://github.com/kulshekhar/ts-jest/commit/beb50b5))
|
|
216
|
-
* **test:** jest serializers ([dfa9c0f](https://github.com/kulshekhar/ts-jest/commit/dfa9c0f))
|
|
217
259
|
* adds logging + better hashing ([4322701](https://github.com/kulshekhar/ts-jest/commit/4322701))
|
|
218
|
-
* **tests:** more test tools + adds test related to debuggin issues ([8dcafca](https://github.com/kulshekhar/ts-jest/commit/8dcafca))
|
|
219
260
|
* allow env var to add diagnostic codes to ignore ([777edf5](https://github.com/kulshekhar/ts-jest/commit/777edf5))
|
|
220
261
|
* cache key + tests ([bd55448](https://github.com/kulshekhar/ts-jest/commit/bd55448))
|
|
262
|
+
* diagnostics, different compilers, ... ([f26ebf0](https://github.com/kulshekhar/ts-jest/commit/f26ebf0))
|
|
221
263
|
* directly writes to stdio so jest does not swallow ([6a7f01f](https://github.com/kulshekhar/ts-jest/commit/6a7f01f))
|
|
222
264
|
* handles stringifyContentPathRegex ([3fcb4bd](https://github.com/kulshekhar/ts-jest/commit/3fcb4bd))
|
|
223
265
|
* hoisting + tests + many other things ([6186e84](https://github.com/kulshekhar/ts-jest/commit/6186e84))
|
|
224
266
|
* io serializer + other test utils ([d03e0e7](https://github.com/kulshekhar/ts-jest/commit/d03e0e7))
|
|
267
|
+
* jest preset ([beb50b5](https://github.com/kulshekhar/ts-jest/commit/beb50b5))
|
|
225
268
|
* warn about unsupported versions ([1103071](https://github.com/kulshekhar/ts-jest/commit/1103071))
|
|
269
|
+
* **test:** jest serializers ([dfa9c0f](https://github.com/kulshekhar/ts-jest/commit/dfa9c0f))
|
|
270
|
+
* **tests:** more test tools + adds test related to debuggin issues ([8dcafca](https://github.com/kulshekhar/ts-jest/commit/8dcafca))
|
|
226
271
|
|
|
227
272
|
|
|
228
273
|
### Performance Improvements
|
|
229
274
|
|
|
230
|
-
* detects changes in templates and bundle ([2a3da21](https://github.com/kulshekhar/ts-jest/commit/2a3da21))
|
|
231
275
|
* **babel:** uses babel-jest cache key as part of ours ([f51c4a7](https://github.com/kulshekhar/ts-jest/commit/f51c4a7))
|
|
276
|
+
* **cache:** share config-sets for parallel test running ([090ca7b](https://github.com/kulshekhar/ts-jest/commit/090ca7b))
|
|
277
|
+
* **tests:** run e2e tests in band ([b3e94ff](https://github.com/kulshekhar/ts-jest/commit/b3e94ff))
|
|
278
|
+
* detects changes in templates and bundle ([2a3da21](https://github.com/kulshekhar/ts-jest/commit/2a3da21))
|
|
232
279
|
* do not type check if fileName doesn't match ([cc45adc](https://github.com/kulshekhar/ts-jest/commit/cc45adc))
|
|
233
280
|
* faster tests ([37a0187](https://github.com/kulshekhar/ts-jest/commit/37a0187))
|
|
234
281
|
* more cleaning ([c48f7b8](https://github.com/kulshekhar/ts-jest/commit/c48f7b8))
|
|
235
282
|
* trying to improve travis-ci conf ([e4b4d95](https://github.com/kulshekhar/ts-jest/commit/e4b4d95))
|
|
236
|
-
* **cache:** share config-sets for parallel test running ([090ca7b](https://github.com/kulshekhar/ts-jest/commit/090ca7b))
|
|
237
|
-
* **tests:** run e2e tests in band ([b3e94ff](https://github.com/kulshekhar/ts-jest/commit/b3e94ff))
|
|
238
283
|
|
|
239
284
|
|
|
240
285
|
|
|
@@ -244,12 +289,6 @@
|
|
|
244
289
|
|
|
245
290
|
### Bug Fixes
|
|
246
291
|
|
|
247
|
-
* **html:** correctly transforms html source when needed ([9a2d74f](https://github.com/kulshekhar/ts-jest/commit/9a2d74f))
|
|
248
|
-
* **lint:** fixes tslint script & lint issues ([60ab36e](https://github.com/kulshekhar/ts-jest/commit/60ab36e))
|
|
249
|
-
* **package:** update fs-extra to version 6.0.1 ([7e73536](https://github.com/kulshekhar/ts-jest/commit/7e73536))
|
|
250
|
-
* **package:** update pkg-dir to version 3.0.0 ([3fb8f9f](https://github.com/kulshekhar/ts-jest/commit/3fb8f9f))
|
|
251
|
-
* **package:** update yargs to version 12.0.1 ([390ffcd](https://github.com/kulshekhar/ts-jest/commit/390ffcd))
|
|
252
|
-
* **source-maps:** fix source maps options/calls ([76e27c1](https://github.com/kulshekhar/ts-jest/commit/76e27c1))
|
|
253
292
|
* allow (but deprecate) use of old preprocessor.js ([a65079f](https://github.com/kulshekhar/ts-jest/commit/a65079f))
|
|
254
293
|
* big refactor + fixes (mainly cache key + coverage) ([e46caae](https://github.com/kulshekhar/ts-jest/commit/e46caae))
|
|
255
294
|
* fixes coverage and tests ([09500c2](https://github.com/kulshekhar/ts-jest/commit/09500c2))
|
|
@@ -260,8 +299,14 @@
|
|
|
260
299
|
* npm coming with node 6 doesn't talk `ci` ([b87198d](https://github.com/kulshekhar/ts-jest/commit/b87198d))
|
|
261
300
|
* resolves correctly config file path (fix [#636](https://github.com/kulshekhar/ts-jest/issues/636)) ([5ab100c](https://github.com/kulshekhar/ts-jest/commit/5ab100c))
|
|
262
301
|
* test rootDir to handle preset-angular ([8a6a8f7](https://github.com/kulshekhar/ts-jest/commit/8a6a8f7))
|
|
263
|
-
* Typo in utils.ts ([#534](https://github.com/kulshekhar/ts-jest/issues/534)) ([a650260](https://github.com/kulshekhar/ts-jest/commit/a650260))
|
|
264
302
|
* wrong error message ([c955083](https://github.com/kulshekhar/ts-jest/commit/c955083))
|
|
303
|
+
* **html:** correctly transforms html source when needed ([9a2d74f](https://github.com/kulshekhar/ts-jest/commit/9a2d74f))
|
|
304
|
+
* **lint:** fixes tslint script & lint issues ([60ab36e](https://github.com/kulshekhar/ts-jest/commit/60ab36e))
|
|
305
|
+
* **package:** update fs-extra to version 6.0.1 ([7e73536](https://github.com/kulshekhar/ts-jest/commit/7e73536))
|
|
306
|
+
* **package:** update pkg-dir to version 3.0.0 ([3fb8f9f](https://github.com/kulshekhar/ts-jest/commit/3fb8f9f))
|
|
307
|
+
* **package:** update yargs to version 12.0.1 ([390ffcd](https://github.com/kulshekhar/ts-jest/commit/390ffcd))
|
|
308
|
+
* **source-maps:** fix source maps options/calls ([76e27c1](https://github.com/kulshekhar/ts-jest/commit/76e27c1))
|
|
309
|
+
* Typo in utils.ts ([#534](https://github.com/kulshekhar/ts-jest/issues/534)) ([a650260](https://github.com/kulshekhar/ts-jest/commit/a650260))
|
|
265
310
|
|
|
266
311
|
|
|
267
312
|
### Performance Improvements
|
|
@@ -283,9 +328,9 @@
|
|
|
283
328
|
### Bug Fixes
|
|
284
329
|
|
|
285
330
|
* **package:** update source-map-support to version 0.5.0 ([f0aab12](https://github.com/kulshekhar/ts-jest/commit/f0aab12))
|
|
286
|
-
* add startDir to if-clause ([eed5311](https://github.com/kulshekhar/ts-jest/commit/eed5311))
|
|
287
331
|
* **package:** update yargs to version 10.0.3 ([5cdf969](https://github.com/kulshekhar/ts-jest/commit/5cdf969))
|
|
288
332
|
* **package:** update yargs to version 11.0.0 ([7e9ce40](https://github.com/kulshekhar/ts-jest/commit/7e9ce40))
|
|
333
|
+
* add startDir to if-clause ([eed5311](https://github.com/kulshekhar/ts-jest/commit/eed5311))
|
|
289
334
|
* **package:** update yargs to version 9.0.1 ([#326](https://github.com/kulshekhar/ts-jest/issues/326)) ([8bf9924](https://github.com/kulshekhar/ts-jest/commit/8bf9924))
|
|
290
335
|
|
|
291
336
|
|
|
@@ -341,10 +386,10 @@
|
|
|
341
386
|
|
|
342
387
|
### Bug Fixes
|
|
343
388
|
|
|
344
|
-
* **package:** update fs-extra to version 3.0.0 ([906be12](https://github.com/kulshekhar/ts-jest/commit/906be12))
|
|
345
|
-
* **package:** update yargs to version 8.0.1 ([0b2ea98](https://github.com/kulshekhar/ts-jest/commit/0b2ea98))
|
|
346
389
|
* peer dependency against Typescript 2.x ([cb08128](https://github.com/kulshekhar/ts-jest/commit/cb08128))
|
|
347
390
|
* remove outDir when collecting coverage ([c076956](https://github.com/kulshekhar/ts-jest/commit/c076956))
|
|
391
|
+
* **package:** update fs-extra to version 3.0.0 ([906be12](https://github.com/kulshekhar/ts-jest/commit/906be12))
|
|
392
|
+
* **package:** update yargs to version 8.0.1 ([0b2ea98](https://github.com/kulshekhar/ts-jest/commit/0b2ea98))
|
|
348
393
|
|
|
349
394
|
|
|
350
395
|
### Features
|
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
|
|
|
46
46
|
|
|
47
47
|
## Versioning
|
|
48
48
|
|
|
49
|
-
We **DO NOT** use [SemVer](http://semver.org/) for versioning.
|
|
49
|
+
We **DO NOT** use [SemVer](http://semver.org/) for versioning. Though you can think about SemVer when reading our version, except our major number follows the one of Jest. For the versions available, see the [tags on this repository](https://github.com/kulshekhar/ts-jest/tags).
|
|
50
50
|
|
|
51
51
|
## Authors/maintainers
|
|
52
52
|
|
|
@@ -57,6 +57,10 @@ We **DO NOT** use [SemVer](http://semver.org/) for versioning. Tho you can think
|
|
|
57
57
|
|
|
58
58
|
See also the list of [contributors](https://github.com/kulshekhar/ts-jest/contributors) who participated in this project.
|
|
59
59
|
|
|
60
|
+
## Supporters
|
|
61
|
+
|
|
62
|
+
- [JetBrains](https://www.jetbrains.com/?from=ts-jest) has been kind enough to support ts-jest with an [open source license](https://www.jetbrains.com/community/opensource/?from=ts-jest).
|
|
63
|
+
|
|
60
64
|
## License
|
|
61
65
|
|
|
62
66
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
package/dist/cli/config/init.js
CHANGED
|
@@ -11,10 +11,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
16
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
17
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
19
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
20
|
});
|
|
20
21
|
};
|
|
@@ -45,13 +46,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
|
-
var _this = this;
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
var fs_1 = require("fs");
|
|
51
51
|
var json5_1 = require("json5");
|
|
52
52
|
var path_1 = require("path");
|
|
53
53
|
var presets_1 = require("../helpers/presets");
|
|
54
|
-
exports.run = function (args) { return __awaiter(
|
|
54
|
+
exports.run = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
55
|
var file, filePath, name, isPackage, exists, pkgFile, hasPackage, _a, jestPreset, askedTsconfig, force, jsdom, tsconfig, pkgJson, jsFilesProcessor, shouldPostProcessWithBabel, preset, body, base, tsJestConf, content;
|
|
56
56
|
return __generator(this, function (_b) {
|
|
57
57
|
file = args._[0] || 'jest.config.js';
|
|
@@ -110,7 +110,7 @@ exports.run = function (args) { return __awaiter(_this, void 0, void 0, function
|
|
|
110
110
|
if (shouldPostProcessWithBabel)
|
|
111
111
|
tsJestConf.babelConfig = true;
|
|
112
112
|
}
|
|
113
|
-
body = JSON.stringify(__assign({}, pkgJson, { jest: base }), undefined, ' ');
|
|
113
|
+
body = JSON.stringify(__assign(__assign({}, pkgJson), { jest: base }), undefined, ' ');
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
116
|
content = [];
|
|
@@ -144,7 +144,7 @@ exports.run = function (args) { return __awaiter(_this, void 0, void 0, function
|
|
|
144
144
|
return [2];
|
|
145
145
|
});
|
|
146
146
|
}); };
|
|
147
|
-
exports.help = function () { return __awaiter(
|
|
147
|
+
exports.help = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
148
148
|
return __generator(this, function (_a) {
|
|
149
149
|
process.stdout.write("\nUsage:\n ts-jest config:init [options] [<config-file>]\n\nArguments:\n <config-file> Can be a js or json Jest config file. If it is a\n package.json file, the configuration will be read from\n the \"jest\" property.\n Default: jest.config.js\n\nOptions:\n --force Discard any existing Jest config\n --js ts|babel Process .js files with ts-jest if 'ts' or with\n babel-jest if 'babel'\n --no-jest-preset Disable the use of Jest presets\n --tsconfig <file> Path to the tsconfig.json file\n --babel Pipe babel-jest after ts-jest\n --jsdom Use jsdom as test environment instead of node\n");
|
|
150
150
|
return [2];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
5
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
6
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
9
|
});
|
|
9
10
|
};
|
|
@@ -54,19 +55,15 @@ var __spread = (this && this.__spread) || function () {
|
|
|
54
55
|
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
55
56
|
return ar;
|
|
56
57
|
};
|
|
57
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
58
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
59
|
-
};
|
|
60
|
-
var _this = this;
|
|
61
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
59
|
var bs_logger_1 = require("bs-logger");
|
|
63
|
-
var
|
|
60
|
+
var stringifyJson = require("fast-json-stable-stringify");
|
|
64
61
|
var fs_1 = require("fs");
|
|
65
62
|
var json5_1 = require("json5");
|
|
66
63
|
var path_1 = require("path");
|
|
67
64
|
var backports_1 = require("../../util/backports");
|
|
68
65
|
var presets_1 = require("../helpers/presets");
|
|
69
|
-
exports.run = function (args) { return __awaiter(
|
|
66
|
+
exports.run = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
67
|
var nullLogger, file, filePath, footNotes, name, isPackage, actualConfig, migratedConfig, presetName, preset, jsTransformers, jsWithTs, jsWithBabel, presetValue, migratedValue, presetValue, migratedValue, before, after, stringify, prefix;
|
|
71
68
|
return __generator(this, function (_a) {
|
|
72
69
|
nullLogger = bs_logger_1.createLogger({ targets: [] });
|
|
@@ -158,13 +155,13 @@ exports.run = function (args) { return __awaiter(_this, void 0, void 0, function
|
|
|
158
155
|
}
|
|
159
156
|
if (preset &&
|
|
160
157
|
migratedConfig.transform &&
|
|
161
|
-
|
|
158
|
+
stringifyJson(migratedConfig.transform) === stringifyJson(preset.value.transform)) {
|
|
162
159
|
delete migratedConfig.transform;
|
|
163
160
|
}
|
|
164
161
|
cleanupConfig(actualConfig);
|
|
165
162
|
cleanupConfig(migratedConfig);
|
|
166
|
-
before =
|
|
167
|
-
after =
|
|
163
|
+
before = stringifyJson(actualConfig);
|
|
164
|
+
after = stringifyJson(migratedConfig);
|
|
168
165
|
if (after === before) {
|
|
169
166
|
process.stderr.write("\nNo migration needed for given Jest configuration\n ");
|
|
170
167
|
return [2];
|
|
@@ -212,7 +209,7 @@ function dedupSort(arr) {
|
|
|
212
209
|
.filter(function (s, i, a) { return a.findIndex(function (e) { return s.toString() === e.toString(); }) === i; })
|
|
213
210
|
.sort(function (a, b) { return (a.toString() > b.toString() ? 1 : a.toString() < b.toString() ? -1 : 0); });
|
|
214
211
|
}
|
|
215
|
-
exports.help = function () { return __awaiter(
|
|
212
|
+
exports.help = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
216
213
|
return __generator(this, function (_a) {
|
|
217
214
|
process.stdout.write("\nUsage:\n ts-jest config:migrate [options] <config-file>\n\nArguments:\n <config-file> Can be a js or json Jest config file. If it is a\n package.json file, the configuration will be read from\n the \"jest\" property.\n\nOptions:\n --js ts|babel Process .js files with ts-jest if 'ts' or with\n babel-jest if 'babel'\n --no-jest-preset Disable the use of Jest presets\n");
|
|
218
215
|
return [2];
|
package/dist/cli/help.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
5
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
6
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
9
|
});
|
|
9
10
|
};
|
|
@@ -34,9 +35,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
34
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
|
-
var _this = this;
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.run = function (_) { return __awaiter(
|
|
39
|
+
exports.run = function (_) { return __awaiter(void 0, void 0, void 0, function () {
|
|
40
40
|
return __generator(this, function (_a) {
|
|
41
41
|
process.stdout.write("\nUsage:\n ts-jest command [options] [...args]\n\nCommands:\n config:init Creates initial Jest configuration\n config:migrate Migrates a given Jest configuration\n help [command] Show this help, or help about a command\n\nExample:\n ts-jest help config:migrate\n");
|
|
42
42
|
return [2];
|
package/dist/cli/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
5
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
6
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
9
|
});
|
|
9
10
|
};
|
|
@@ -34,13 +35,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
34
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
-
};
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
38
|
var _a;
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
40
|
var bs_logger_1 = require("bs-logger");
|
|
43
|
-
var
|
|
41
|
+
var yargsParser = require("yargs-parser");
|
|
44
42
|
var logger_1 = require("../util/logger");
|
|
45
43
|
var VALID_COMMANDS = ['help', 'config:migrate', 'config:init'];
|
|
46
44
|
var logger = logger_1.rootLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'cli', _a[bs_logger_1.LogContexts.application] = 'ts-jest', _a));
|
|
@@ -48,7 +46,7 @@ function cli(args) {
|
|
|
48
46
|
return __awaiter(this, void 0, void 0, function () {
|
|
49
47
|
var parsedArgv, command, isHelp, _a, run, help, cmd;
|
|
50
48
|
return __generator(this, function (_b) {
|
|
51
|
-
parsedArgv =
|
|
49
|
+
parsedArgv = yargsParser(args, {
|
|
52
50
|
boolean: ['dry-run', 'jest-preset', 'allow-js', 'diff', 'babel', 'force', 'jsdom'],
|
|
53
51
|
string: ['tsconfig', 'js'],
|
|
54
52
|
count: ['verbose'],
|
package/dist/compiler.js
CHANGED
|
@@ -10,15 +10,16 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __values = (this && this.__values) || function
|
|
14
|
-
var
|
|
13
|
+
var __values = (this && this.__values) || function(o) {
|
|
14
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
15
|
if (m) return m.call(o);
|
|
16
|
-
return {
|
|
16
|
+
if (o && typeof o.length === "number") return {
|
|
17
17
|
next: function () {
|
|
18
18
|
if (o && i >= o.length) o = void 0;
|
|
19
19
|
return { value: o && o[i++], done: !o };
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
22
23
|
};
|
|
23
24
|
var __read = (this && this.__read) || function (o, n) {
|
|
24
25
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
@@ -36,14 +37,12 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
36
37
|
}
|
|
37
38
|
return ar;
|
|
38
39
|
};
|
|
39
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
40
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
|
-
};
|
|
42
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
41
|
var bs_logger_1 = require("bs-logger");
|
|
44
|
-
var
|
|
42
|
+
var bufferFrom = require("buffer-from");
|
|
45
43
|
var stableStringify = require("fast-json-stable-stringify");
|
|
46
44
|
var fs_1 = require("fs");
|
|
45
|
+
var memoize = require("lodash.memoize");
|
|
47
46
|
var mkdirp = require("mkdirp");
|
|
48
47
|
var path_1 = require("path");
|
|
49
48
|
var messages_1 = require("./util/messages");
|
|
@@ -112,30 +111,33 @@ function createCompiler(configs) {
|
|
|
112
111
|
_b.namespace = 'ts:serviceHost',
|
|
113
112
|
_b.call = null,
|
|
114
113
|
_b);
|
|
115
|
-
var serviceHostTraceCtx = __assign({}, serviceHostDebugCtx, (_c = {}, _c[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.trace, _c));
|
|
114
|
+
var serviceHostTraceCtx = __assign(__assign({}, serviceHostDebugCtx), (_c = {}, _c[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.trace, _c));
|
|
116
115
|
var serviceHost = {
|
|
117
116
|
getScriptFileNames: function () { return Object.keys(memoryCache.versions); },
|
|
118
117
|
getScriptVersion: function (fileName) {
|
|
119
|
-
var
|
|
118
|
+
var normalizedFileName = path_1.normalize(fileName);
|
|
119
|
+
var version = memoryCache.versions[normalizedFileName];
|
|
120
120
|
return version === undefined ? undefined : String(version);
|
|
121
121
|
},
|
|
122
122
|
getScriptSnapshot: function (fileName) {
|
|
123
|
-
var
|
|
124
|
-
|
|
123
|
+
var normalizedFileName = path_1.normalize(fileName);
|
|
124
|
+
var hit = hasOwn.call(memoryCache.contents, normalizedFileName);
|
|
125
|
+
logger.trace({ normalizedFileName: normalizedFileName, cacheHit: hit }, "getScriptSnapshot():", 'cache', hit ? 'hit' : 'miss');
|
|
125
126
|
if (!hit) {
|
|
126
|
-
memoryCache.contents[
|
|
127
|
+
memoryCache.contents[normalizedFileName] = ts.sys.readFile(normalizedFileName);
|
|
127
128
|
}
|
|
128
|
-
var contents = memoryCache.contents[
|
|
129
|
+
var contents = memoryCache.contents[normalizedFileName];
|
|
129
130
|
if (contents === undefined) {
|
|
130
131
|
return;
|
|
131
132
|
}
|
|
132
133
|
return ts.ScriptSnapshot.fromString(contents);
|
|
133
134
|
},
|
|
134
|
-
fileExists: ts.sys.fileExists,
|
|
135
|
-
readFile: logger.wrap(serviceHostTraceCtx, 'readFile', ts.sys.readFile),
|
|
136
|
-
readDirectory: ts.sys.readDirectory,
|
|
137
|
-
getDirectories: ts.sys.getDirectories,
|
|
138
|
-
directoryExists: ts.sys.directoryExists,
|
|
135
|
+
fileExists: memoize(ts.sys.fileExists),
|
|
136
|
+
readFile: logger.wrap(serviceHostTraceCtx, 'readFile', memoize(ts.sys.readFile)),
|
|
137
|
+
readDirectory: memoize(ts.sys.readDirectory),
|
|
138
|
+
getDirectories: memoize(ts.sys.getDirectories),
|
|
139
|
+
directoryExists: memoize(ts.sys.directoryExists),
|
|
140
|
+
realpath: memoize(ts.sys.realpath),
|
|
139
141
|
getNewLine: function () { return '\n'; },
|
|
140
142
|
getCurrentDirectory: function () { return cwd; },
|
|
141
143
|
getCompilationSettings: function () { return compilerOptions; },
|
|
@@ -213,7 +215,7 @@ function readThrough(cachedir, memoryCache, compile, getExtension, cwd, logger)
|
|
|
213
215
|
}
|
|
214
216
|
function updateOutput(outputText, fileName, sourceMap, getExtension, sourceRoot) {
|
|
215
217
|
var base = path_1.basename(fileName);
|
|
216
|
-
var base64Map =
|
|
218
|
+
var base64Map = bufferFrom(updateSourceMap(sourceMap, fileName, sourceRoot), 'utf8').toString('base64');
|
|
217
219
|
var sourceMapContent = "data:application/json;charset=utf-8;base64," + base64Map;
|
|
218
220
|
var sourceMapLength = (base + ".map").length + (getExtension(fileName).length - path_1.extname(fileName).length);
|
|
219
221
|
return outputText.slice(0, -sourceMapLength) + sourceMapContent;
|
|
@@ -226,7 +228,7 @@ function updateSourceMap(sourceMapText, fileName, _sourceRoot) {
|
|
|
226
228
|
return stableStringify(sourceMap);
|
|
227
229
|
}
|
|
228
230
|
function getCacheName(sourceCode, fileName) {
|
|
229
|
-
return sha1_1.sha1(
|
|
231
|
+
return sha1_1.sha1(fileName, '\x00', sourceCode);
|
|
230
232
|
}
|
|
231
233
|
function isValidCacheContent(contents) {
|
|
232
234
|
return /(?:9|0=|Q==)$/.test(contents.slice(-3));
|
|
@@ -4,28 +4,29 @@ import { CompilerOptions, CustomTransformers, ParsedCommandLine } from 'typescri
|
|
|
4
4
|
import { AstTransformerDesc, BabelConfig, BabelJestTransformer, TTypeScript, TsCompiler, TsJestConfig, TsJestGlobalOptions, TsJestHooksMap } from '../types';
|
|
5
5
|
export declare class ConfigSet {
|
|
6
6
|
readonly parentOptions?: TsJestGlobalOptions | undefined;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
7
|
+
get projectPackageJson(): Record<string, any>;
|
|
8
|
+
get projectDependencies(): Record<string, string>;
|
|
9
|
+
get jest(): jest.ProjectConfig;
|
|
10
|
+
get tsJest(): TsJestConfig;
|
|
11
|
+
get typescript(): ParsedCommandLine;
|
|
12
|
+
get tsconfig(): any;
|
|
13
|
+
get versions(): Record<string, string>;
|
|
14
|
+
private static loadConfig;
|
|
15
|
+
get babel(): BabelConfig | undefined;
|
|
16
|
+
get compilerModule(): TTypeScript;
|
|
17
|
+
get babelJestTransformer(): BabelJestTransformer | undefined;
|
|
18
|
+
get tsCompiler(): TsCompiler;
|
|
19
|
+
get astTransformers(): AstTransformerDesc[];
|
|
20
|
+
get tsCustomTransformers(): CustomTransformers;
|
|
21
|
+
get hooks(): TsJestHooksMap;
|
|
22
|
+
get shouldReportDiagnostic(): (filePath: string) => boolean;
|
|
23
|
+
get shouldStringifyContent(): (filePath: string) => boolean;
|
|
24
|
+
get tsCacheDir(): string | undefined;
|
|
25
|
+
get overriddenCompilerOptions(): Partial<CompilerOptions>;
|
|
26
|
+
get rootDir(): string;
|
|
27
|
+
get cwd(): string;
|
|
28
|
+
get tsJestDigest(): string;
|
|
29
|
+
get cacheKey(): string;
|
|
29
30
|
readonly logger: Logger;
|
|
30
31
|
constructor(jestConfig: jest.ProjectConfig, parentOptions?: TsJestGlobalOptions | undefined, parentLogger?: Logger);
|
|
31
32
|
resolvePath(inputPath: string, { throwIfMissing, nodeResolve }?: {
|
|
@@ -16,15 +16,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
16
16
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
17
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
18
|
};
|
|
19
|
-
var __values = (this && this.__values) || function
|
|
20
|
-
var
|
|
19
|
+
var __values = (this && this.__values) || function(o) {
|
|
20
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
21
21
|
if (m) return m.call(o);
|
|
22
|
-
return {
|
|
22
|
+
if (o && typeof o.length === "number") return {
|
|
23
23
|
next: function () {
|
|
24
24
|
if (o && i >= o.length) o = void 0;
|
|
25
25
|
return { value: o && o[i++], done: !o };
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
28
29
|
};
|
|
29
30
|
var __read = (this && this.__read) || function (o, n) {
|
|
30
31
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
@@ -46,15 +47,12 @@ var __spread = (this && this.__spread) || function () {
|
|
|
46
47
|
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
47
48
|
return ar;
|
|
48
49
|
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
51
|
var bs_logger_1 = require("bs-logger");
|
|
54
52
|
var fs_1 = require("fs");
|
|
55
|
-
var
|
|
53
|
+
var json5 = require("json5");
|
|
56
54
|
var path_1 = require("path");
|
|
57
|
-
var
|
|
55
|
+
var semver = require("semver");
|
|
58
56
|
var __1 = require("..");
|
|
59
57
|
var compiler_1 = require("../compiler");
|
|
60
58
|
var transformers_1 = require("../transformers");
|
|
@@ -88,8 +86,8 @@ var toDiagnosticCode = function (code) {
|
|
|
88
86
|
return code ? parseInt(("" + code).trim().replace(/^TS/, ''), 10) || undefined : undefined;
|
|
89
87
|
};
|
|
90
88
|
var toDiagnosticCodeList = function (items, into) {
|
|
91
|
-
if (into === void 0) { into = []; }
|
|
92
89
|
var e_1, _a;
|
|
90
|
+
if (into === void 0) { into = []; }
|
|
93
91
|
if (!Array.isArray(items))
|
|
94
92
|
items = [items];
|
|
95
93
|
try {
|
|
@@ -134,19 +132,31 @@ var ConfigSet = (function () {
|
|
|
134
132
|
}
|
|
135
133
|
Object.defineProperty(ConfigSet.prototype, "projectPackageJson", {
|
|
136
134
|
get: function () {
|
|
135
|
+
var packageJson = this.tsJest.packageJson;
|
|
136
|
+
if (packageJson && packageJson.kind === 'inline') {
|
|
137
|
+
return packageJson.value;
|
|
138
|
+
}
|
|
139
|
+
if (packageJson && packageJson.kind === 'file' && packageJson.value) {
|
|
140
|
+
var path = this.resolvePath(packageJson.value);
|
|
141
|
+
if (fs_1.existsSync(path)) {
|
|
142
|
+
return require(path);
|
|
143
|
+
}
|
|
144
|
+
this.logger.warn(messages_1.Errors.UnableToFindProjectRoot);
|
|
145
|
+
return {};
|
|
146
|
+
}
|
|
137
147
|
var tsJestRoot = path_1.resolve(__dirname, '..', '..');
|
|
138
148
|
var pkgPath = path_1.resolve(tsJestRoot, '..', '..', 'package.json');
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
this.logger.warn(messages_1.Errors.UnableToFindProjectRoot);
|
|
149
|
+
if (fs_1.existsSync(pkgPath)) {
|
|
150
|
+
return require(pkgPath);
|
|
151
|
+
}
|
|
152
|
+
if (fs_1.realpathSync(this.rootDir) === fs_1.realpathSync(tsJestRoot)) {
|
|
153
|
+
pkgPath = path_1.resolve(tsJestRoot, 'package.json');
|
|
154
|
+
if (fs_1.existsSync(pkgPath)) {
|
|
155
|
+
return require(pkgPath);
|
|
147
156
|
}
|
|
148
157
|
}
|
|
149
|
-
|
|
158
|
+
this.logger.warn(messages_1.Errors.UnableToFindProjectRoot);
|
|
159
|
+
return {};
|
|
150
160
|
},
|
|
151
161
|
enumerable: true,
|
|
152
162
|
configurable: true
|
|
@@ -154,7 +164,7 @@ var ConfigSet = (function () {
|
|
|
154
164
|
Object.defineProperty(ConfigSet.prototype, "projectDependencies", {
|
|
155
165
|
get: function () {
|
|
156
166
|
var pkg = this.projectPackageJson;
|
|
157
|
-
var names = Object.keys(__assign({}, pkg.optionalDependencies, pkg.peerDependencies, pkg.devDependencies, pkg.dependencies));
|
|
167
|
+
var names = Object.keys(__assign(__assign(__assign(__assign({}, pkg.optionalDependencies), pkg.peerDependencies), pkg.devDependencies), pkg.dependencies));
|
|
158
168
|
return names.reduce(function (map, name) {
|
|
159
169
|
var version = get_package_version_1.getPackageVersion(name);
|
|
160
170
|
if (version)
|
|
@@ -170,7 +180,7 @@ var ConfigSet = (function () {
|
|
|
170
180
|
var config = backports_1.backportJestConfig(this.logger, this._jestConfig);
|
|
171
181
|
if (this.parentOptions) {
|
|
172
182
|
var globals = config.globals || (config.globals = {});
|
|
173
|
-
globals['ts-jest'] = __assign({}, this.parentOptions, globals['ts-jest']);
|
|
183
|
+
globals['ts-jest'] = __assign(__assign({}, this.parentOptions), globals['ts-jest']);
|
|
174
184
|
}
|
|
175
185
|
this.logger.debug({ jestConfig: config }, 'normalized jest config');
|
|
176
186
|
return config;
|
|
@@ -198,6 +208,20 @@ var ConfigSet = (function () {
|
|
|
198
208
|
value: tsConfigOpt,
|
|
199
209
|
};
|
|
200
210
|
}
|
|
211
|
+
var packageJsonOpt = options.packageJson;
|
|
212
|
+
var packageJson;
|
|
213
|
+
if (typeof packageJsonOpt === 'string' || packageJsonOpt == null || packageJsonOpt === true) {
|
|
214
|
+
packageJson = {
|
|
215
|
+
kind: 'file',
|
|
216
|
+
value: typeof packageJsonOpt === 'string' ? this.resolvePath(packageJsonOpt) : undefined,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
else if (typeof packageJsonOpt === 'object') {
|
|
220
|
+
packageJson = {
|
|
221
|
+
kind: 'inline',
|
|
222
|
+
value: packageJsonOpt,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
201
225
|
var transformers = (options.astTransformers || []).map(function (mod) { return _this.resolvePath(mod, { nodeResolve: true }); });
|
|
202
226
|
var babelConfigOpt = options.babelConfig;
|
|
203
227
|
var babelConfig;
|
|
@@ -240,6 +264,7 @@ var ConfigSet = (function () {
|
|
|
240
264
|
var stringifyContentPathRegex = normalizeRegex(options.stringifyContentPathRegex);
|
|
241
265
|
var res = {
|
|
242
266
|
tsConfig: tsConfig,
|
|
267
|
+
packageJson: packageJson,
|
|
243
268
|
babelConfig: babelConfig,
|
|
244
269
|
diagnostics: diagnostics,
|
|
245
270
|
isolatedModules: !!options.isolatedModules,
|
|
@@ -313,6 +338,19 @@ var ConfigSet = (function () {
|
|
|
313
338
|
enumerable: true,
|
|
314
339
|
configurable: true
|
|
315
340
|
});
|
|
341
|
+
ConfigSet.loadConfig = function (base) {
|
|
342
|
+
var _a = importer_1.importer.babelCore(messages_1.ImportReasons.BabelJest), OptionManager = _a.OptionManager, loadPartialConfig = _a.loadPartialConfig, version = _a.version;
|
|
343
|
+
if (version && semver.satisfies(version, '>=6 <7')) {
|
|
344
|
+
delete base.cwd;
|
|
345
|
+
}
|
|
346
|
+
if (typeof loadPartialConfig === 'function') {
|
|
347
|
+
var partialConfig = loadPartialConfig(base);
|
|
348
|
+
if (partialConfig) {
|
|
349
|
+
return partialConfig.options;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return new OptionManager().init(base);
|
|
353
|
+
};
|
|
316
354
|
Object.defineProperty(ConfigSet.prototype, "babel", {
|
|
317
355
|
get: function () {
|
|
318
356
|
var babelConfig = this.tsJest.babelConfig;
|
|
@@ -323,23 +361,13 @@ var ConfigSet = (function () {
|
|
|
323
361
|
var base = { cwd: this.cwd };
|
|
324
362
|
if (babelConfig.kind === 'file') {
|
|
325
363
|
if (babelConfig.value) {
|
|
326
|
-
base = __assign({}, base,
|
|
364
|
+
base = __assign(__assign({}, base), json5.parse(fs_1.readFileSync(babelConfig.value, 'utf8')));
|
|
327
365
|
}
|
|
328
366
|
}
|
|
329
367
|
else if (babelConfig.kind === 'inline') {
|
|
330
|
-
base = __assign({}, base, babelConfig.value);
|
|
331
|
-
}
|
|
332
|
-
var _a = importer_1.importer.babelCore(messages_1.ImportReasons.BabelJest), OptionManager = _a.OptionManager, loadOptions = _a.loadOptions, version = _a.version;
|
|
333
|
-
if (version && semver_1.default.satisfies(version, '>=6 <7')) {
|
|
334
|
-
delete base.cwd;
|
|
335
|
-
}
|
|
336
|
-
var config;
|
|
337
|
-
if (typeof loadOptions === 'function') {
|
|
338
|
-
config = loadOptions(base);
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
config = new OptionManager().init(base);
|
|
368
|
+
base = __assign(__assign({}, base), babelConfig.value);
|
|
342
369
|
}
|
|
370
|
+
var config = ConfigSet.loadConfig(base);
|
|
343
371
|
this.logger.debug({ babelConfig: config }, 'normalized babel config');
|
|
344
372
|
return config;
|
|
345
373
|
},
|
|
@@ -504,7 +532,9 @@ var ConfigSet = (function () {
|
|
|
504
532
|
declarationDir: undefined,
|
|
505
533
|
declarationMap: undefined,
|
|
506
534
|
emitDeclarationOnly: undefined,
|
|
535
|
+
incremental: undefined,
|
|
507
536
|
sourceRoot: undefined,
|
|
537
|
+
tsBuildInfoFile: undefined,
|
|
508
538
|
};
|
|
509
539
|
if (!this.tsJest.babelConfig) {
|
|
510
540
|
options.module = this.compilerModule.ModuleKind.CommonJS;
|
|
@@ -605,11 +635,11 @@ var ConfigSet = (function () {
|
|
|
605
635
|
};
|
|
606
636
|
}
|
|
607
637
|
config = result_1.config;
|
|
608
|
-
input = __assign({}, result_1.config, { compilerOptions: __assign({}, (result_1.config && result_1.config.compilerOptions), compilerOptions) });
|
|
638
|
+
input = __assign(__assign({}, result_1.config), { compilerOptions: __assign(__assign({}, (result_1.config && result_1.config.compilerOptions)), compilerOptions) });
|
|
609
639
|
basePath = normalize_slashes_1.normalizeSlashes(path_1.dirname(configFileName));
|
|
610
640
|
}
|
|
611
641
|
}
|
|
612
|
-
config.compilerOptions = __assign({}, config.compilerOptions, compilerOptions);
|
|
642
|
+
config.compilerOptions = __assign(__assign({}, config.compilerOptions), compilerOptions);
|
|
613
643
|
var result = ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName);
|
|
614
644
|
var forcedOptions = this.overriddenCompilerOptions;
|
|
615
645
|
var finalOptions = result.options;
|
|
@@ -14,10 +14,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
var logger_1 = require("../util/logger");
|
|
15
15
|
var logger = logger_1.rootLogger.child({ namespace: 'jest-preset' });
|
|
16
16
|
function createJestPreset(_a, from) {
|
|
17
|
-
var _b
|
|
17
|
+
var _b;
|
|
18
|
+
var _c = (_a === void 0 ? {} : _a).allowJs, allowJs = _c === void 0 ? false : _c;
|
|
18
19
|
if (from === void 0) { from = {}; }
|
|
19
|
-
var _c;
|
|
20
20
|
logger.debug({ allowJs: allowJs }, 'creating jest presets', allowJs ? 'handling' : 'not handling', 'JavaScript files');
|
|
21
|
-
return __assign({ transform: __assign({}, from.transform, (
|
|
21
|
+
return __assign(__assign({ transform: __assign(__assign({}, from.transform), (_b = {}, _b[allowJs ? '^.+\\.[tj]sx?$' : '^.+\\.tsx?$'] = 'ts-jest', _b)) }, (from.testMatch ? { testMatch: from.testMatch } : undefined)), (from.moduleFileExtensions ? { moduleFileExtensions: from.moduleFileExtensions } : undefined));
|
|
22
22
|
}
|
|
23
23
|
exports.createJestPreset = createJestPreset;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __values = (this && this.__values) || function
|
|
3
|
-
var
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
4
|
if (m) return m.call(o);
|
|
5
|
-
return {
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
6
|
next: function () {
|
|
7
7
|
if (o && i >= o.length) o = void 0;
|
|
8
8
|
return { value: o && o[i++], done: !o };
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
12
|
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
var _a;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
15
|
var bs_logger_1 = require("bs-logger");
|
|
15
16
|
var logger_1 = require("../util/logger");
|
|
16
17
|
var messages_1 = require("../util/messages");
|
|
17
18
|
var escapeRegex = function (str) { return str.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); };
|
|
18
19
|
var logger = logger_1.rootLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'path-mapper', _a));
|
|
19
20
|
exports.pathsToModuleNameMapper = function (mapping, _a) {
|
|
20
|
-
var
|
|
21
|
-
var
|
|
21
|
+
var e_1, _b;
|
|
22
|
+
var _c = (_a === void 0 ? {} : _a).prefix, prefix = _c === void 0 ? '' : _c;
|
|
22
23
|
var jestMap = {};
|
|
23
24
|
try {
|
|
24
25
|
for (var _d = __values(Object.keys(mapping)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
@@ -54,7 +55,7 @@ exports.pathsToModuleNameMapper = function (mapping, _a) {
|
|
|
54
55
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
55
56
|
finally {
|
|
56
57
|
try {
|
|
57
|
-
if (_e && !_e.done && (
|
|
58
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
58
59
|
}
|
|
59
60
|
finally { if (e_1) throw e_1.error; }
|
|
60
61
|
}
|
package/dist/index.js
CHANGED
|
@@ -19,8 +19,8 @@ var __spread = (this && this.__spread) || function () {
|
|
|
19
19
|
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
20
20
|
return ar;
|
|
21
21
|
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
22
|
var _a;
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
var bs_logger_1 = require("bs-logger");
|
|
25
25
|
var fs_1 = require("fs");
|
|
26
26
|
var path_1 = require("path");
|
|
@@ -50,20 +50,20 @@ function createTransformer(baseConfig) {
|
|
|
50
50
|
}
|
|
51
51
|
exports.createTransformer = createTransformer;
|
|
52
52
|
function process() {
|
|
53
|
+
var _a;
|
|
53
54
|
var args = [];
|
|
54
55
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
55
56
|
args[_i] = arguments[_i];
|
|
56
57
|
}
|
|
57
|
-
var _a;
|
|
58
58
|
return (_a = defaultTransformer()).process.apply(_a, __spread(args));
|
|
59
59
|
}
|
|
60
60
|
exports.process = process;
|
|
61
61
|
function getCacheKey() {
|
|
62
|
+
var _a;
|
|
62
63
|
var args = [];
|
|
63
64
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
64
65
|
args[_i] = arguments[_i];
|
|
65
66
|
}
|
|
66
|
-
var _a;
|
|
67
67
|
return (_a = defaultTransformer()).getCacheKey.apply(_a, __spread(args));
|
|
68
68
|
}
|
|
69
69
|
exports.getCacheKey = getCacheKey;
|
|
@@ -21,7 +21,7 @@ var __spread = (this && this.__spread) || function () {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
var bs_logger_1 = require("bs-logger");
|
|
24
|
-
var HOIST_METHODS = ['mock', 'unmock'];
|
|
24
|
+
var HOIST_METHODS = ['mock', 'unmock', 'enableAutomock', 'disableAutomock'];
|
|
25
25
|
exports.name = 'hoisting-jest-mock';
|
|
26
26
|
exports.version = 1;
|
|
27
27
|
function factory(cs) {
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
-
if (mod && mod.__esModule) return mod;
|
|
4
|
-
var result = {};
|
|
5
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
-
result["default"] = mod;
|
|
7
|
-
return result;
|
|
8
|
-
};
|
|
9
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
var hoisting =
|
|
3
|
+
var hoisting = require("./hoist-jest");
|
|
11
4
|
exports.internals = [hoisting];
|
|
@@ -3,7 +3,7 @@ import { Logger } from 'bs-logger';
|
|
|
3
3
|
import { ConfigSet } from './config/config-set';
|
|
4
4
|
import { TsJestGlobalOptions } from './types';
|
|
5
5
|
export declare class TsJestTransformer implements jest.Transformer {
|
|
6
|
-
static
|
|
6
|
+
static get lastTransformerId(): number;
|
|
7
7
|
readonly logger: Logger;
|
|
8
8
|
readonly id: number;
|
|
9
9
|
readonly options: TsJestGlobalOptions;
|
|
@@ -107,7 +107,7 @@ var TsJestTransformer = (function () {
|
|
|
107
107
|
}
|
|
108
108
|
if (babelJest) {
|
|
109
109
|
this.logger.debug({ fileName: filePath }, 'calling babel-jest processor');
|
|
110
|
-
result = babelJest.process(result, filePath, jestConfig, __assign({}, transformOptions, { instrument: false }));
|
|
110
|
+
result = babelJest.process(result, filePath, jestConfig, __assign(__assign({}, transformOptions), { instrument: false }));
|
|
111
111
|
}
|
|
112
112
|
if (hooks.afterProcess) {
|
|
113
113
|
this.logger.debug({ fileName: filePath, hookName: 'afterProcess' }, 'calling afterProcess hook');
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
2
|
import * as _babel from 'babel__core';
|
|
3
|
-
import
|
|
3
|
+
import { CompilerOptions, SourceFile, TransformerFactory } from 'typescript';
|
|
4
|
+
import * as _ts from 'typescript';
|
|
4
5
|
import { ConfigSet } from './config/config-set';
|
|
5
6
|
export declare type TBabelCore = typeof _babel;
|
|
6
7
|
export declare type TTypeScript = typeof _ts;
|
|
@@ -11,6 +12,7 @@ export declare type BabelJestTransformer = {
|
|
|
11
12
|
export declare type BabelConfig = _babel.TransformOptions;
|
|
12
13
|
export interface TsJestGlobalOptions {
|
|
13
14
|
tsConfig?: boolean | string | CompilerOptions;
|
|
15
|
+
packageJson?: boolean | string | object;
|
|
14
16
|
isolatedModules?: boolean;
|
|
15
17
|
compiler?: string;
|
|
16
18
|
astTransformers?: string[];
|
|
@@ -47,9 +49,19 @@ interface TsJestConfig$babelConfig$inline {
|
|
|
47
49
|
value: BabelConfig;
|
|
48
50
|
}
|
|
49
51
|
declare type TsJestConfig$babelConfig = TsJestConfig$babelConfig$file | TsJestConfig$babelConfig$inline | undefined;
|
|
52
|
+
interface TsJestConfig$packageJson$file {
|
|
53
|
+
kind: 'file';
|
|
54
|
+
value: string | undefined;
|
|
55
|
+
}
|
|
56
|
+
interface TsJestConfig$packageJson$inline {
|
|
57
|
+
kind: 'inline';
|
|
58
|
+
value: any;
|
|
59
|
+
}
|
|
60
|
+
declare type TsJestConfig$packageJson = TsJestConfig$packageJson$file | TsJestConfig$packageJson$inline | undefined;
|
|
50
61
|
declare type TsJestConfig$stringifyContentPathRegex = string | undefined;
|
|
51
62
|
export interface TsJestConfig {
|
|
52
63
|
tsConfig: TsJestConfig$tsConfig;
|
|
64
|
+
packageJson: TsJestConfig$packageJson;
|
|
53
65
|
isolatedModules: boolean;
|
|
54
66
|
compiler: string;
|
|
55
67
|
diagnostics: TsJestConfig$diagnostics;
|
package/dist/util/backports.js
CHANGED
|
@@ -10,13 +10,13 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
13
|
var _a;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
var bs_logger_1 = require("bs-logger");
|
|
16
16
|
var messages_1 = require("./messages");
|
|
17
17
|
var context = (_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'backports', _a);
|
|
18
18
|
exports.backportJestConfig = function (logger, config) {
|
|
19
|
-
logger.debug(__assign({}, context, { config: config }), 'backporting config');
|
|
19
|
+
logger.debug(__assign(__assign({}, context), { config: config }), 'backporting config');
|
|
20
20
|
var _a = (config || {}).globals, globals = _a === void 0 ? {} : _a;
|
|
21
21
|
var _b = globals["ts-jest"], tsJest = _b === void 0 ? {} : _b;
|
|
22
22
|
var mergeTsJest = {};
|
|
@@ -84,7 +84,7 @@ exports.backportJestConfig = function (logger, config) {
|
|
|
84
84
|
if (hadWarnings) {
|
|
85
85
|
logger.warn(context, messages_1.Helps.MigrateConfigUsingCLI);
|
|
86
86
|
}
|
|
87
|
-
return __assign({}, config, { globals: __assign({}, globals, { 'ts-jest': __assign({}, mergeTsJest, tsJest) }) });
|
|
87
|
+
return __assign(__assign({}, config), { globals: __assign(__assign({}, globals), { 'ts-jest': __assign(__assign({}, mergeTsJest), tsJest) }) });
|
|
88
88
|
};
|
|
89
89
|
exports.backportTsJestDebugEnvVar = function (logger) {
|
|
90
90
|
if ('TS_JEST_DEBUG' in process.env) {
|
package/dist/util/testing.d.ts
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
|
-
|
|
3
|
-
new (...args: ArgumentsOf<T>): T;
|
|
4
|
-
(...args: ArgumentsOf<T>): any;
|
|
5
|
-
}
|
|
2
|
+
declare type MockableFunction = (...args: any[]) => any;
|
|
6
3
|
declare type MethodKeysOf<T> = {
|
|
7
|
-
[K in keyof T]: T[K] extends
|
|
4
|
+
[K in keyof T]: T[K] extends MockableFunction ? K : never;
|
|
8
5
|
}[keyof T];
|
|
9
6
|
declare type PropertyKeysOf<T> = {
|
|
10
|
-
[K in keyof T]: T[K] extends
|
|
7
|
+
[K in keyof T]: T[K] extends MockableFunction ? never : K;
|
|
11
8
|
}[keyof T];
|
|
12
9
|
declare type ArgumentsOf<T> = T extends (...args: infer A) => any ? A : never;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(...args:
|
|
10
|
+
declare type ConstructorArgumentsOf<T> = T extends new (...args: infer A) => any ? A : never;
|
|
11
|
+
interface MockWithArgs<T extends MockableFunction> extends jest.MockInstance<ReturnType<T>, ArgumentsOf<T>> {
|
|
12
|
+
new (...args: ConstructorArgumentsOf<T>): T;
|
|
13
|
+
(...args: ArgumentsOf<T>): ReturnType<T>;
|
|
16
14
|
}
|
|
17
|
-
declare type
|
|
15
|
+
declare type MaybeMockedConstructor<T> = T extends new (...args: any[]) => infer R ? jest.MockInstance<R, ConstructorArgumentsOf<T>> : {};
|
|
16
|
+
declare type MockedFunction<T extends MockableFunction> = MockWithArgs<T> & {
|
|
18
17
|
[K in keyof T]: T[K];
|
|
19
18
|
};
|
|
20
|
-
declare type MockedFunctionDeep<T> = MockWithArgs<T> & MockedObjectDeep<T>;
|
|
21
|
-
declare type MockedObject<T> = {
|
|
22
|
-
[K in MethodKeysOf<T>]: MockedFunction<T[K]
|
|
19
|
+
declare type MockedFunctionDeep<T extends MockableFunction> = MockWithArgs<T> & MockedObjectDeep<T>;
|
|
20
|
+
declare type MockedObject<T> = MaybeMockedConstructor<T> & {
|
|
21
|
+
[K in MethodKeysOf<T>]: T[K] extends MockableFunction ? MockedFunction<T[K]> : T[K];
|
|
23
22
|
} & {
|
|
24
23
|
[K in PropertyKeysOf<T>]: T[K];
|
|
25
24
|
};
|
|
26
|
-
declare type MockedObjectDeep<T> = {
|
|
27
|
-
[K in MethodKeysOf<T>]: MockedFunctionDeep<T[K]
|
|
25
|
+
declare type MockedObjectDeep<T> = MaybeMockedConstructor<T> & {
|
|
26
|
+
[K in MethodKeysOf<T>]: T[K] extends MockableFunction ? MockedFunctionDeep<T[K]> : T[K];
|
|
28
27
|
} & {
|
|
29
28
|
[K in PropertyKeysOf<T>]: MaybeMockedDeep<T[K]>;
|
|
30
29
|
};
|
|
31
|
-
export declare type MaybeMockedDeep<T> = T extends
|
|
32
|
-
export declare type MaybeMocked<T> = T extends
|
|
30
|
+
export declare type MaybeMockedDeep<T> = T extends MockableFunction ? MockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
|
|
31
|
+
export declare type MaybeMocked<T> = T extends MockableFunction ? MockedFunction<T> : T extends object ? MockedObject<T> : T;
|
|
33
32
|
export declare function mocked<T>(item: T, deep?: false): MaybeMocked<T>;
|
|
34
33
|
export declare function mocked<T>(item: T, deep: true): MaybeMockedDeep<T>;
|
|
35
34
|
export {};
|
package/dist/util/ts-error.js
CHANGED
|
@@ -5,7 +5,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
6
|
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
return function (d, b) {
|
|
10
10
|
extendStatics(d, b);
|
|
11
11
|
function __() { this.constructor = d; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-jest",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.2.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"bin": "cli.js",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"bs-logger": "0.x",
|
|
60
60
|
"buffer-from": "1.x",
|
|
61
61
|
"fast-json-stable-stringify": "2.x",
|
|
62
|
+
"lodash.memoize": "4.x",
|
|
62
63
|
"json5": "2.x",
|
|
63
64
|
"make-error": "1.x",
|
|
64
65
|
"mkdirp": "0.x",
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
}
|
|
78
79
|
},
|
|
79
80
|
"devDependencies": {
|
|
80
|
-
"@commitlint/cli": "
|
|
81
|
+
"@commitlint/cli": "8.x",
|
|
81
82
|
"@commitlint/config-conventional": "7.x",
|
|
82
83
|
"@types/babel__core": "7.x",
|
|
83
84
|
"@types/buffer-from": "latest",
|
|
@@ -103,7 +104,6 @@
|
|
|
103
104
|
"jest": "24.x",
|
|
104
105
|
"js-yaml": "latest",
|
|
105
106
|
"lint-staged": "latest",
|
|
106
|
-
"lodash.memoize": "4.x",
|
|
107
107
|
"lodash.merge": "4.x",
|
|
108
108
|
"lodash.set": "4.x",
|
|
109
109
|
"npm-run-all": "latest",
|
|
@@ -115,16 +115,14 @@
|
|
|
115
115
|
"typescript": "3.x"
|
|
116
116
|
},
|
|
117
117
|
"lint-staged": {
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
]
|
|
127
|
-
}
|
|
118
|
+
"*.{ts,tsx}": [
|
|
119
|
+
"tslint --fix",
|
|
120
|
+
"git add"
|
|
121
|
+
],
|
|
122
|
+
"*.{js,jsx}": [
|
|
123
|
+
"eslint --fix",
|
|
124
|
+
"git add"
|
|
125
|
+
]
|
|
128
126
|
},
|
|
129
127
|
"engines": {
|
|
130
128
|
"node": ">= 6"
|
package/.gitattributes
DELETED
package/icon.png
DELETED
|
Binary file
|