chore: fix no-flaky-assertions not working withing .toPass callbacks

This commit is contained in:
Alessio Gravili
2024-03-22 15:41:10 -04:00
parent 3a9b230aef
commit cf8ac7e8b3

View File

@@ -82,6 +82,19 @@ module.exports = {
return false
}
function hasExpectPollOrToPassInParentChain(node) {
let ancestor = node
while (ancestor) {
if (isExpectPollOrToPass(ancestor)) {
return true
}
ancestor = ancestor.parent
}
return false
}
return {
CallExpression(node) {
// node.callee is MemberExpressiom
@@ -90,6 +103,10 @@ module.exports = {
return
}
if (hasExpectPollOrToPassInParentChain(node)) {
return
}
context.report({
node: node.callee.property,
message: