ts-jest 29.2.5 → 29.2.6
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 +1 -1
- package/CHANGELOG.md +11 -0
- package/CONTRIBUTING.md +1 -0
- package/LICENSE.md +1 -1
- package/README.md +1 -0
- package/TROUBLESHOOTING.md +1 -73
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +3 -3
- package/package.json +12 -12
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
bc7eea511e438e06b762bdf538d9d2c6b362e922
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
### [29.2.6](https://github.com/kulshekhar/ts-jest/compare/v29.2.5...v29.2.6) (2025-02-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fix: escape dot for `JS_TRANSFORM_PATTERN` regex ([8c91c60](https://github.com/kulshekhar/ts-jest/commit/8c91c60))
|
|
7
|
+
* fix: escape dot for `TS_JS_TRANSFORM_PATTERN` regex ([3eea850](https://github.com/kulshekhar/ts-jest/commit/3eea850))
|
|
8
|
+
* fix: escape dot for `TS_TRANSFORM_PATTERN` regex ([80d3e4d](https://github.com/kulshekhar/ts-jest/commit/80d3e4d)), closes [#4579](https://github.com/kulshekhar/ts-jest/issues/4579)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
1
12
|
### [29.2.5](https://github.com/kulshekhar/ts-jest/compare/v29.2.4...v29.2.5) (2024-08-23)
|
|
2
13
|
|
|
3
14
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -82,6 +82,7 @@ changes are being displayed accurately.
|
|
|
82
82
|
```sh-session
|
|
83
83
|
$ cd website # Only needed if you are not already in the website directory
|
|
84
84
|
$ npm ci
|
|
85
|
+
$ npm run lint-prettier # Please format markdown files
|
|
85
86
|
$ npm run start
|
|
86
87
|
```
|
|
87
88
|
3. You can run a development server to check if the changes you made are being displayed accurately by running `npm run start` in the website directory.
|
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
<a href="https://coveralls.io/github/kulshekhar/ts-jest?branch=main"><img src="https://coveralls.io/repos/github/kulshekhar/ts-jest/badge.svg?branch=main" alt="Coverage status"/> </a>
|
|
10
10
|
<a href="https://actions-badge.atrox.dev/kulshekhar/ts-jest/goto?ref=main"><img alt="GitHub actions" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fkulshekhar%2Fts-jest%2Fbadge%3Fref%3Dmain&style=flat-square" /> </a>
|
|
11
11
|
<a href="https://github.com/kulshekhar/ts-jest/blob/main/LICENSE.md"><img src="https://img.shields.io/npm/l/ts-jest.svg?style=flat-square" alt="GitHub license"/> </a>
|
|
12
|
+
<a href="https://gurubase.io/g/ts-jest"><img src="https://img.shields.io/badge/Gurubase-Ask%20ts--jest%20Guru-006BFF?style=flat-square" alt="Gurubase"/> </a>
|
|
12
13
|
</p>
|
|
13
14
|
|
|
14
15
|
<img src="./icon.png" align="right" title="ts-jest Logo" width="128" height="128">
|
package/TROUBLESHOOTING.md
CHANGED
|
@@ -1,75 +1,3 @@
|
|
|
1
1
|
# Troubleshooting
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
### PROBLEM
|
|
6
|
-
|
|
7
|
-
Cannot find module "" from ""
|
|
8
|
-
|
|
9
|
-
### SOLUTION
|
|
10
|
-
|
|
11
|
-
- Check if `rootDir` is referenced correctly. If not add this on your existing jest configuration.
|
|
12
|
-
|
|
13
|
-
```javascript
|
|
14
|
-
module.exports = {
|
|
15
|
-
...
|
|
16
|
-
roots: ["<rootDir>"]
|
|
17
|
-
}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
- Check if module directories are included on your jest configuration. If not add this on your existing jest configuration.
|
|
21
|
-
|
|
22
|
-
```javascript
|
|
23
|
-
module.exports = {
|
|
24
|
-
...
|
|
25
|
-
moduleDirectories: ["node_modules","<module-directory>"],
|
|
26
|
-
modulePaths: ["<path-of-module>"],
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
- Check if module name is properly mapped and can be referenced by jest. If not, you can define moduleNameMapper for your jest configuration.
|
|
31
|
-
|
|
32
|
-
```javascript
|
|
33
|
-
module.exports = {
|
|
34
|
-
...
|
|
35
|
-
moduleNameMapper: {
|
|
36
|
-
"<import-path>": "<rootDir>/<real-physical-path>",
|
|
37
|
-
},
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
- Check github folder names if its identical to you local folder names. Sometimes github never updates your folder names even if you rename it locally. If this happens rename your folders via github or use this command `git mv <source> <destination>` and commit changes.
|
|
42
|
-
|
|
43
|
-
## Transform (node)-module explicitly
|
|
44
|
-
|
|
45
|
-
### PROBLEM
|
|
46
|
-
|
|
47
|
-
SyntaxError: Cannot use import statement outside a module
|
|
48
|
-
|
|
49
|
-
### SOLUTION
|
|
50
|
-
|
|
51
|
-
One of the node modules hasn't the correct syntax for Jests execution step. It needs to
|
|
52
|
-
be transformed first.
|
|
53
|
-
|
|
54
|
-
There is a good chance that the error message shows which module is affected:
|
|
55
|
-
|
|
56
|
-
```shell
|
|
57
|
-
SyntaxError: Cannot use import statement outside a module
|
|
58
|
-
> 22 | import Component from "../../node_modules/some-module/lib";
|
|
59
|
-
| ^
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
In this case **some-module** is the problem and needs to be transformed.
|
|
63
|
-
By adding the following line to the configuration file it will tell Jest which modules
|
|
64
|
-
shouldnt be ignored during the transformation step:
|
|
65
|
-
|
|
66
|
-
```javascript
|
|
67
|
-
module.exports = {
|
|
68
|
-
...
|
|
69
|
-
transformIgnorePatterns: ["node_modules/(?!(some-module|another-module))"]
|
|
70
|
-
};
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
**some-module** and **another-module** will be transformed.
|
|
74
|
-
|
|
75
|
-
For more information see [here](https://stackoverflow.com/questions/63389757/jest-unit-test-syntaxerror-cannot-use-import-statement-outside-a-module) and [here](https://stackoverflow.com/questions/52035066/how-to-write-jest-transformignorepatterns).
|
|
3
|
+
Troubleshooting guide have been moved to https://kulshekhar.github.io/ts-jest/docs/guides/troubleshooting
|
package/dist/constants.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ export declare const DECLARATION_TYPE_EXT = ".d.ts";
|
|
|
3
3
|
export declare const JS_JSX_EXTENSIONS: string[];
|
|
4
4
|
export declare const TS_TSX_REGEX: RegExp;
|
|
5
5
|
export declare const JS_JSX_REGEX: RegExp;
|
|
6
|
-
export declare const TS_TRANSFORM_PATTERN = "
|
|
6
|
+
export declare const TS_TRANSFORM_PATTERN = "^.+\\.tsx?$";
|
|
7
7
|
export declare const ESM_TS_TRANSFORM_PATTERN = "^.+\\.m?tsx?$";
|
|
8
|
-
export declare const TS_JS_TRANSFORM_PATTERN = "
|
|
8
|
+
export declare const TS_JS_TRANSFORM_PATTERN = "^.+\\.[tj]sx?$";
|
|
9
9
|
export declare const ESM_TS_JS_TRANSFORM_PATTERN = "^.+\\.m?[tj]sx?$";
|
|
10
|
-
export declare const JS_TRANSFORM_PATTERN = "
|
|
10
|
+
export declare const JS_TRANSFORM_PATTERN = "^.+\\.jsx?$";
|
|
11
11
|
export declare const ESM_JS_TRANSFORM_PATTERN = "^.+\\.m?jsx?$";
|
|
12
12
|
export declare const TS_EXT_TO_TREAT_AS_ESM: string[];
|
|
13
13
|
export declare const JS_EXT_TO_TREAT_AS_ESM: string[];
|
package/dist/constants.js
CHANGED
|
@@ -6,11 +6,11 @@ exports.DECLARATION_TYPE_EXT = '.d.ts';
|
|
|
6
6
|
exports.JS_JSX_EXTENSIONS = ['.js', '.jsx'];
|
|
7
7
|
exports.TS_TSX_REGEX = /\.[cm]?tsx?$/;
|
|
8
8
|
exports.JS_JSX_REGEX = /\.[cm]?jsx?$/;
|
|
9
|
-
exports.TS_TRANSFORM_PATTERN = '
|
|
9
|
+
exports.TS_TRANSFORM_PATTERN = '^.+\\.tsx?$';
|
|
10
10
|
exports.ESM_TS_TRANSFORM_PATTERN = '^.+\\.m?tsx?$';
|
|
11
|
-
exports.TS_JS_TRANSFORM_PATTERN = '
|
|
11
|
+
exports.TS_JS_TRANSFORM_PATTERN = '^.+\\.[tj]sx?$';
|
|
12
12
|
exports.ESM_TS_JS_TRANSFORM_PATTERN = '^.+\\.m?[tj]sx?$';
|
|
13
|
-
exports.JS_TRANSFORM_PATTERN = '
|
|
13
|
+
exports.JS_TRANSFORM_PATTERN = '^.+\\.jsx?$';
|
|
14
14
|
exports.ESM_JS_TRANSFORM_PATTERN = '^.+\\.m?jsx?$';
|
|
15
15
|
// `extensionsToTreatAsEsm` will throw error with `.mjs`
|
|
16
16
|
exports.TS_EXT_TO_TREAT_AS_ESM = ['.ts', '.tsx', '.mts'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-jest",
|
|
3
|
-
"version": "29.2.
|
|
3
|
+
"version": "29.2.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test-examples": "node scripts/test-examples.js",
|
|
18
18
|
"lint": "eslint --ext .js,.ts .",
|
|
19
19
|
"lint-fix": "eslint --fix --ext .js,.ts .",
|
|
20
|
-
"lint-prettier": "prettier
|
|
20
|
+
"lint-prettier": "prettier \"**/*.{yml,yaml,md}\" --write",
|
|
21
21
|
"lint-prettier-ci": "prettier '**/*.{yml,yaml,md}' --check",
|
|
22
22
|
"doc": "cd website && npm run start",
|
|
23
23
|
"doc:build": "cd website && npm run build",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"json5": "^2.2.3",
|
|
60
60
|
"lodash.memoize": "^4.1.2",
|
|
61
61
|
"make-error": "^1.3.6",
|
|
62
|
-
"semver": "^7.
|
|
62
|
+
"semver": "^7.7.1",
|
|
63
63
|
"yargs-parser": "^21.1.1"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -103,13 +103,13 @@
|
|
|
103
103
|
"@types/babel__core": "^7.20.5",
|
|
104
104
|
"@types/ejs": "^3.1.5",
|
|
105
105
|
"@types/fs-extra": "^11.0.4",
|
|
106
|
-
"@types/jest": "^29.5.
|
|
106
|
+
"@types/jest": "^29.5.14",
|
|
107
107
|
"@types/js-yaml": "^4.0.9",
|
|
108
108
|
"@types/lodash.camelcase": "^4.3.9",
|
|
109
109
|
"@types/lodash.memoize": "^4.1.9",
|
|
110
110
|
"@types/lodash.set": "^4.3.9",
|
|
111
111
|
"@types/micromatch": "^4.0.9",
|
|
112
|
-
"@types/node": "20.
|
|
112
|
+
"@types/node": "20.17.19",
|
|
113
113
|
"@types/semver": "^7.5.8",
|
|
114
114
|
"@types/yargs": "^17.0.33",
|
|
115
115
|
"@types/yargs-parser": "21.0.3",
|
|
@@ -117,23 +117,23 @@
|
|
|
117
117
|
"@typescript-eslint/parser": "^7.18.0",
|
|
118
118
|
"babel-jest": "^29.7.0",
|
|
119
119
|
"conventional-changelog-cli": "^5.0.0",
|
|
120
|
-
"esbuild": "~0.
|
|
121
|
-
"eslint": "^8.57.
|
|
120
|
+
"esbuild": "~0.25.0",
|
|
121
|
+
"eslint": "^8.57.1",
|
|
122
122
|
"eslint-config-prettier": "^9.1.0",
|
|
123
|
-
"eslint-plugin-import": "^2.
|
|
124
|
-
"eslint-plugin-jest": "^28.
|
|
123
|
+
"eslint-plugin-import": "^2.31.0",
|
|
124
|
+
"eslint-plugin-jest": "^28.11.0",
|
|
125
125
|
"eslint-plugin-jsdoc": "^48.11.0",
|
|
126
126
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
127
127
|
"eslint-plugin-prettier": "^4.2.1",
|
|
128
128
|
"execa": "5.1.1",
|
|
129
|
-
"fs-extra": "^11.
|
|
129
|
+
"fs-extra": "^11.3.0",
|
|
130
130
|
"glob": "^10.2.6",
|
|
131
|
-
"glob-gitignore": "^1.0.
|
|
131
|
+
"glob-gitignore": "^1.0.15",
|
|
132
132
|
"husky": "~4.3.8",
|
|
133
133
|
"jest": "^29.7.0",
|
|
134
134
|
"js-yaml": "^4.1.0",
|
|
135
135
|
"json-schema-to-typescript": "^13.1.2",
|
|
136
|
-
"lint-staged": "^15.
|
|
136
|
+
"lint-staged": "^15.4.3",
|
|
137
137
|
"prettier": "^2.8.8",
|
|
138
138
|
"typescript": "~5.5.4"
|
|
139
139
|
},
|