From 63e681832ea46d235960901b49f271dc4b061807 Mon Sep 17 00:00:00 2001 From: Morikko Date: Fri, 26 Oct 2018 15:20:31 +0200 Subject: [PATCH] fix(no-focused-tests): detect usage like 'fit.each()' Fixes #188 --- rules/__tests__/no-focused-tests.test.js | 4 ++++ rules/no-focused-tests.js | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/rules/__tests__/no-focused-tests.test.js b/rules/__tests__/no-focused-tests.test.js index eccc922fb..4690f7d0c 100644 --- a/rules/__tests__/no-focused-tests.test.js +++ b/rules/__tests__/no-focused-tests.test.js @@ -63,5 +63,9 @@ ruleTester.run('no-focused-tests', rule, { code: 'fit()', errors: [{ message: expectedErrorMessage, column: 1, line: 1 }], }, + { + code: 'fit.each()', + errors: [{ message: expectedErrorMessage, column: 1, line: 1 }], + }, ], }); diff --git a/rules/no-focused-tests.js b/rules/no-focused-tests.js index 38e496e3f..d815ce8bb 100644 --- a/rules/no-focused-tests.js +++ b/rules/no-focused-tests.js @@ -30,6 +30,17 @@ module.exports = { const callee = node.callee; if (callee.type === 'MemberExpression') { + if ( + callee.object.type === 'Identifier' && + isCallToFocusedTestFunction(callee.object) + ) { + context.report({ + message: 'Unexpected focused test.', + node: callee.object, + }); + return; + } + if ( callee.object.type === 'MemberExpression' && isCallToTestOnlyFunction(callee.object)