mirror of
https://github.com/vitest-dev/vitest.git
synced 2025-12-08 18:26:03 +00:00
* feat: bind expect state to context This fixes calling expect.assertions inside concurrent * refactor: cleanup * chore: fix types * chore: allow not passing expect to getMatcherContext
20 lines
384 B
TypeScript
20 lines
384 B
TypeScript
import { test } from 'vitest'
|
|
|
|
function delay(ms: number) {
|
|
return new Promise(resolve => setTimeout(resolve, ms))
|
|
}
|
|
|
|
test.concurrent('test1', async ({ expect }) => {
|
|
expect.assertions(1)
|
|
await delay(10).then(() => {
|
|
expect(1).eq(1)
|
|
})
|
|
})
|
|
|
|
test.concurrent('test2', async ({ expect }) => {
|
|
expect.assertions(1)
|
|
await delay(100).then(() => {
|
|
expect(2).eq(2)
|
|
})
|
|
})
|