Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vitest/no-done-callback): do not report when inside concurrent describe #321

Conversation

Haberkamp
Copy link
Contributor

What?

I updated the rule to no report when the local Test Context is used inside a test that is inside a concurrent describe block.

Why?

The current implementation reported a false-positive when the scenario described above exists.

How?

The rule goes up its ancestors and checks if it's inside a concurrent test or describe block.

Testing?

You can run the unit tests to check if the rule works. To check that on your local machine:

  1. Active the rule (vitest/no-done-callback)
  2. Copy the following code snippet.
import { describe, it } from 'vitest'; 

describe.concurrent('something', () => {
  it('something', ({ context }) => {
    expect(1).toBe(1);
  });
});

You will not see any linting error as long as the describe block has its .concurrent annotation. Once that gets removed the error will appear.

Copy link
Owner

@veritem veritem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!!

Thanks.

@veritem veritem merged commit 65e8cef into veritem:main Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants