denoland / denoland/std

[testing/bdd] async `describe`

Open
#4,634 1 comment 6 reactions 0 assignees View on GitHub
suggestion
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**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.:

```ts
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 `await`s 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.