Skip to content

Commit 765eeac

Browse files
authored
fix(expect-expect): Potential false positives for expect-expect and valid-title when using it.scoped (#822)
* fix: simplify condition for skipping certain calls * test: add tests
1 parent f3298e0 commit 765eeac

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/rules/expect-expect.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
9797
if (
9898
node?.callee?.type === AST_NODE_TYPES.MemberExpression &&
9999
node.callee.property.type === AST_NODE_TYPES.Identifier &&
100-
node.callee.property.name === 'extend'
101-
)
102-
return
103-
104-
if (
105-
node?.callee?.type === AST_NODE_TYPES.MemberExpression &&
106-
node.callee.property.type === AST_NODE_TYPES.Identifier &&
107-
node.callee.property.name === 'skip'
100+
['skip', 'extend', 'scoped'].includes(node.callee.property.name)
108101
)
109102
return
110103

tests/expect-expect.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { ruleTester } from './ruleTester'
55
ruleTester.run(RULE_NAME, rule, {
66
valid: [
77
'test.skip("skipped test", () => {})',
8+
'it.skip("skipped test", () => {})',
9+
'test.scoped({ dependency: "new" })',
10+
'it.scoped({ dependency: "new" })',
811
'it.todo("will test something eventually")',
912
'test.todo("will test something eventually")',
1013
"['x']();",

0 commit comments

Comments
 (0)