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

Regression: Duplicate describes can't be run #259

Closed
ffMathy opened this issue Feb 23, 2024 · 5 comments
Closed

Regression: Duplicate describes can't be run #259

ffMathy opened this issue Feb 23, 2024 · 5 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@ffMathy
Copy link
Collaborator

ffMathy commented Feb 23, 2024

Describe the bug
After merging #214, a bug has been introduced for the following scenario where there are duplicate describes:

import { describe, expect, it } from 'vitest'
import { add } from '../src/add'

describe('duplicate describe', () => {
  it('test 1', () => {
    expect(add(1, 1)).toBe(2)
  })
})

describe('duplicate describe', () => {
  it('test 2', () => {
    expect(add(1, 1)).toBe(2)
  })
})

In the above scenario, you can't run "test 2". It will display a "test not found" error. This was not the case before.

To Reproduce
Add the above test and try to run the "test 2" test.

Expected behavior
I expected the test to be run.

Environment
N/A

Additional context
N/A

@ffMathy ffMathy added the p3-minor-bug An edge case that only affects very specific usage (priority) label Feb 23, 2024
@keroxp
Copy link
Contributor

keroxp commented Feb 23, 2024

This is introduced indeed by #214 but I guess it didn't work in previous version. When one case ran from vscode UI, actually both cases ran and wrong statuses were synced. This is because there're no way to distinguish those two blocks based on vitest's test results. UI is built based on the position in the file, but results have no information except their name.

@ffMathy
Copy link
Collaborator Author

ffMathy commented Feb 24, 2024

Are you saying this is fixed by #263?

@keroxp
Copy link
Contributor

keroxp commented Feb 24, 2024

No, I actually started it for this, but they can't resolve this. Issue still exists.

@ffMathy
Copy link
Collaborator Author

ffMathy commented Feb 24, 2024

Ah okay. In my opinion, it's fine if both tests run. That's how it was before, and I guess also how it works when filtering with vitest directly.

@sheremet-va
Copy link
Member

This should be fixed in pre-release 0.5.0 and higher. Note that the extension now requires Vitest 1.4.0 or higher.

Currently it will run both described. We can still do better - I wanted to introduce a feature to run tests in this form in Vitest itself (maybe in 1.5.0):

vitest test-file.test.js:13

@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

3 participants