Skip to content

Commit

Permalink
fix: error thrown on expect()
Browse files Browse the repository at this point in the history
  • Loading branch information
DianaSuvorova authored and Nicolas Fernandez committed Jul 28, 2017
1 parent 80bb8cd commit a1c01e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/prefer-jasmine-matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function (context) {
suiteDepth++
} else if (node.callee.name === 'expect' && suiteDepth > 0) {
var expectNode = node.arguments && node.arguments[0]
if (expectNode.type === 'BinaryExpression' && operators.indexOf(expectNode.operator) > -1) {
if (expectNode && expectNode.type === 'BinaryExpression' && operators.indexOf(expectNode.operator) > -1) {
context.report({
message: 'Prefer jasmine matcher instead of comparison',
node
Expand Down
8 changes: 8 additions & 0 deletions test/rules/prefer-jasmine-matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ eslintTester.run('prefer jasmine matcher', rule, {
' expect(a instanceof String).toBe(true)',
' });',
'});'
]),
// issue #136
linesToCode([
'describe("", function() {',
' it("", function(){',
' expect()',
' });',
'});'
])
],
invalid: [
Expand Down

0 comments on commit a1c01e2

Please sign in to comment.