summaryrefslogtreecommitdiff
path: root/cli/tests/top_level_await_bug_nested.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-10-06 10:18:22 +0200
committerGitHub <noreply@github.com>2020-10-06 10:18:22 +0200
commitc7c767782538243ded64742dca9b34d6af74d62d (patch)
treee0c4cdaac58f56b09c54476d73f3d5feb419e731 /cli/tests/top_level_await_bug_nested.js
parent40324ff74816a99ea061929ece1c6a4ff3078bc3 (diff)
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.
Diffstat (limited to 'cli/tests/top_level_await_bug_nested.js')
-rw-r--r--cli/tests/top_level_await_bug_nested.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/cli/tests/top_level_await_bug_nested.js b/cli/tests/top_level_await_bug_nested.js
new file mode 100644
index 000000000..894f0de2d
--- /dev/null
+++ b/cli/tests/top_level_await_bug_nested.js
@@ -0,0 +1,5 @@
+const sleep = (n) => new Promise((r) => setTimeout(r, n));
+
+await sleep(100);
+
+export default 1;