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

Multiple async describe causes some test to not be run. #703

Closed
6 tasks done
MonsieurMan opened this issue Feb 8, 2022 · 5 comments · Fixed by #746 or #750
Closed
6 tasks done

Multiple async describe causes some test to not be run. #703

MonsieurMan opened this issue Feb 8, 2022 · 5 comments · Fixed by #746 or #750

Comments

@MonsieurMan
Copy link

Describe the bug

The bug is quite strange, when using multiple nested async describe, some test can be skipped for no apparent reason.

As pointed out in the repro comments, commenting some describes make the previously skipped test to run.

There is no part of the form to do it, so, thank you guys a lot, that is amazing work you are doing here! 🚀

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-trh7ej?file=test/suite.test.ts

I isolated a minimal repro with only three describe and an async function using a timeout.

System Info

See provided StackBlitz.

Used Package Manager

npm

Validations

@Demivan
Copy link
Member

Demivan commented Feb 9, 2022

Is this supported by Jest? I only see one closed merge request in Jest saying that they will not support it.

You can use async beforeAll and beforeEach in describe and don't mark describe as async.

@sheremet-va
Copy link
Member

Is this supported by Jest? I only see one closed merge request in Jest saying that they will not support it.

You can use async beforeAll and beforeEach in describe and don't mark describe as async.

Agree, describe should not be async.

@MonsieurMan
Copy link
Author

@Demivan, it makes sense. In this case, shouldn't the type SuiteFactory here :

export type SuiteFactory = (test: (name: string, fn: TestFunction) => void) => Awaitable<void>

be changed to not accept asynchronous functions?

@MonsieurMan
Copy link
Author

To sum up for everyone. @antfu, if I understand #750 correctly, async describe will be supported? 🚀

@sheremet-va
Copy link
Member

To sum up for everyone. @antfu, if I understand #750 correctly, async describe will be supported? 🚀

Yes, async describe is supported in Vitest, unlike Jest.

chaii3 pushed a commit to chaii3/vitest that referenced this issue May 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants