ts-jest 29.3.4 → 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
- dfc4e7710788a7a7f79e90e8d15aee27450846bd
1
+ ff42db26b185ac7e4ad144c52d191736fe9dffdd
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
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
+
10
+ ## [29.4.0](https://github.com/kulshekhar/ts-jest/compare/v29.3.4...v29.4.0) (2025-06-11)
11
+
12
+
13
+ ### Features
14
+
15
+ * feat: support Jest 30 ([84e093e](https://github.com/kulshekhar/ts-jest/commit/84e093e))
16
+
17
+
18
+
1
19
  ## [29.3.4](https://github.com/kulshekhar/ts-jest/compare/v29.3.3...v29.3.4) (2025-05-16)
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;
package/dist/types.d.ts CHANGED
@@ -142,8 +142,8 @@ export type TsJestTransformerOptions = TsJestGlobalOptions;
142
142
  export type TsJestTransformOptions = TransformOptions<TsJestTransformerOptions>;
143
143
  export interface JestConfigWithTsJest extends Omit<Config.InitialOptions, 'transform'> {
144
144
  transform?: {
145
- [regex: string]: 'ts-jest' | 'ts-jest/legacy' | ['ts-jest', TsJestTransformerOptions] | ['ts-jest/legacy', TsJestTransformerOptions] | string | Config.TransformerConfig;
146
- };
145
+ [regex: string]: 'ts-jest' | 'ts-jest/legacy' | ['ts-jest', TsJestTransformerOptions] | ['ts-jest/legacy', TsJestTransformerOptions];
146
+ } | Config.InitialOptions['transform'];
147
147
  }
148
148
  export type StringMap = Map<string, string>;
149
149
  export interface DepGraphInfo {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "29.3.4",
3
+ "version": "29.4.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "commonjs",
@@ -52,9 +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",
57
- "jest-util": "^29.0.0",
56
+ "handlebars": "^4.7.8",
58
57
  "json5": "^2.2.3",
59
58
  "lodash.memoize": "^4.1.2",
60
59
  "make-error": "^1.3.6",
@@ -64,10 +63,11 @@
64
63
  },
65
64
  "peerDependencies": {
66
65
  "@babel/core": ">=7.0.0-beta.0 <8",
67
- "@jest/transform": "^29.0.0",
68
- "@jest/types": "^29.0.0",
69
- "babel-jest": "^29.0.0",
70
- "jest": "^29.0.0",
66
+ "@jest/transform": "^29.0.0 || ^30.0.0",
67
+ "@jest/types": "^29.0.0 || ^30.0.0",
68
+ "babel-jest": "^29.0.0 || ^30.0.0",
69
+ "jest": "^29.0.0 || ^30.0.0",
70
+ "jest-util": "^29.0.0 || ^30.0.0",
71
71
  "typescript": ">=4.3 <6"
72
72
  },
73
73
  "peerDependenciesMeta": {
@@ -85,55 +85,58 @@
85
85
  },
86
86
  "esbuild": {
87
87
  "optional": true
88
+ },
89
+ "jest-util": {
90
+ "optional": true
88
91
  }
89
92
  },
90
93
  "devDependencies": {
91
94
  "@commitlint/cli": "^19.8.1",
92
95
  "@commitlint/config-angular": "^19.8.1",
93
- "@eslint/compat": "^1.2.9",
96
+ "@eslint/compat": "^1.3.1",
94
97
  "@eslint/eslintrc": "^3.3.1",
95
- "@eslint/js": "^9.26.0",
96
- "@jest/globals": "^29.7.0",
97
- "@jest/transform": "^29.7.0",
98
- "@jest/types": "^29.6.3",
98
+ "@eslint/js": "^9.32.0",
99
+ "@jest/globals": "^30.0.5",
100
+ "@jest/transform": "^30.0.5",
101
+ "@jest/types": "^30.0.5",
99
102
  "@types/babel__core": "^7.20.5",
100
- "@types/ejs": "^3.1.5",
101
103
  "@types/fs-extra": "^11.0.4",
104
+ "@types/handlebars": "^4.1.0",
102
105
  "@types/jest": "^29.5.14",
103
106
  "@types/js-yaml": "^4.0.9",
104
107
  "@types/lodash.camelcase": "^4.3.9",
105
108
  "@types/lodash.memoize": "^4.1.9",
106
109
  "@types/lodash.set": "^4.3.9",
107
110
  "@types/micromatch": "^4.0.9",
108
- "@types/node": "20.17.47",
111
+ "@types/node": "20.19.9",
109
112
  "@types/semver": "^7.7.0",
110
113
  "@types/yargs": "^17.0.33",
111
114
  "@types/yargs-parser": "21.0.3",
112
- "@typescript-eslint/eslint-plugin": "^8.32.1",
113
- "@typescript-eslint/parser": "^8.32.1",
114
- "babel-jest": "^29.7.0",
115
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
116
+ "@typescript-eslint/parser": "^8.38.0",
117
+ "babel-jest": "^30.0.5",
115
118
  "conventional-changelog-cli": "^5.0.0",
116
- "esbuild": "~0.25.4",
117
- "eslint": "^9.26.0",
118
- "eslint-config-prettier": "^10.1.5",
119
- "eslint-plugin-import": "^2.31.0",
120
- "eslint-plugin-jest": "^28.11.0",
121
- "eslint-plugin-jsdoc": "^50.6.17",
122
- "eslint-plugin-prettier": "^4.2.1",
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
+ "eslint-plugin-jsdoc": "^50.8.0",
125
+ "eslint-plugin-prettier": "^4.2.5",
123
126
  "execa": "5.1.1",
127
+ "fast-glob": "^3.3.3",
124
128
  "fs-extra": "^11.3.0",
125
- "glob": "^10.2.6",
126
- "glob-gitignore": "^1.0.15",
127
- "globals": "^16.1.0",
129
+ "globals": "^16.3.0",
128
130
  "husky": "^9.1.7",
129
- "jest": "^29.7.0",
131
+ "jest": "^30.0.5",
130
132
  "js-yaml": "^4.1.0",
131
133
  "lint-staged": "^15.5.2",
132
- "memfs": "^4.17.2",
134
+ "memfs": "^4.36.0",
133
135
  "prettier": "^2.8.8",
134
136
  "rimraf": "^5.0.10",
137
+ "ts-node": "^10.9.2",
135
138
  "typescript": "~5.8.3",
136
- "typescript-eslint": "^8.32.1"
139
+ "typescript-eslint": "^8.38.0"
137
140
  },
138
141
  "engines": {
139
142
  "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"