summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/node/unhandled_rejection_web.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/testdata/node/unhandled_rejection_web.ts')
-rw-r--r--cli/tests/testdata/node/unhandled_rejection_web.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/cli/tests/testdata/node/unhandled_rejection_web.ts b/cli/tests/testdata/node/unhandled_rejection_web.ts
new file mode 100644
index 000000000..396c58c2a
--- /dev/null
+++ b/cli/tests/testdata/node/unhandled_rejection_web.ts
@@ -0,0 +1,17 @@
+import chalk from "npm:chalk";
+
+console.log(chalk.red("Hello world!"));
+
+globalThis.addEventListener("unhandledrejection", (e) => {
+ console.log("Handled the promise rejection");
+ e.preventDefault();
+});
+
+// deno-lint-ignore require-await
+(async () => {
+ throw new Error("boom!");
+})();
+
+setTimeout(() => {
+ console.log("Success");
+}, 1000);