eslint-plugin-jest 26.4.3 → 26.4.4
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.
|
@@ -81,26 +81,30 @@ const parseJestFnCall = (node, scope) => {
|
|
|
81
81
|
|
|
82
82
|
if (!(chain !== null && chain !== void 0 && chain.length)) {
|
|
83
83
|
return null;
|
|
84
|
-
} //
|
|
84
|
+
} // check that every link in the chain except the last is a member expression
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
if (chain.slice(0, chain.length - 1).some(nod => {
|
|
88
88
|
var _nod$parent;
|
|
89
89
|
|
|
90
|
-
return ((_nod$parent = nod.parent) === null || _nod$parent === void 0 ? void 0 : _nod$parent.type)
|
|
90
|
+
return ((_nod$parent = nod.parent) === null || _nod$parent === void 0 ? void 0 : _nod$parent.type) !== _utils.AST_NODE_TYPES.MemberExpression;
|
|
91
91
|
})) {
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
const [first, ...rest] = chain;
|
|
96
|
-
const
|
|
96
|
+
const lastLink = (0, _utils2.getAccessorValue)(chain[chain.length - 1]); // if we're an `each()`, ensure we're the outer CallExpression (i.e `.each()()`)
|
|
97
97
|
|
|
98
|
-
if (
|
|
98
|
+
if (lastLink === 'each') {
|
|
99
99
|
if (node.callee.type !== _utils.AST_NODE_TYPES.CallExpression && node.callee.type !== _utils.AST_NODE_TYPES.TaggedTemplateExpression) {
|
|
100
100
|
return null;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
if (node.callee.type === _utils.AST_NODE_TYPES.TaggedTemplateExpression && lastLink !== 'each') {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
104
108
|
const resolved = resolveToJestFn(scope, (0, _utils2.getAccessorValue)(first)); // we're not a jest function
|
|
105
109
|
|
|
106
110
|
if (!resolved) {
|