eslint-plugin-jest 27.1.0 → 27.1.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.
|
@@ -11,7 +11,7 @@ You may wish to restrict the use of specific `jest` methods.
|
|
|
11
11
|
## Rule details
|
|
12
12
|
|
|
13
13
|
This rule checks for the usage of specific methods on the `jest` object, which
|
|
14
|
-
can be used to disallow
|
|
14
|
+
can be used to disallow certain patterns such as spies and mocks.
|
|
15
15
|
|
|
16
16
|
## Options
|
|
17
17
|
|
|
@@ -21,7 +21,11 @@ const isNullEqualityMatcher = expectFnCall => isNullLiteral((0, _utils2.getFirst
|
|
|
21
21
|
const isFirstArgumentIdentifier = (expectFnCall, name) => (0, _utils2.isIdentifier)((0, _utils2.getFirstMatcherArg)(expectFnCall), name);
|
|
22
22
|
|
|
23
23
|
const shouldUseToBe = expectFnCall => {
|
|
24
|
-
|
|
24
|
+
let firstArg = (0, _utils2.getFirstMatcherArg)(expectFnCall);
|
|
25
|
+
|
|
26
|
+
if (firstArg.type === _utils.AST_NODE_TYPES.UnaryExpression && firstArg.operator === '-') {
|
|
27
|
+
firstArg = firstArg.argument;
|
|
28
|
+
}
|
|
25
29
|
|
|
26
30
|
if (firstArg.type === _utils.AST_NODE_TYPES.Literal) {
|
|
27
31
|
// regex literals are classed as literals, but they're actually objects
|
|
@@ -266,7 +266,7 @@ var _default = (0, _utils2.createRule)({
|
|
|
266
266
|
recommended: 'error'
|
|
267
267
|
},
|
|
268
268
|
messages: {
|
|
269
|
-
expectInFloatingPromise:
|
|
269
|
+
expectInFloatingPromise: 'This promise should either be returned or awaited to ensure the expects in its chain are called'
|
|
270
270
|
},
|
|
271
271
|
type: 'suggestion',
|
|
272
272
|
schema: []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-jest",
|
|
3
|
-
"version": "27.1.
|
|
3
|
+
"version": "27.1.2",
|
|
4
4
|
"description": "ESLint rules for Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"optional": true
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
|
-
"packageManager": "yarn@3.2.
|
|
157
|
+
"packageManager": "yarn@3.2.4",
|
|
158
158
|
"engines": {
|
|
159
159
|
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
|
160
160
|
}
|