From b7eb2ce3c9ed3380b019acf391a74e3e40368957 Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Sat, 9 Dec 2023 00:41:43 +0100 Subject: [PATCH] fix(vitest/no-done-callback): do not report accesssing of text context when test runs concurrently (#313) --- src/rules/no-done-callback.ts | 3 +++ tests/no-done-callback.test.ts | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/rules/no-done-callback.ts b/src/rules/no-done-callback.ts index ede3745..2e6b41b 100644 --- a/src/rules/no-done-callback.ts +++ b/src/rules/no-done-callback.ts @@ -46,6 +46,9 @@ export default createEslintRule({ if (isVitestEach && node.callee.type !== AST_NODE_TYPES.TaggedTemplateExpression) return + const isVitestConcurrent = getNodeName(node.callee)?.endsWith('.concurrent') ?? false; + if (isVitestConcurrent) return + const callback = findCallbackArg(node, isVitestEach, context) const callbackArgIndex = Number(isVitestEach) diff --git a/tests/no-done-callback.test.ts b/tests/no-done-callback.test.ts index 38977a8..5362719 100644 --- a/tests/no-done-callback.test.ts +++ b/tests/no-done-callback.test.ts @@ -13,6 +13,8 @@ ruleTester.run(RULE_NAME, rule, { 'it.each``("something", ({ a, b }) => {})', 'it.each([])("something", (a, b) => { a(); b(); })', 'it.each``("something", ({ a, b }) => { a(); b(); })', + 'it.concurrent("something", (context) => {})', + 'it.concurrent("something", ({ expect }) => {})', 'test("something", async function () {})', 'test("something", someArg)', 'beforeEach(() => {})',