Skip to content

Commit 6b8f627

Browse files
authored
fix: guard against wait utils without callback (#161)
1 parent fd8a362 commit 6b8f627

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/node-utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@ export function hasThenProperty(node: TSESTree.Node) {
104104
}
105105

106106
export function isArrowFunctionExpression(node: TSESTree.Node): node is TSESTree.ArrowFunctionExpression {
107-
return node.type === 'ArrowFunctionExpression'
107+
return node && node.type === 'ArrowFunctionExpression'
108108
}

tests/lib/rules/prefer-find-by.test.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ ruleTester.run(RULE_NAME, rule, {
5151
code: `
5252
await waitFor(() => expect(${queryMethod}('baz')).toBeInTheDocument());
5353
`
54-
}))
54+
})),
55+
{
56+
code: `
57+
await waitFor();
58+
await wait();
59+
`
60+
}
5561
],
5662
invalid: [
5763
// using reduce + concat 'cause flatMap is not available in node10.x

0 commit comments

Comments
 (0)