From c7c767782538243ded64742dca9b34d6af74d62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 6 Oct 2020 10:18:22 +0200 Subject: fix(core): module execution with top level await (#7672) This commit fixes implementation of top level await in "deno_core". Previously promise returned from module execution was ignored causing to execute modules out-of-order. With this commit promise returned from module execution is stored on "JsRuntime" and event loop is polled until the promise resolves. --- cli/tests/integration_tests.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cli/tests/integration_tests.rs') diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 8e2007b42..9ad7bac8c 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2662,6 +2662,16 @@ itest!(ignore_require { exit_code: 0, }); +itest!(top_level_await_bug { + args: "run --allow-read top_level_await_bug.js", + output: "top_level_await_bug.out", +}); + +itest!(top_level_await_bug2 { + args: "run --allow-read top_level_await_bug2.js", + output: "top_level_await_bug2.out", +}); + #[test] fn cafile_env_fetch() { use deno_core::url::Url; -- cgit v1.2.3