Skip to content

Commit

Permalink
fix(vitest/no-done-callback): do not report accesssing of text contex…
Browse files Browse the repository at this point in the history
…t when test runs concurrently (#313)
  • Loading branch information
Haberkamp authored Dec 8, 2023
1 parent 864205b commit b7eb2ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rules/no-done-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export default createEslintRule<Options, MessageIds>({
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)

Expand Down
2 changes: 2 additions & 0 deletions tests/no-done-callback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {})',
Expand Down

0 comments on commit b7eb2ce

Please sign in to comment.