eslint-plugin-jest 29.15.1 → 29.15.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.
|
@@ -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
|
|
@@ -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.2",
|
|
4
4
|
"description": "ESLint rules for Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"@commitlint/cli": "^20.0.0",
|
|
85
85
|
"@commitlint/config-conventional": "^20.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",
|