Skip to content

Commit b5c22dc

Browse files
committed
fix(no-alias-methods): handle missing assertion node
Fixes #213
1 parent c281827 commit b5c22dc

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

rules/__tests__/no-alias-methods.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ruleTester.run('no-alias-methods', rule, {
1818
'expect(a).toHaveLastReturnedWith()',
1919
'expect(a).toHaveNthReturnedWith()',
2020
'expect(a).toThrow()',
21+
'expect(a).rejects;',
2122
],
2223

2324
invalid: [

rules/no-alias-methods.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ module.exports = {
4141
targetNode = method(node.parent);
4242
}
4343

44+
if (!targetNode) {
45+
return;
46+
}
47+
4448
// Check if the method used matches any of ours
4549
const methodItem = methodNames.find(
4650
item => item[1] === targetNode.name

0 commit comments

Comments
 (0)