ts-jest 29.3.2 → 29.3.4

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.
@@ -1,36 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JsonableValue = void 0;
4
- var json_1 = require("./json");
4
+ const json_1 = require("./json");
5
5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- var JsonableValue = /** @class */ (function () {
7
- function JsonableValue(value) {
6
+ class JsonableValue {
7
+ _serialized;
8
+ _value;
9
+ constructor(value) {
8
10
  this.value = value;
9
11
  }
10
- Object.defineProperty(JsonableValue.prototype, "value", {
11
- get: function () {
12
- return this._value;
13
- },
14
- set: function (value) {
15
- this._value = value;
16
- this._serialized = (0, json_1.stringify)(value);
17
- },
18
- enumerable: false,
19
- configurable: true
20
- });
21
- Object.defineProperty(JsonableValue.prototype, "serialized", {
22
- get: function () {
23
- return this._serialized;
24
- },
25
- enumerable: false,
26
- configurable: true
27
- });
28
- JsonableValue.prototype.valueOf = function () {
12
+ set value(value) {
13
+ this._value = value;
14
+ this._serialized = (0, json_1.stringify)(value);
15
+ }
16
+ get value() {
29
17
  return this._value;
30
- };
31
- JsonableValue.prototype.toString = function () {
18
+ }
19
+ get serialized() {
32
20
  return this._serialized;
33
- };
34
- return JsonableValue;
35
- }());
21
+ }
22
+ valueOf() {
23
+ return this._value;
24
+ }
25
+ toString() {
26
+ return this._serialized;
27
+ }
28
+ }
36
29
  exports.JsonableValue = JsonableValue;
@@ -1,21 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rootLogger = void 0;
4
- var bs_logger_1 = require("bs-logger");
5
- var backports_1 = require("./backports");
6
- var original = process.env.TS_JEST_LOG;
7
- var buildOptions = function () {
8
- var _a;
9
- var _b;
10
- return ({
11
- context: (_a = {},
12
- _a[bs_logger_1.LogContexts.package] = 'ts-jest',
13
- _a[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.trace,
14
- _a.version = require('../../package.json').version,
15
- _a),
16
- targets: (_b = process.env.TS_JEST_LOG) !== null && _b !== void 0 ? _b : undefined,
17
- });
18
- };
4
+ const bs_logger_1 = require("bs-logger");
5
+ const backports_1 = require("./backports");
6
+ const original = process.env.TS_JEST_LOG;
7
+ const buildOptions = () => ({
8
+ context: {
9
+ [bs_logger_1.LogContexts.package]: 'ts-jest',
10
+ [bs_logger_1.LogContexts.logLevel]: bs_logger_1.LogLevels.trace,
11
+ version: require('../../package.json').version,
12
+ },
13
+ targets: process.env.TS_JEST_LOG ?? undefined,
14
+ });
19
15
  exports.rootLogger = (0, bs_logger_1.createLogger)(buildOptions());
20
16
  (0, backports_1.backportTsJestDebugEnvVar)(exports.rootLogger);
21
17
  // re-create the logger if the env var has been backported
@@ -2,27 +2,26 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Memoize = Memoize;
4
4
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
- var cacheProp = Symbol.for('[memoize]');
5
+ const cacheProp = Symbol.for('[memoize]');
6
6
  /**
7
7
  * @internal
8
8
  */
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
10
  function Memoize(keyBuilder) {
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
- return function (_, propertyKey, descriptor) {
12
+ return (_, propertyKey, descriptor) => {
13
13
  if (descriptor.value != null) {
14
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- descriptor.value = memoize(propertyKey, descriptor.value, keyBuilder || (function (v) { return v; }));
15
+ descriptor.value = memoize(propertyKey, descriptor.value, keyBuilder || ((v) => v));
16
16
  }
17
17
  else if (descriptor.get != null) {
18
- descriptor.get = memoize(propertyKey, descriptor.get, keyBuilder || (function () { return propertyKey; }));
18
+ descriptor.get = memoize(propertyKey, descriptor.get, keyBuilder || (() => propertyKey));
19
19
  }
20
20
  };
21
21
  }
22
22
  // See https://github.com/microsoft/TypeScript/issues/1863#issuecomment-579541944
23
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
- function ensureCache(target, reset) {
25
- if (reset === void 0) { reset = false; }
24
+ function ensureCache(target, reset = false) {
26
25
  if (reset || !target[cacheProp]) {
27
26
  Object.defineProperty(target, cacheProp, {
28
27
  value: Object.create(null),
@@ -33,9 +32,8 @@ function ensureCache(target, reset) {
33
32
  }
34
33
  // See https://github.com/microsoft/TypeScript/issues/1863#issuecomment-579541944
35
34
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- function ensureChildCache(target, key, reset) {
37
- if (reset === void 0) { reset = false; }
38
- var dict = ensureCache(target);
35
+ function ensureChildCache(target, key, reset = false) {
36
+ const dict = ensureCache(target);
39
37
  if (reset || !dict[key]) {
40
38
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
39
  dict[key] = new Map();
@@ -49,17 +47,13 @@ func,
49
47
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
48
  keyBuilder) {
51
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
- return function () {
53
- var args = [];
54
- for (var _i = 0; _i < arguments.length; _i++) {
55
- args[_i] = arguments[_i];
56
- }
57
- var cache = ensureChildCache(this, namespace);
58
- var key = keyBuilder.apply(this, args);
50
+ return function (...args) {
51
+ const cache = ensureChildCache(this, namespace);
52
+ const key = keyBuilder.apply(this, args);
59
53
  if (cache.has(key))
60
54
  return cache.get(key);
61
55
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
- var res = func.apply(this, args);
56
+ const res = func.apply(this, args);
63
57
  cache.set(key, res);
64
58
  return res;
65
59
  };
@@ -6,10 +6,9 @@ exports.interpolate = interpolate;
6
6
  * @internal
7
7
  */
8
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- function interpolate(msg, vars) {
10
- if (vars === void 0) { vars = {}; }
9
+ function interpolate(msg, vars = {}) {
11
10
  // eslint-disable-next-line no-useless-escape
12
- return msg.replace(/\{\{([^\}]+)\}\}/g, function (_, key) { return (key in vars ? vars[key] : _); });
11
+ return msg.replace(/\{\{([^\}]+)\}\}/g, (_, key) => (key in vars ? vars[key] : _));
13
12
  }
14
13
  exports.TsJestDiagnosticCodes = {
15
14
  Generic: 151000,
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cache = void 0;
4
4
  exports.sha1 = sha1;
5
- var crypto_1 = require("crypto");
5
+ const crypto_1 = require("crypto");
6
6
  /**
7
7
  * @internal
8
8
  */
@@ -11,14 +11,10 @@ exports.cache = Object.create(null);
11
11
  /**
12
12
  * @internal
13
13
  */
14
- function sha1() {
15
- var data = [];
16
- for (var _i = 0; _i < arguments.length; _i++) {
17
- data[_i] = arguments[_i];
18
- }
19
- var canCache = data.length === 1 && typeof data[0] === 'string';
14
+ function sha1(...data) {
15
+ const canCache = data.length === 1 && typeof data[0] === 'string';
20
16
  // caching
21
- var cacheKey;
17
+ let cacheKey;
22
18
  if (canCache) {
23
19
  cacheKey = data[0];
24
20
  if (cacheKey in exports.cache) {
@@ -27,14 +23,14 @@ function sha1() {
27
23
  }
28
24
  // we use SHA1 because it's the fastest provided by node
29
25
  // and we are not concerned about security here
30
- var hash = (0, crypto_1.createHash)('sha1');
31
- data.forEach(function (item) {
26
+ const hash = (0, crypto_1.createHash)('sha1');
27
+ data.forEach((item) => {
32
28
  if (typeof item === 'string')
33
29
  hash.update(item, 'utf8');
34
30
  else
35
31
  hash.update(item);
36
32
  });
37
- var res = hash.digest('hex').toString();
33
+ const res = hash.digest('hex').toString();
38
34
  if (canCache) {
39
35
  exports.cache[cacheKey] = res;
40
36
  }
@@ -1,26 +1,11 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.TSError = exports.INSPECT_CUSTOM = void 0;
19
- var util_1 = require("util");
20
- var make_error_1 = require("make-error");
21
- var logger_1 = require("./logger");
22
- var messages_1 = require("./messages");
23
- var logger = logger_1.rootLogger.child({ namespace: 'TSError' });
4
+ const util_1 = require("util");
5
+ const make_error_1 = require("make-error");
6
+ const logger_1 = require("./logger");
7
+ const messages_1 = require("./messages");
8
+ const logger = logger_1.rootLogger.child({ namespace: 'TSError' });
24
9
  /**
25
10
  * @internal
26
11
  */
@@ -30,24 +15,23 @@ exports.INSPECT_CUSTOM = util_1.inspect.custom || 'inspect';
30
15
  *
31
16
  * @internal
32
17
  */
33
- var TSError = /** @class */ (function (_super) {
34
- __extends(TSError, _super);
35
- function TSError(diagnosticText, diagnosticCodes) {
36
- var _this = _super.call(this, (0, messages_1.interpolate)("{{diagnostics}}" /* Errors.UnableToCompileTypeScript */, {
18
+ class TSError extends make_error_1.BaseError {
19
+ diagnosticText;
20
+ diagnosticCodes;
21
+ name = 'TSError';
22
+ constructor(diagnosticText, diagnosticCodes) {
23
+ super((0, messages_1.interpolate)("{{diagnostics}}" /* Errors.UnableToCompileTypeScript */, {
37
24
  diagnostics: diagnosticText.trim(),
38
- })) || this;
39
- _this.diagnosticText = diagnosticText;
40
- _this.diagnosticCodes = diagnosticCodes;
41
- _this.name = 'TSError';
42
- logger.debug({ diagnosticCodes: diagnosticCodes, diagnosticText: diagnosticText }, 'created new TSError');
25
+ }));
26
+ this.diagnosticText = diagnosticText;
27
+ this.diagnosticCodes = diagnosticCodes;
28
+ logger.debug({ diagnosticCodes, diagnosticText }, 'created new TSError');
43
29
  // ensure we blacklist any of our code
44
- Object.defineProperty(_this, 'stack', { value: '' });
45
- return _this;
30
+ Object.defineProperty(this, 'stack', { value: '' });
46
31
  }
47
32
  /* istanbul ignore next */
48
- TSError.prototype[exports.INSPECT_CUSTOM] = function () {
33
+ [exports.INSPECT_CUSTOM]() {
49
34
  return this.diagnosticText;
50
- };
51
- return TSError;
52
- }(make_error_1.BaseError));
35
+ }
36
+ }
53
37
  exports.TSError = TSError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "29.3.2",
3
+ "version": "29.3.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "commonjs",
@@ -58,8 +58,8 @@
58
58
  "json5": "^2.2.3",
59
59
  "lodash.memoize": "^4.1.2",
60
60
  "make-error": "^1.3.6",
61
- "semver": "^7.7.1",
62
- "type-fest": "^4.39.1",
61
+ "semver": "^7.7.2",
62
+ "type-fest": "^4.41.0",
63
63
  "yargs-parser": "^21.1.1"
64
64
  },
65
65
  "peerDependencies": {
@@ -88,11 +88,11 @@
88
88
  }
89
89
  },
90
90
  "devDependencies": {
91
- "@commitlint/cli": "^19.8.0",
92
- "@commitlint/config-angular": "^19.8.0",
93
- "@eslint/compat": "^1.2.8",
91
+ "@commitlint/cli": "^19.8.1",
92
+ "@commitlint/config-angular": "^19.8.1",
93
+ "@eslint/compat": "^1.2.9",
94
94
  "@eslint/eslintrc": "^3.3.1",
95
- "@eslint/js": "^9.24.0",
95
+ "@eslint/js": "^9.26.0",
96
96
  "@jest/globals": "^29.7.0",
97
97
  "@jest/transform": "^29.7.0",
98
98
  "@jest/types": "^29.6.3",
@@ -105,35 +105,35 @@
105
105
  "@types/lodash.memoize": "^4.1.9",
106
106
  "@types/lodash.set": "^4.3.9",
107
107
  "@types/micromatch": "^4.0.9",
108
- "@types/node": "20.17.30",
108
+ "@types/node": "20.17.47",
109
109
  "@types/semver": "^7.7.0",
110
110
  "@types/yargs": "^17.0.33",
111
111
  "@types/yargs-parser": "21.0.3",
112
- "@typescript-eslint/eslint-plugin": "^8.29.1",
113
- "@typescript-eslint/parser": "^8.29.1",
112
+ "@typescript-eslint/eslint-plugin": "^8.32.1",
113
+ "@typescript-eslint/parser": "^8.32.1",
114
114
  "babel-jest": "^29.7.0",
115
115
  "conventional-changelog-cli": "^5.0.0",
116
- "esbuild": "~0.25.2",
117
- "eslint": "^9.24.0",
118
- "eslint-config-prettier": "^10.1.2",
116
+ "esbuild": "~0.25.4",
117
+ "eslint": "^9.26.0",
118
+ "eslint-config-prettier": "^10.1.5",
119
119
  "eslint-plugin-import": "^2.31.0",
120
120
  "eslint-plugin-jest": "^28.11.0",
121
- "eslint-plugin-jsdoc": "^50.6.9",
121
+ "eslint-plugin-jsdoc": "^50.6.17",
122
122
  "eslint-plugin-prettier": "^4.2.1",
123
123
  "execa": "5.1.1",
124
124
  "fs-extra": "^11.3.0",
125
125
  "glob": "^10.2.6",
126
126
  "glob-gitignore": "^1.0.15",
127
- "globals": "^16.0.0",
127
+ "globals": "^16.1.0",
128
128
  "husky": "^9.1.7",
129
129
  "jest": "^29.7.0",
130
130
  "js-yaml": "^4.1.0",
131
- "lint-staged": "^15.5.1",
132
- "memfs": "^4.17.0",
131
+ "lint-staged": "^15.5.2",
132
+ "memfs": "^4.17.2",
133
133
  "prettier": "^2.8.8",
134
134
  "rimraf": "^5.0.10",
135
- "typescript": "~5.5.4",
136
- "typescript-eslint": "^8.29.1"
135
+ "typescript": "~5.8.3",
136
+ "typescript-eslint": "^8.32.1"
137
137
  },
138
138
  "engines": {
139
139
  "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "downlevelIteration": true,
5
+ "experimentalDecorators": true,
6
+ "forceConsistentCasingInFileNames": true,
7
+ "noFallthroughCasesInSwitch": true,
8
+ "noUnusedLocals": true,
9
+ "noUnusedParameters": true,
10
+ "noImplicitReturns": true,
11
+ "skipLibCheck": true,
12
+ "esModuleInterop": true,
13
+ "resolveJsonModule": true,
14
+ "checkJs": false,
15
+ "target": "ESNext",
16
+ "module": "NodeNext",
17
+ "moduleResolution": "NodeNext",
18
+ "lib": ["ESNext"]
19
+ }
20
+ }
@@ -1,16 +0,0 @@
1
- sonar.organization=kulshekhar-ts-jest
2
- sonar.projectKey=kulshekhar_ts-jest
3
- sonar.sources=src
4
- sonar.language=ts
5
- sonar.sourceEncoding=UTF-8
6
- sonar.javascript.lcov.reportPaths=coverage/lcov.info
7
- sonar.typescript.tsconfigPath=tsconfig.json
8
- sonar.exclusions=\
9
- **/*.md, \
10
- **/jest.config.ts, \
11
- **/jest-*.config.ts, \
12
- **/*.spec.ts, \
13
- **/**.spec.ts, \
14
- src/__helpers__/**, \
15
- src/__mocks__/**, \
16
- website/**