Skip to content

Commit 63e6818

Browse files
MorikkoSimenB
authored andcommitted
fix(no-focused-tests): detect usage like 'fit.each()'
Fixes #188
1 parent 9fb09de commit 63e6818

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

rules/__tests__/no-focused-tests.test.js

+4
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,9 @@ ruleTester.run('no-focused-tests', rule, {
6363
code: 'fit()',
6464
errors: [{ message: expectedErrorMessage, column: 1, line: 1 }],
6565
},
66+
{
67+
code: 'fit.each()',
68+
errors: [{ message: expectedErrorMessage, column: 1, line: 1 }],
69+
},
6670
],
6771
});

rules/no-focused-tests.js

+11
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ module.exports = {
3030
const callee = node.callee;
3131

3232
if (callee.type === 'MemberExpression') {
33+
if (
34+
callee.object.type === 'Identifier' &&
35+
isCallToFocusedTestFunction(callee.object)
36+
) {
37+
context.report({
38+
message: 'Unexpected focused test.',
39+
node: callee.object,
40+
});
41+
return;
42+
}
43+
3344
if (
3445
callee.object.type === 'MemberExpression' &&
3546
isCallToTestOnlyFunction(callee.object)

0 commit comments

Comments
 (0)