summaryrefslogtreecommitdiff
path: root/cli/tests/run_tests.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-12-23 19:46:24 +0100
committerGitHub <noreply@github.com>2022-12-23 19:46:24 +0100
commit208c91b68f4ae1b59e65acbde3de729e7058bb5e (patch)
treeaa0faab20715baee85b571b151426bf832231eb7 /cli/tests/run_tests.rs
parent2a61b5fdd444c4b6f47f0e0bfbafe0bd26789d68 (diff)
fix(core): run macrotasks and next ticks after polling dynamic imports (#17173)
This commit fixes handling of rejected promises in dynamic imports evaluation. Previously we were running callbacks for next ticks and macrotasks _before_ polling dynamic imports and checked for unhandled rejections immediately after. This is wrong, as `unhandledrejection` event is dispatched and its callbacks are run as macrotasks. This commit changes order of actions performed by the event loop to following: - poll async ops - poll dynamic imports - run next tick callbacks - run macrotask callbacks - check for unhandled promise rejections
Diffstat (limited to 'cli/tests/run_tests.rs')
-rw-r--r--cli/tests/run_tests.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/tests/run_tests.rs b/cli/tests/run_tests.rs
index 092546aaf..d90a48fbb 100644
--- a/cli/tests/run_tests.rs
+++ b/cli/tests/run_tests.rs
@@ -2945,6 +2945,19 @@ mod run {
output: "run/unhandled_rejection_sync_error.ts.out",
});
+ // Regression test for https://github.com/denoland/deno/issues/15661
+ itest!(unhandled_rejection_dynamic_import {
+ args: "run --allow-read run/unhandled_rejection_dynamic_import/main.ts",
+ output: "run/unhandled_rejection_dynamic_import/main.ts.out",
+ exit_code: 1,
+ });
+
+ // Regression test for https://github.com/denoland/deno/issues/16909
+ itest!(unhandled_rejection_dynamic_import2 {
+ args: "run --allow-read run/unhandled_rejection_dynamic_import2/main.ts",
+ output: "run/unhandled_rejection_dynamic_import2/main.ts.out",
+ });
+
itest!(nested_error {
args: "run run/nested_error.ts",
output: "run/nested_error.ts.out",