Skip to content

Commit b7eb2ce

Browse files
authoredDec 8, 2023
fix(vitest/no-done-callback): do not report accesssing of text context when test runs concurrently (#313)
1 parent 864205b commit b7eb2ce

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
 

‎src/rules/no-done-callback.ts

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export default createEslintRule<Options, MessageIds>({
4646
if (isVitestEach && node.callee.type !== AST_NODE_TYPES.TaggedTemplateExpression)
4747
return
4848

49+
const isVitestConcurrent = getNodeName(node.callee)?.endsWith('.concurrent') ?? false;
50+
if (isVitestConcurrent) return
51+
4952
const callback = findCallbackArg(node, isVitestEach, context)
5053
const callbackArgIndex = Number(isVitestEach)
5154

‎tests/no-done-callback.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ ruleTester.run(RULE_NAME, rule, {
1313
'it.each``("something", ({ a, b }) => {})',
1414
'it.each([])("something", (a, b) => { a(); b(); })',
1515
'it.each``("something", ({ a, b }) => { a(); b(); })',
16+
'it.concurrent("something", (context) => {})',
17+
'it.concurrent("something", ({ expect }) => {})',
1618
'test("something", async function () {})',
1719
'test("something", someArg)',
1820
'beforeEach(() => {})',

0 commit comments

Comments
 (0)
Please sign in to comment.