eslint-plugin-jest 27.1.0 → 27.1.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.
|
@@ -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
|