ts-jest 27.1.2 → 27.1.5

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
- bd2f45610719730fefd953f7489229846114d0d5
1
+ cb2019d45794942b3c8d9420b1587f678d6e2014
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## [27.1.4](https://github.com/kulshekhar/ts-jest/compare/v27.1.3...v27.1.4) (2022-03-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **transformers** use `Array.sort` in hoisting transformer ([#3498](https://github.com/kulshekhar/ts-jest/pull/3498)) ([e400a6e](https://github.com/kulshekhar/ts-jest/commit/e400a6ec0e4706f606ae9b1e2897b0bb1cff6343)), fixes [#3476](https://github.com/kulshekhar/ts-jest/issues/3476)
7
+
8
+
9
+
10
+ ## [27.1.4](https://github.com/kulshekhar/ts-jest/compare/v27.1.3...v27.1.4) (2022-03-24)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **compiler:** revert [#3194](https://github.com/kulshekhar/ts-jest/issues/3194) ([#3362](https://github.com/kulshekhar/ts-jest/issues/3362)) ([2b7dffe](https://github.com/kulshekhar/ts-jest/commit/2b7dffeac940f779922c43cefba3f741a3911b49)), closes [#3272](https://github.com/kulshekhar/ts-jest/issues/3272)
16
+ * remove `esbuild` from peer dependency ([#3360](https://github.com/kulshekhar/ts-jest/issues/3360)) ([8c8c1ca](https://github.com/kulshekhar/ts-jest/commit/8c8c1ca615b1edeedc9f4282557c28e82acee543)), closes [#3346](https://github.com/kulshekhar/ts-jest/issues/3346)
17
+ * support Babel config file with `.cjs` extension ([#3361](https://github.com/kulshekhar/ts-jest/issues/3361)) ([5e5ac4a](https://github.com/kulshekhar/ts-jest/commit/5e5ac4ac286bdcce157d0bdc31f3a57202fdbdfe)), closes [#3335](https://github.com/kulshekhar/ts-jest/issues/3335)
18
+
19
+
20
+
21
+ ## [27.1.3](https://github.com/kulshekhar/ts-jest/compare/v27.1.2...v27.1.3) (2022-01-14)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * **compiler:** update memory cache for compiler using received file content ([#3194](https://github.com/kulshekhar/ts-jest/issues/3194)) ([e4d9541](https://github.com/kulshekhar/ts-jest/commit/e4d9541f262ca14cb25563c757c0f2345dbf5c51))
27
+
28
+
29
+
1
30
  ## [27.1.2](https://github.com/kulshekhar/ts-jest/compare/v27.1.1...v27.1.2) (2021-12-15)
2
31
 
3
32
 
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -181,7 +181,8 @@ var ConfigSet = (function () {
181
181
  var baseBabelCfg = { cwd: this.cwd };
182
182
  if (typeof options.babelConfig === 'string') {
183
183
  var babelCfgPath = this.resolvePath(options.babelConfig);
184
- if ((0, path_1.extname)(options.babelConfig) === '.js') {
184
+ var babelFileExtName = (0, path_1.extname)(options.babelConfig);
185
+ if (babelFileExtName === '.js' || babelFileExtName === '.cjs') {
185
186
  this.babelConfig = __assign(__assign({}, baseBabelCfg), require(babelCfgPath));
186
187
  }
187
188
  else {
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,5 +1,5 @@
1
1
  import type _ts from 'typescript';
2
2
  import type { TsCompilerInstance } from '../types';
3
- export declare const version = 3;
3
+ export declare const version = 4;
4
4
  export declare const name = "hoist-jest";
5
5
  export declare function factory({ configSet }: TsCompilerInstance): (ctx: _ts.TransformationContext) => _ts.Transformer<_ts.SourceFile>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.factory = exports.name = exports.version = void 0;
4
4
  var bs_logger_1 = require("bs-logger");
5
- exports.version = 3;
5
+ exports.version = 4;
6
6
  exports.name = 'hoist-jest';
7
7
  var HOIST_METHODS = ['mock', 'unmock', 'enableAutomock', 'disableAutomock', 'deepUnmock'];
8
8
  var JEST_GLOBALS_MODULE_NAME = '@jest/globals';
@@ -51,21 +51,12 @@ function factory(_a) {
51
51
  if (statements.length <= 1) {
52
52
  return statements;
53
53
  }
54
- var pivot = statements[0];
55
- var leftPart = [];
56
- var rightPart = [];
57
- for (var i = 1; i < statements.length; i++) {
58
- var currentStatement = statements[i];
59
- if (isJestGlobalImport(currentStatement)) {
60
- leftPart.push(currentStatement);
61
- }
62
- else {
63
- isHoistableStatement(currentStatement) && !isHoistableStatement(pivot) && !isJestGlobalImport(pivot)
64
- ? leftPart.push(currentStatement)
65
- : rightPart.push(currentStatement);
66
- }
67
- }
68
- return sortStatements(leftPart).concat(pivot, sortStatements(rightPart));
54
+ return statements.sort(function (stmtA, stmtB) {
55
+ return isJestGlobalImport(stmtA) ||
56
+ (isHoistableStatement(stmtA) && !isHoistableStatement(stmtB) && !isJestGlobalImport(stmtB))
57
+ ? -1
58
+ : 1;
59
+ });
69
60
  };
70
61
  var createVisitor = function (ctx, _) {
71
62
  var visitor = function (node) {
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "27.1.2",
3
+ "version": "27.1.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": {
@@ -14,13 +14,13 @@
14
14
  "pretest": "tsc -p tsconfig.spec.json --noEmit && node scripts/prepare-test.js",
15
15
  "test": "jest",
16
16
  "test-examples": "node scripts/test-examples.js",
17
- "lint": "node_modules/.bin/eslint --ext .js,.ts .",
18
- "lint-fix": "node_modules/.bin/eslint --fix --ext .js,.ts .",
17
+ "lint": "eslint --ext .js,.ts .",
18
+ "lint-fix": "eslint --fix --ext .js,.ts .",
19
19
  "lint-prettier": "prettier '**/*.{yml,yaml,md}' --write",
20
20
  "lint-prettier-ci": "prettier '**/*.{yml,yaml,md}' --check",
21
21
  "doc": "cd website && npm run start",
22
22
  "doc:build": "cd website && npm run build",
23
- "changelog": "node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
23
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
24
24
  "prepare": "npm run build",
25
25
  "prepublishOnly": "npm run test",
26
26
  "preversion": "npm run test",
@@ -64,7 +64,6 @@
64
64
  "@babel/core": ">=7.0.0-beta.0 <8",
65
65
  "@types/jest": "^27.0.0",
66
66
  "babel-jest": ">=27.0.0 <28",
67
- "esbuild": "~0.14.0",
68
67
  "jest": "^27.0.0",
69
68
  "typescript": ">=3.8 <5.0"
70
69
  },
@@ -90,8 +89,8 @@
90
89
  }
91
90
  },
92
91
  "devDependencies": {
93
- "@commitlint/cli": "15.x",
94
- "@commitlint/config-angular": "^15.0.0",
92
+ "@commitlint/cli": "16.x",
93
+ "@commitlint/config-angular": "^16.0.0",
95
94
  "@jest/transform": "^27.4.2",
96
95
  "@jest/types": "^27.4.2",
97
96
  "@types/babel__core": "7.x",
@@ -103,7 +102,7 @@
103
102
  "@types/lodash.memoize": "4.x",
104
103
  "@types/lodash.set": "4.x",
105
104
  "@types/micromatch": "4.x",
106
- "@types/node": "16.11.13",
105
+ "@types/node": "17.0.21",
107
106
  "@types/node-fetch": "^3.0.3",
108
107
  "@types/react": "17.x",
109
108
  "@types/rimraf": "^3.0.2",
@@ -136,7 +135,7 @@
136
135
  "lodash.set": "^4.3.2",
137
136
  "node-fetch": "^3.0.0",
138
137
  "prettier": "^2.4.0",
139
- "typescript": "~4.5.2"
138
+ "typescript": "~4.6.2"
140
139
  },
141
140
  "lint-staged": {
142
141
  "*.{ts,tsx,js,jsx}": [