mirror of
https://github.com/hanzoai/vitest.git
synced 2026-10-30 14:46:34 +00:00
Co-authored-by: hi-ogawa <[email protected]> Co-authored-by: Hiroshi Ogawa <[email protected]> Co-authored-by: Vladimir <[email protected]> Co-authored-by: Hanzo Dev <[email protected]>
12 lines
360 B
TypeScript
12 lines
360 B
TypeScript
import { it } from 'vitest'
|
|
|
|
it('batch microtask', async () => {
|
|
console.log('1')
|
|
await new Promise(resolve => setTimeout(resolve, 100))
|
|
console.log('2')
|
|
const now = Date.now()
|
|
while (Date.now() < now + 50) {}
|
|
console.error('3') // this gets own entry with timestamp after `2`
|
|
console.log('4') // this is batched to the same stdout log as `2`
|
|
})
|