vitest/test/core/test/concurrent.spec.ts
Vladimir 35ab058bac
feat: bind expect state to context (#1468)
* 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
2022-06-13 10:21:21 +03:00

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)
})
})