eslint-plugin-jest 29.15.1 → 29.15.3
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.
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- end auto-generated rule header -->
|
|
12
12
|
|
|
13
|
-
> [!NOTE]
|
|
14
|
-
>
|
|
13
|
+
> [!NOTE]
|
|
14
|
+
>
|
|
15
|
+
> Test function will be fixed if it is `async` and does not have `await` in the
|
|
16
|
+
> async assertion.
|
|
15
17
|
|
|
16
18
|
Ensure `expect()` is called with a single argument and there is an actual
|
|
17
19
|
expectation made.
|
|
@@ -24,6 +24,9 @@ jest.mock('../../this/module/does/not/exist');
|
|
|
24
24
|
|
|
25
25
|
// Local file that cannot be found
|
|
26
26
|
jest.mock('../../this/path/does/not/exist.js');
|
|
27
|
+
|
|
28
|
+
// Local file that cannot be found and is NOT virtual
|
|
29
|
+
jest.mock('../../this/path/does/not/exist.js', undefined, { virtual: false });
|
|
27
30
|
```
|
|
28
31
|
|
|
29
32
|
The following patterns are **not** considered errors:
|
|
@@ -38,6 +41,13 @@ jest.mock('../../this/module/really/does/exist');
|
|
|
38
41
|
|
|
39
42
|
// Local file that cannot be found
|
|
40
43
|
jest.mock('../../this/path/really/does/exist.js');
|
|
44
|
+
|
|
45
|
+
// Module(s) that cannot be found but are configured as virtual
|
|
46
|
+
jest.mock('@org/some-module-not-in-package-json', undefined, { virtual: true });
|
|
47
|
+
jest.mock('some-module-not-in-package-json', undefined, { virtual: true });
|
|
48
|
+
|
|
49
|
+
// Local file that cannot be found but is configured as virtual
|
|
50
|
+
jest.mock('../../this/path/does/not/exist.js', undefined, { virtual: true });
|
|
41
51
|
```
|
|
42
52
|
|
|
43
53
|
## Options
|
package/lib/rules/no-export.js
CHANGED
|
@@ -34,7 +34,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
CallExpression(node) {
|
|
37
|
-
if ((0, _utils2.isTypeOfJestFnCall)(node, context, ['test'])) {
|
|
37
|
+
if ((0, _utils2.isTypeOfJestFnCall)(node, context, ['describe', 'test'])) {
|
|
38
38
|
hasTestCase = true;
|
|
39
39
|
}
|
|
40
40
|
},
|
|
@@ -51,6 +51,21 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
51
51
|
if (!moduleName) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
+
if (node.arguments[2]?.type === _utils.AST_NODE_TYPES.ObjectExpression) {
|
|
55
|
+
const hasTrueVirtualProperty = node.arguments[2].properties.some(expression => {
|
|
56
|
+
if (expression.type === _utils.AST_NODE_TYPES.Property) {
|
|
57
|
+
const {
|
|
58
|
+
key,
|
|
59
|
+
value
|
|
60
|
+
} = expression;
|
|
61
|
+
return (0, _utils2.isSupportedAccessor)(key, 'virtual') && value.type === _utils.AST_NODE_TYPES.Literal && value.value;
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
});
|
|
65
|
+
if (hasTrueVirtualProperty) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
54
69
|
try {
|
|
55
70
|
if (!moduleName.value.startsWith('.')) {
|
|
56
71
|
require.resolve(moduleName.value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-jest",
|
|
3
|
-
"version": "29.15.
|
|
3
|
+
"version": "29.15.3",
|
|
4
4
|
"description": "ESLint rules for Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
"@babel/core": "^7.4.4",
|
|
82
82
|
"@babel/preset-env": "^7.4.4",
|
|
83
83
|
"@babel/preset-typescript": "^7.3.3",
|
|
84
|
-
"@commitlint/cli": "^
|
|
85
|
-
"@commitlint/config-conventional": "^
|
|
84
|
+
"@commitlint/cli": "^21.0.0",
|
|
85
|
+
"@commitlint/config-conventional": "^21.0.0",
|
|
86
86
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
|
|
87
|
-
"@schemastore/package": "^0.0
|
|
87
|
+
"@schemastore/package": "^1.0.0",
|
|
88
88
|
"@semantic-release/changelog": "^6.0.0",
|
|
89
89
|
"@semantic-release/git": "^10.0.0",
|
|
90
90
|
"@tsconfig/node20": "^20.0.0",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"eslint-doc-generator": "^3.0.0",
|
|
104
104
|
"eslint-plugin-eslint-plugin": "^6.0.0",
|
|
105
105
|
"eslint-plugin-import": "^2.25.1",
|
|
106
|
-
"eslint-plugin-n": "^
|
|
106
|
+
"eslint-plugin-n": "^18.0.0",
|
|
107
107
|
"eslint-plugin-prettier": "^5.0.0",
|
|
108
108
|
"eslint-remote-tester": "^4.0.0",
|
|
109
109
|
"eslint-remote-tester-repositories": "^2.0.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"is-ci": "^4.0.0",
|
|
112
112
|
"jest": "^30.0.0",
|
|
113
113
|
"jest-runner-eslint": "^2.0.0",
|
|
114
|
-
"lint-staged": "^
|
|
114
|
+
"lint-staged": "^17.0.0",
|
|
115
115
|
"markdown-link-check": "^3.13.7",
|
|
116
116
|
"pinst": "^3.0.0",
|
|
117
117
|
"prettier": "^3.0.0",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"optional": true
|
|
139
139
|
}
|
|
140
140
|
},
|
|
141
|
-
"packageManager": "yarn@4.
|
|
141
|
+
"packageManager": "yarn@4.17.0",
|
|
142
142
|
"engines": {
|
|
143
143
|
"node": "^20.12.0 || ^22.0.0 || >=24.0.0"
|
|
144
144
|
}
|