Skip to content

Commit

Permalink
fix(no-focused-tests): detect usage like 'fit.each()'
Browse files Browse the repository at this point in the history
Fixes #188
  • Loading branch information
Morikko authored and SimenB committed Oct 26, 2018
1 parent 9fb09de commit 63e6818
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rules/__tests__/no-focused-tests.test.js
Expand Up @@ -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 }],
},
],
});
11 changes: 11 additions & 0 deletions rules/no-focused-tests.js
Expand Up @@ -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)
Expand Down

0 comments on commit 63e6818

Please sign in to comment.