Skip to content

Commit

Permalink
fix(no-alias-methods): handle missing assertion node
Browse files Browse the repository at this point in the history
Fixes #213
  • Loading branch information
SimenB committed Jan 9, 2019
1 parent c281827 commit b5c22dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions rules/__tests__/no-alias-methods.test.js
Expand Up @@ -18,6 +18,7 @@ ruleTester.run('no-alias-methods', rule, {
'expect(a).toHaveLastReturnedWith()',
'expect(a).toHaveNthReturnedWith()',
'expect(a).toThrow()',
'expect(a).rejects;',
],

invalid: [
Expand Down
4 changes: 4 additions & 0 deletions rules/no-alias-methods.js
Expand Up @@ -41,6 +41,10 @@ module.exports = {
targetNode = method(node.parent);
}

if (!targetNode) {
return;
}

// Check if the method used matches any of ours
const methodItem = methodNames.find(
item => item[1] === targetNode.name
Expand Down

0 comments on commit b5c22dc

Please sign in to comment.