Skip to content

Commit 962defb

Browse files
authored
fix(no-identical-title): FP when using test.for (#825)
* fix: improve condition for skipping certain function calls * test: add tests
1 parent 5e5a64b commit 962defb

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/rules/no-identical-title.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ export default createEslintRule<Options, MESSAGE_ID>({
5454
if (vitestFnCall.name === 'describe' || vitestFnCall.name === 'suite')
5555
stack.push(newDescribeContext())
5656

57-
if (vitestFnCall.members.find((s) => isSupportedAccessor(s, 'each')))
57+
if (
58+
vitestFnCall.members.some((member) =>
59+
['each', 'for'].some((accessor) =>
60+
isSupportedAccessor(member, accessor),
61+
),
62+
)
63+
)
5864
return
5965

6066
const [argument] = node.arguments

tests/no-identical-title.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ ruleTester.run(RULE_NAME, rule, {
3232
test('grand child 1', () => {})
3333
})
3434
})
35+
`,
36+
`
37+
test.each([1, 2])('%s', () => {
38+
})
39+
test.each([1, 2])('%s', () => {
40+
})
41+
`,
42+
`
43+
test.for([1,2])('%s', () => {
44+
})
45+
test.for([1,2])('%s', () => {
46+
})
3547
`,
3648
],
3749
invalid: [

0 commit comments

Comments
 (0)