Skip to content

[testing/bdd] async describe #4634

@teidesu

Description

@teidesu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    suggestiona suggestion yet to be agreed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions