Skip to content

Commit

Permalink
fix(prefer-to-contain): check that expect argument is defined before …
Browse files Browse the repository at this point in the history
…use (#542)

* fix(prefer-to-contain): check that expect argument is defined before use

* chore: regenerate `yarn.lock`
  • Loading branch information
G-Rath authored Mar 6, 2020
1 parent c5d7d3b commit 56f909b
Show file tree
Hide file tree
Showing 3 changed files with 530 additions and 412 deletions.
1 change: 1 addition & 0 deletions src/rules/__tests__/prefer-to-contain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const ruleTester = new TSESLint.RuleTester();

ruleTester.run('prefer-to-contain', rule, {
valid: [
'expect().toBe(false);',
'expect(a).toContain(b);',
"expect(a.name).toBe('b');",
'expect(a).toBe(true);',
Expand Down
1 change: 1 addition & 0 deletions src/rules/prefer-to-contain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export default createRule({

if (
!matcher ||
!includesCall ||
(modifier && modifier.name !== ModifierName.not) ||
!isBooleanEqualityMatcher(matcher) ||
!isFixableIncludesCallExpression(includesCall)
Expand Down
Loading

0 comments on commit 56f909b

Please sign in to comment.