diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-10-14 14:04:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-14 14:04:09 +0200 |
commit | 135053486c4bd112ebd7d0b25c94a8dd346472e6 (patch) | |
tree | 24eae514d8de332a0968de869172f651b30b5078 /cli/tests/integration_tests.rs | |
parent | 10654fa95553866c63a56a7f84c7ec47fb7aac9c (diff) |
fix: top-level-await module execution (#7946)
This commit changes implementation of top-level-await in "deno_core".
Previously promise returned from module evaluation was not awaited,
leading to out-of-order execution of modules that have TLA. It's been
fixed by changing "JsRuntime::mod_evaluate" to be an async function
that resolves when the promise returned from module evaluation also
resolves. When waiting for promise resolution event loop is polled
repeatedly, until there are no more dynamic imports or pending
ops.
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r-- | cli/tests/integration_tests.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 90dc5a4a8..66a83a655 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2421,6 +2421,28 @@ itest!(wasm_unreachable { exit_code: 1, }); +itest!(top_level_await_order { + args: "run --allow-read top_level_await_order.js", + output: "top_level_await_order.out", +}); + +itest!(top_level_await_loop { + args: "run --allow-read top_level_await_loop.js", + output: "top_level_await_loop.out", +}); + +itest!(top_level_await_circular { + args: "run --allow-read top_level_await_circular.js", + output: "top_level_await_circular.out", + exit_code: 1, +}); + +itest!(top_level_await_unresolved { + args: "run top_level_await_unresolved.js", + output: "top_level_await_unresolved.out", + exit_code: 1, +}); + itest!(top_level_await { args: "run --allow-read top_level_await.js", output: "top_level_await.out", |