import { setTimeout } from 'timers/promises'
import { test } from 'uvu'
import * as assert from 'uvu/assert'
await setTimeout(10)
test('Math.sqrt()', () => {
assert.is(Math.sqrt(4), 2)
assert.is(Math.sqrt(144), 12)
assert.is(Math.sqrt(2), Math.SQRT2)
})
test.run()
➜ node test.js
Total: 0
Passed: 0
Skipped: 0
Duration: 0.45ms
If I remove the top-level await it works as expected. It seems like the tests are only collected in the sync context, but since we are explicitly calling test.run() in each file, should we expect uvu to work with top-level await and also the async context?
// same as top-level await
import { test } from 'uvu'
import * as assert from 'uvu/assert'
setTimeout(() => {
test('Math.sqrt()', () => {
assert.is(Math.sqrt(4), 2)
assert.is(Math.sqrt(144), 12)
assert.is(Math.sqrt(2), Math.SQRT2)
})
test.run()
})
If I remove the top-level await it works as expected. It seems like the tests are only collected in the sync context, but since we are explicitly calling
test.run()in each file, should we expectuvuto work with top-level await and also the async context?