ts-jest 29.4.0 → 29.4.2

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
- f80537ea4534af72d55ea38f700d980529562be2
1
+ dcc1f805fca523b68a17fd855bdb44f7efac00d6
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## [29.4.2](https://github.com/kulshekhar/ts-jest/compare/v29.4.1...v29.4.2) (2025-09-15)
2
+
3
+
4
+ ## Bug Fixes
5
+
6
+ * fix: node 14 compatibility ([aa0d563](https://github.com/kulshekhar/ts-jest/commit/aa0d563)), fixes [#5038](https://github.com/kulshekhar/ts-jest/issues/5038)
7
+
8
+
9
+
10
+ ## [29.4.1](https://github.com/kulshekhar/ts-jest/compare/v29.4.0...v29.4.1) (2025-08-03)
11
+
12
+
13
+ ## Bug Fixes
14
+
15
+ * fix: replace `ejs` with `handlebars` due to security issues ([899c9b7](https://github.com/kulshekhar/ts-jest/commit/899c9b7)), closes [#4969](https://github.com/kulshekhar/ts-jest/issues/4969)
16
+
17
+
18
+
1
19
  ## [29.4.0](https://github.com/kulshekhar/ts-jest/compare/v29.3.4...v29.4.0) (2025-06-11)
2
20
 
3
21
 
@@ -11,16 +11,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.help = exports.run = void 0;
12
12
  const fs_1 = require("fs");
13
13
  const path_1 = require("path");
14
- const ejs_1 = __importDefault(require("ejs"));
14
+ const handlebars_1 = __importDefault(require("handlebars"));
15
15
  const json5_1 = require("json5");
16
16
  const create_jest_preset_1 = require("../../presets/create-jest-preset");
17
- const JEST_CONFIG_EJS_TEMPLATE = `const { <%= presetCreatorFn %> } = require("ts-jest");
17
+ const JEST_CONFIG_TEMPLATE = `const { {{ presetCreatorFn }} } = require("ts-jest");
18
18
 
19
- const tsJestTransformCfg = <%= presetCreatorFn %>(<%- transformOpts %>).transform;
19
+ const tsJestTransformCfg = {{ presetCreatorFn }}({{{ transformOpts }}}).transform;
20
20
 
21
21
  /** @type {import("jest").Config} **/
22
- <%= exportKind %> {
23
- testEnvironment: "<%= testEnvironment %>",
22
+ {{{ exportKind }}} {
23
+ testEnvironment: "{{ testEnvironment }}",
24
24
  transform: {
25
25
  ...tsJestTransformCfg,
26
26
  },
@@ -98,7 +98,8 @@ const run = async (args /* , logger: Logger */) => {
98
98
  else {
99
99
  presetCreatorFn = 'createDefaultPreset';
100
100
  }
101
- body = ejs_1.default.render(JEST_CONFIG_EJS_TEMPLATE, {
101
+ const template = handlebars_1.default.compile(JEST_CONFIG_TEMPLATE);
102
+ body = template({
102
103
  exportKind: pkgJsonContent.type === 'module' ? 'export default' : 'module.exports =',
103
104
  testEnvironment: jsdom ? 'jsdom' : 'node',
104
105
  presetCreatorFn,
@@ -95,8 +95,11 @@ const run = async (args /* , logger: Logger*/) => {
95
95
  delete migratedConfig.testMatch;
96
96
  }
97
97
  // check the testMatch
98
- else if (migratedConfig.testMatch?.length && preset) {
99
- const presetValue = dedupSort(preset.value.testMatch ?? []).join('::');
98
+ else if (migratedConfig.testMatch?.length &&
99
+ preset &&
100
+ Array.isArray(preset.value.testMatch) &&
101
+ Array.isArray(migratedConfig.testMatch)) {
102
+ const presetValue = dedupSort(preset.value.testMatch).join('::');
100
103
  const migratedValue = dedupSort(migratedConfig.testMatch).join('::');
101
104
  if (presetValue === migratedValue) {
102
105
  delete migratedConfig.testMatch;
@@ -139,7 +142,7 @@ function cleanupConfig(config) {
139
142
  if (!config.moduleFileExtensions.length)
140
143
  delete config.moduleFileExtensions;
141
144
  }
142
- if (config.testMatch) {
145
+ if (config.testMatch && Array.isArray(config.testMatch)) {
143
146
  config.testMatch = dedupSort(config.testMatch);
144
147
  if (!config.testMatch.length)
145
148
  delete config.testMatch;
@@ -54,9 +54,11 @@ const shouldCheckProjectPkgJsonContent = (fileName, moduleKind) => {
54
54
  * - Allow using custom AST transformers with the internal created {@link Program}
55
55
  */
56
56
  const transpileWorker = (input, transpileOptions) => {
57
- barebonesLibSourceFile ??= typescript_1.default.createSourceFile(barebonesLibName, barebonesLibContent, {
58
- languageVersion: typescript_1.default.ScriptTarget.Latest,
59
- });
57
+ if (!barebonesLibSourceFile) {
58
+ barebonesLibSourceFile = typescript_1.default.createSourceFile(barebonesLibName, barebonesLibContent, {
59
+ languageVersion: typescript_1.default.ScriptTarget.Latest,
60
+ });
61
+ }
60
62
  const diagnostics = [];
61
63
  const options = transpileOptions.compilerOptions
62
64
  ? // @ts-expect-error internal TypeScript API
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "29.4.0",
3
+ "version": "29.4.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "commonjs",
@@ -52,8 +52,8 @@
52
52
  "homepage": "https://kulshekhar.github.io/ts-jest",
53
53
  "dependencies": {
54
54
  "bs-logger": "^0.2.6",
55
- "ejs": "^3.1.10",
56
55
  "fast-json-stable-stringify": "^2.1.0",
56
+ "handlebars": "^4.7.8",
57
57
  "json5": "^2.2.3",
58
58
  "lodash.memoize": "^4.1.2",
59
59
  "make-error": "^1.3.6",
@@ -93,14 +93,13 @@
93
93
  "devDependencies": {
94
94
  "@commitlint/cli": "^19.8.1",
95
95
  "@commitlint/config-angular": "^19.8.1",
96
- "@eslint/compat": "^1.2.9",
96
+ "@eslint/compat": "^1.3.2",
97
97
  "@eslint/eslintrc": "^3.3.1",
98
- "@eslint/js": "^9.28.0",
99
- "@jest/globals": "^30.0.0",
100
- "@jest/transform": "^30.0.0",
101
- "@jest/types": "^30.0.0",
98
+ "@eslint/js": "^9.35.0",
99
+ "@jest/globals": "^30.0.5",
100
+ "@jest/transform": "^30.0.5",
101
+ "@jest/types": "^30.0.5",
102
102
  "@types/babel__core": "^7.20.5",
103
- "@types/ejs": "^3.1.5",
104
103
  "@types/fs-extra": "^11.0.4",
105
104
  "@types/jest": "^29.5.14",
106
105
  "@types/js-yaml": "^4.0.9",
@@ -108,36 +107,36 @@
108
107
  "@types/lodash.memoize": "^4.1.9",
109
108
  "@types/lodash.set": "^4.3.9",
110
109
  "@types/micromatch": "^4.0.9",
111
- "@types/node": "20.19.0",
112
- "@types/semver": "^7.7.0",
110
+ "@types/node": "20.19.14",
111
+ "@types/semver": "^7.7.1",
113
112
  "@types/yargs": "^17.0.33",
114
113
  "@types/yargs-parser": "21.0.3",
115
- "@typescript-eslint/eslint-plugin": "^8.34.0",
116
- "@typescript-eslint/parser": "^8.34.0",
117
- "babel-jest": "^30.0.0",
114
+ "@typescript-eslint/eslint-plugin": "^8.43.0",
115
+ "@typescript-eslint/parser": "^8.43.0",
116
+ "babel-jest": "^30.0.5",
117
+ "conventional-changelog-angular": "^8.0.0",
118
118
  "conventional-changelog-cli": "^5.0.0",
119
- "esbuild": "~0.25.5",
120
- "eslint": "^9.28.0",
121
- "eslint-config-prettier": "^10.1.5",
122
- "eslint-plugin-import": "^2.31.0",
123
- "eslint-plugin-jest": "^28.13.3",
119
+ "esbuild": "~0.25.9",
120
+ "eslint": "^9.35.0",
121
+ "eslint-config-prettier": "^10.1.8",
122
+ "eslint-plugin-import": "^2.32.0",
123
+ "eslint-plugin-jest": "^28.14.0",
124
124
  "eslint-plugin-jsdoc": "^50.8.0",
125
- "eslint-plugin-prettier": "^4.2.1",
125
+ "eslint-plugin-prettier": "^4.2.5",
126
126
  "execa": "5.1.1",
127
- "fs-extra": "^11.3.0",
128
- "glob": "^11.0.2",
129
- "glob-gitignore": "^1.0.15",
130
- "globals": "^16.2.0",
127
+ "fast-glob": "^3.3.3",
128
+ "fs-extra": "^11.3.1",
129
+ "globals": "^16.4.0",
131
130
  "husky": "^9.1.7",
132
- "jest": "^30.0.0",
131
+ "jest": "^30.0.5",
133
132
  "js-yaml": "^4.1.0",
134
133
  "lint-staged": "^15.5.2",
135
- "memfs": "^4.17.2",
134
+ "memfs": "^4.39.0",
136
135
  "prettier": "^2.8.8",
137
136
  "rimraf": "^5.0.10",
138
137
  "ts-node": "^10.9.2",
139
- "typescript": "~5.8.3",
140
- "typescript-eslint": "^8.34.0"
138
+ "typescript": "~5.9.2",
139
+ "typescript-eslint": "^8.43.0"
141
140
  },
142
141
  "engines": {
143
142
  "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"