ts-jest 24.1.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 CHANGED
@@ -1 +1 @@
1
- 7145adc485d1d0fa5bc7b6467bd416798f0a9a49
1
+ ad072c803aec84099b7756fe8e9cf274887d03bd
package/CHANGELOG.md CHANGED
@@ -1,12 +1,24 @@
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
+
1
13
  <a name="24.1.0"></a>
2
14
  # [24.1.0](https://github.com/kulshekhar/ts-jest/compare/v24.0.2...v24.1.0) (2019-09-12)
3
15
 
4
16
 
5
17
  ### Bug Fixes
6
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))
7
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))
8
21
  * handle tsBuildInfoFile option ([f9583e9](https://github.com/kulshekhar/ts-jest/commit/f9583e9)), closes [#1095](https://github.com/kulshekhar/ts-jest/issues/1095)
9
- * **perf:** add cache for fs calls ([#908](https://github.com/kulshekhar/ts-jest/issues/908)) ([3dada81](https://github.com/kulshekhar/ts-jest/commit/3dada81))
10
22
  * **types:** unforce esModuleInterop in tsconfig.json ([c2d39b6](https://github.com/kulshekhar/ts-jest/commit/c2d39b6))
11
23
 
12
24
 
@@ -218,23 +230,23 @@
218
230
 
219
231
  ### Bug Fixes
220
232
 
221
- * typos + node 6 compat ([0ed1587](https://github.com/kulshekhar/ts-jest/commit/0ed1587))
222
233
  * **ci:** can't use runInBand for e2e: cache collision ([db650f4](https://github.com/kulshekhar/ts-jest/commit/db650f4))
223
- * jest 22 did not have default config ([cbaddc3](https://github.com/kulshekhar/ts-jest/commit/cbaddc3))
224
234
  * **ci:** do not run e2e sub-tests in band ([18ad865](https://github.com/kulshekhar/ts-jest/commit/18ad865))
225
235
  * **ci:** ensure npm is present with ci ([edb6eda](https://github.com/kulshekhar/ts-jest/commit/edb6eda))
226
236
  * **logger:** removes cyclic imports ([5ef980f](https://github.com/kulshekhar/ts-jest/commit/5ef980f))
227
237
  * babel-config + adds test ([12146c3](https://github.com/kulshekhar/ts-jest/commit/12146c3))
228
- * **tests:** CI fixes ([34a41ea](https://github.com/kulshekhar/ts-jest/commit/34a41ea))
229
238
  * fixes js style to be node < 10 compatible ([83d7517](https://github.com/kulshekhar/ts-jest/commit/83d7517))
230
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))
231
241
  * makes node6 happy ([f170285](https://github.com/kulshekhar/ts-jest/commit/f170285))
232
242
  * node 6 unhappy again... ([703ad0b](https://github.com/kulshekhar/ts-jest/commit/703ad0b))
233
243
  * normalizes bundle hash on any node version ([ce7afaf](https://github.com/kulshekhar/ts-jest/commit/ce7afaf))
234
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))
235
246
  * updates templates ([f2e1da2](https://github.com/kulshekhar/ts-jest/commit/f2e1da2))
236
247
  * uses cross-platform spawn + fix pkg versions ([ac1599c](https://github.com/kulshekhar/ts-jest/commit/ac1599c))
237
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))
238
250
  * **tests:** detect npm version to use or not ci ([683a1e5](https://github.com/kulshekhar/ts-jest/commit/683a1e5))
239
251
  * **tests:** do not use babel in our tests + new API for simple ([3e4de3e](https://github.com/kulshekhar/ts-jest/commit/3e4de3e))
240
252
  * **tests:** more sanitizing for windows compat ([faae274](https://github.com/kulshekhar/ts-jest/commit/faae274))
@@ -242,32 +254,32 @@
242
254
 
243
255
  ### Features
244
256
 
245
- * diagnostics, different compilers, ... ([f26ebf0](https://github.com/kulshekhar/ts-jest/commit/f26ebf0))
246
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)
247
258
  * **logging:** improves log messages + tests ([5d03c4d](https://github.com/kulshekhar/ts-jest/commit/5d03c4d))
248
- * jest preset ([beb50b5](https://github.com/kulshekhar/ts-jest/commit/beb50b5))
249
- * **test:** jest serializers ([dfa9c0f](https://github.com/kulshekhar/ts-jest/commit/dfa9c0f))
250
259
  * adds logging + better hashing ([4322701](https://github.com/kulshekhar/ts-jest/commit/4322701))
251
- * **tests:** more test tools + adds test related to debuggin issues ([8dcafca](https://github.com/kulshekhar/ts-jest/commit/8dcafca))
252
260
  * allow env var to add diagnostic codes to ignore ([777edf5](https://github.com/kulshekhar/ts-jest/commit/777edf5))
253
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))
254
263
  * directly writes to stdio so jest does not swallow ([6a7f01f](https://github.com/kulshekhar/ts-jest/commit/6a7f01f))
255
264
  * handles stringifyContentPathRegex ([3fcb4bd](https://github.com/kulshekhar/ts-jest/commit/3fcb4bd))
256
265
  * hoisting + tests + many other things ([6186e84](https://github.com/kulshekhar/ts-jest/commit/6186e84))
257
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))
258
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))
259
271
 
260
272
 
261
273
  ### Performance Improvements
262
274
 
263
- * detects changes in templates and bundle ([2a3da21](https://github.com/kulshekhar/ts-jest/commit/2a3da21))
264
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))
265
279
  * do not type check if fileName doesn't match ([cc45adc](https://github.com/kulshekhar/ts-jest/commit/cc45adc))
266
280
  * faster tests ([37a0187](https://github.com/kulshekhar/ts-jest/commit/37a0187))
267
281
  * more cleaning ([c48f7b8](https://github.com/kulshekhar/ts-jest/commit/c48f7b8))
268
282
  * trying to improve travis-ci conf ([e4b4d95](https://github.com/kulshekhar/ts-jest/commit/e4b4d95))
269
- * **cache:** share config-sets for parallel test running ([090ca7b](https://github.com/kulshekhar/ts-jest/commit/090ca7b))
270
- * **tests:** run e2e tests in band ([b3e94ff](https://github.com/kulshekhar/ts-jest/commit/b3e94ff))
271
283
 
272
284
 
273
285
 
@@ -277,12 +289,6 @@
277
289
 
278
290
  ### Bug Fixes
279
291
 
280
- * **html:** correctly transforms html source when needed ([9a2d74f](https://github.com/kulshekhar/ts-jest/commit/9a2d74f))
281
- * **lint:** fixes tslint script & lint issues ([60ab36e](https://github.com/kulshekhar/ts-jest/commit/60ab36e))
282
- * **package:** update fs-extra to version 6.0.1 ([7e73536](https://github.com/kulshekhar/ts-jest/commit/7e73536))
283
- * **package:** update pkg-dir to version 3.0.0 ([3fb8f9f](https://github.com/kulshekhar/ts-jest/commit/3fb8f9f))
284
- * **package:** update yargs to version 12.0.1 ([390ffcd](https://github.com/kulshekhar/ts-jest/commit/390ffcd))
285
- * **source-maps:** fix source maps options/calls ([76e27c1](https://github.com/kulshekhar/ts-jest/commit/76e27c1))
286
292
  * allow (but deprecate) use of old preprocessor.js ([a65079f](https://github.com/kulshekhar/ts-jest/commit/a65079f))
287
293
  * big refactor + fixes (mainly cache key + coverage) ([e46caae](https://github.com/kulshekhar/ts-jest/commit/e46caae))
288
294
  * fixes coverage and tests ([09500c2](https://github.com/kulshekhar/ts-jest/commit/09500c2))
@@ -293,8 +299,14 @@
293
299
  * npm coming with node 6 doesn't talk `ci` ([b87198d](https://github.com/kulshekhar/ts-jest/commit/b87198d))
294
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))
295
301
  * test rootDir to handle preset-angular ([8a6a8f7](https://github.com/kulshekhar/ts-jest/commit/8a6a8f7))
296
- * Typo in utils.ts ([#534](https://github.com/kulshekhar/ts-jest/issues/534)) ([a650260](https://github.com/kulshekhar/ts-jest/commit/a650260))
297
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))
298
310
 
299
311
 
300
312
  ### Performance Improvements
@@ -316,9 +328,9 @@
316
328
  ### Bug Fixes
317
329
 
318
330
  * **package:** update source-map-support to version 0.5.0 ([f0aab12](https://github.com/kulshekhar/ts-jest/commit/f0aab12))
319
- * add startDir to if-clause ([eed5311](https://github.com/kulshekhar/ts-jest/commit/eed5311))
320
331
  * **package:** update yargs to version 10.0.3 ([5cdf969](https://github.com/kulshekhar/ts-jest/commit/5cdf969))
321
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))
322
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))
323
335
 
324
336
 
@@ -374,10 +386,10 @@
374
386
 
375
387
  ### Bug Fixes
376
388
 
377
- * **package:** update fs-extra to version 3.0.0 ([906be12](https://github.com/kulshekhar/ts-jest/commit/906be12))
378
- * **package:** update yargs to version 8.0.1 ([0b2ea98](https://github.com/kulshekhar/ts-jest/commit/0b2ea98))
379
389
  * peer dependency against Typescript 2.x ([cb08128](https://github.com/kulshekhar/ts-jest/commit/cb08128))
380
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))
381
393
 
382
394
 
383
395
  ### Features
package/README.md CHANGED
@@ -57,6 +57,10 @@ We **DO NOT** use [SemVer](http://semver.org/) for versioning. Though you can th
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/compiler.js CHANGED
@@ -115,16 +115,18 @@ function createCompiler(configs) {
115
115
  var serviceHost = {
116
116
  getScriptFileNames: function () { return Object.keys(memoryCache.versions); },
117
117
  getScriptVersion: function (fileName) {
118
- var version = memoryCache.versions[fileName];
118
+ var normalizedFileName = path_1.normalize(fileName);
119
+ var version = memoryCache.versions[normalizedFileName];
119
120
  return version === undefined ? undefined : String(version);
120
121
  },
121
122
  getScriptSnapshot: function (fileName) {
122
- var hit = hasOwn.call(memoryCache.contents, fileName);
123
- logger.trace({ fileName: fileName, cacheHit: hit }, "getScriptSnapshot():", 'cache', hit ? 'hit' : 'miss');
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');
124
126
  if (!hit) {
125
- memoryCache.contents[fileName] = ts.sys.readFile(fileName);
127
+ memoryCache.contents[normalizedFileName] = ts.sys.readFile(normalizedFileName);
126
128
  }
127
- var contents = memoryCache.contents[fileName];
129
+ var contents = memoryCache.contents[normalizedFileName];
128
130
  if (contents === undefined) {
129
131
  return;
130
132
  }
@@ -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(path_1.extname(fileName), '\x00', sourceCode);
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,29 +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
- readonly projectPackageJson: Record<string, any>;
8
- readonly projectDependencies: Record<string, string>;
9
- readonly jest: jest.ProjectConfig;
10
- readonly tsJest: TsJestConfig;
11
- readonly typescript: ParsedCommandLine;
12
- readonly tsconfig: any;
13
- readonly versions: Record<string, string>;
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
14
  private static loadConfig;
15
- readonly babel: BabelConfig | undefined;
16
- readonly compilerModule: TTypeScript;
17
- readonly babelJestTransformer: BabelJestTransformer | undefined;
18
- readonly tsCompiler: TsCompiler;
19
- readonly astTransformers: AstTransformerDesc[];
20
- readonly tsCustomTransformers: CustomTransformers;
21
- readonly hooks: TsJestHooksMap;
22
- readonly shouldReportDiagnostic: (filePath: string) => boolean;
23
- readonly shouldStringifyContent: (filePath: string) => boolean;
24
- readonly tsCacheDir: string | undefined;
25
- readonly overriddenCompilerOptions: Partial<CompilerOptions>;
26
- readonly rootDir: string;
27
- readonly cwd: string;
28
- readonly tsJestDigest: string;
29
- readonly cacheKey: string;
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;
30
30
  readonly logger: Logger;
31
31
  constructor(jestConfig: jest.ProjectConfig, parentOptions?: TsJestGlobalOptions | undefined, parentLogger?: Logger);
32
32
  resolvePath(inputPath: string, { throwIfMissing, nodeResolve }?: {
@@ -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) {
@@ -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 readonly lastTransformerId: number;
6
+ static get lastTransformerId(): number;
7
7
  readonly logger: Logger;
8
8
  readonly id: number;
9
9
  readonly options: TsJestGlobalOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "24.1.0",
3
+ "version": "24.2.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": "cli.js",