diff --git a/lib/rules/valid-expect.js b/lib/rules/valid-expect.js index b227e5c..cb82216 100644 --- a/lib/rules/valid-expect.js +++ b/lib/rules/valid-expect.js @@ -17,7 +17,8 @@ module.exports = function (context) { } // matcher was not called - if (node.parent && node.parent.parent && node.parent.parent.type !== 'CallExpression') { + if (node.parent && node.parent.parent && node.parent.parent.type !== 'CallExpression' && + node.parent.parent.type !== 'MemberExpression') { context.report(node, 'Matcher was not called') } } diff --git a/test/rules/valid-expect.js b/test/rules/valid-expect.js index 6ba0fd5..4fd3457 100644 --- a/test/rules/valid-expect.js +++ b/test/rules/valid-expect.js @@ -9,7 +9,8 @@ eslintTester.run('valid-expect', rule, { valid: [ 'expect("something").toEqual("else");', 'expect(true).toBeDefined();', - 'expect([1, 2, 3]).toEqual([1, 2, 3]);' + 'expect([1, 2, 3]).toEqual([1, 2, 3]);', + 'expect(undefined).not.toBeDefined();' ], invalid: [