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

[testing/bdd] async describe #4634

Open
teidesu opened this issue Apr 23, 2024 · 0 comments
Open

[testing/bdd] async describe #4634

teidesu opened this issue Apr 23, 2024 · 0 comments

Comments

@teidesu
Copy link

teidesu commented Apr 23, 2024

Is your feature request related to a problem? Please describe.

in vitest we can use async functions as a callback to describe(), which allows setting up group-related resource, e.g.:

describe('foo', async () => {
  const foo = await createFoo()
  afterAll(() => foo.destroy())
  
  // ... tests ...
})

however describe currently doesn't allow async functions to be passed

Describe the solution you'd like

support async describe callbacks

Describe alternatives you've considered

  • move all awaits to top level - the downside is that group-related stuff stops being grouped
  • initialize everything with a beforeAll hook - the downside is that we have to use non-null assertions for typescript + increases boilerplate
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

No branches or pull requests

1 participant