summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/run
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-11-28 23:07:23 +0100
committerGitHub <noreply@github.com>2022-11-28 23:07:23 +0100
commitf526513d74d34ac254aa40ef9b73238cb21c395b (patch)
tree066e2c3685e33f611d2d38b04d49b01e4604573a /cli/tests/testdata/run
parentfd51b2e506f3ea3cc49bfb2bcb19bc684f563f60 (diff)
feat(core): show unresolved promise origin (#16650)
This commit updates unhelpful messages that are raised when event loop stalls on unresolved top-level promises. Instead of "Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promises." and "Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promises." we are now printing a message like: error: Top-level await promise never resolved [SOURCE LINE] ^ at [FUNCTION NAME] ([FILENAME]) eg: error: Top-level await promise never resolved await new Promise((_resolve, _reject) => {}); ^ at <anonymous> (file:///Users/ib/dev/deno/cli/tests/testdata/test/unresolved_promise.ts:1:1) Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
Diffstat (limited to 'cli/tests/testdata/run')
-rw-r--r--cli/tests/testdata/run/top_level_await/circular.out7
-rw-r--r--cli/tests/testdata/run/top_level_await/unresolved.out5
2 files changed, 8 insertions, 4 deletions
diff --git a/cli/tests/testdata/run/top_level_await/circular.out b/cli/tests/testdata/run/top_level_await/circular.out
index 72072071e..c88978961 100644
--- a/cli/tests/testdata/run/top_level_await/circular.out
+++ b/cli/tests/testdata/run/top_level_await/circular.out
@@ -4,6 +4,7 @@ timeout loop 2
timeout loop 3
timeout loop 4
timeout loop 5
-error: Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promises.
-Pending dynamic modules:
-- [WILDCARD]/tla3/b.js
+error: Top-level await promise never resolved
+const mod = await import("./tla3/b.js");
+ ^
+ at <anonymous> ([WILDCARD]/top_level_await/circular.js:5:13)
diff --git a/cli/tests/testdata/run/top_level_await/unresolved.out b/cli/tests/testdata/run/top_level_await/unresolved.out
index d5291f833..1f4ea5d38 100644
--- a/cli/tests/testdata/run/top_level_await/unresolved.out
+++ b/cli/tests/testdata/run/top_level_await/unresolved.out
@@ -1 +1,4 @@
-error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promises.
+error: Top-level await promise never resolved
+await new Promise(() => {});
+^
+ at <anonymous> ([WILDCARD]top_level_await/unresolved.js:1:1)