fix await bug

This commit is contained in:
Dmitry Vasilev
2024-02-12 16:01:52 +08:00
parent dc921b2a08
commit 1139151ef2
3 changed files with 64 additions and 18 deletions

View File

@@ -3695,6 +3695,18 @@ const y = x()`
)
}),
test('async/await await rejected Promise fn call', async () => {
await assert_code_error_async(
`
async function test() {
await Promise.reject('boom')
}
await test()
`,
'boom'
)
}),
test('async/await promise rejected with null', async () => {
await assert_code_error_async(
`await Promise.reject()`,
@@ -3872,6 +3884,19 @@ const y = x()`
)
}),
test('async/await await bug', async () => {
const code = `
const x = () => {}
const test = async () => {
await 1
x()
}
await Promise.all([test(), test()])
`
const i = await test_initial_state_async(code, code.indexOf('await 1'))
assert_value_explorer(i ,1)
}),
test('async/await edit', async () => {
const code = `
const f = async () => {