ts-jest 29.4.0 → 29.4.1

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
+ ff42db26b185ac7e4ad144c52d191736fe9dffdd
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [29.4.1](https://github.com/kulshekhar/ts-jest/compare/v29.4.0...v29.4.1) (2025-08-03)
2
+
3
+
4
+ ## Bug Fixes
5
+
6
+ * 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)
7
+
8
+
9
+
1
10
  ## [29.4.0](https://github.com/kulshekhar/ts-jest/compare/v29.3.4...v29.4.0) (2025-06-11)
2
11
 
3
12
 
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "29.4.0",
3
+ "version": "29.4.1",
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,51 +93,50 @@
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.1",
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.32.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",
104
+ "@types/handlebars": "^4.1.0",
105
105
  "@types/jest": "^29.5.14",
106
106
  "@types/js-yaml": "^4.0.9",
107
107
  "@types/lodash.camelcase": "^4.3.9",
108
108
  "@types/lodash.memoize": "^4.1.9",
109
109
  "@types/lodash.set": "^4.3.9",
110
110
  "@types/micromatch": "^4.0.9",
111
- "@types/node": "20.19.0",
111
+ "@types/node": "20.19.9",
112
112
  "@types/semver": "^7.7.0",
113
113
  "@types/yargs": "^17.0.33",
114
114
  "@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",
115
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
116
+ "@typescript-eslint/parser": "^8.38.0",
117
+ "babel-jest": "^30.0.5",
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.8",
120
+ "eslint": "^9.32.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
+ "fast-glob": "^3.3.3",
127
128
  "fs-extra": "^11.3.0",
128
- "glob": "^11.0.2",
129
- "glob-gitignore": "^1.0.15",
130
- "globals": "^16.2.0",
129
+ "globals": "^16.3.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.36.0",
136
135
  "prettier": "^2.8.8",
137
136
  "rimraf": "^5.0.10",
138
137
  "ts-node": "^10.9.2",
139
138
  "typescript": "~5.8.3",
140
- "typescript-eslint": "^8.34.0"
139
+ "typescript-eslint": "^8.38.0"
141
140
  },
142
141
  "engines": {
143
142
  "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"