summaryrefslogtreecommitdiff
path: root/tests/specs/node/next_tick_uncaught_exception/main.ts
diff options
context:
space:
mode:
authorsnek <snek@deno.com>2024-10-28 18:16:43 +0100
committerGitHub <noreply@github.com>2024-10-28 18:16:43 +0100
commit4e38fbd0a3e0ca139314e503494a8d4795007d8a (patch)
treedd67b5eee1348e03a688c4ba42b60f42774420b5 /tests/specs/node/next_tick_uncaught_exception/main.ts
parentf61af864df4d7a2513f738ddf2d5fddf79c878af (diff)
fix: report exceptions from nextTick (#26579)
Fixes: https://github.com/denoland/deno/issues/24713 Fixes: https://github.com/denoland/deno/issues/25855
Diffstat (limited to 'tests/specs/node/next_tick_uncaught_exception/main.ts')
-rw-r--r--tests/specs/node/next_tick_uncaught_exception/main.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/specs/node/next_tick_uncaught_exception/main.ts b/tests/specs/node/next_tick_uncaught_exception/main.ts
new file mode 100644
index 000000000..2679d3d54
--- /dev/null
+++ b/tests/specs/node/next_tick_uncaught_exception/main.ts
@@ -0,0 +1,13 @@
+import process from "node:process";
+import { strictEqual } from "node:assert";
+
+const error = new Error("thrown from next tick");
+
+process.on("uncaughtException", (caught) => {
+ strictEqual(caught, error);
+ console.log("caught", caught);
+});
+
+process.nextTick(() => {
+ throw error;
+});