summaryrefslogtreecommitdiff
path: root/tests/specs
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
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')
-rw-r--r--tests/specs/node/next_tick_uncaught_exception/__test__.jsonc4
-rw-r--r--tests/specs/node/next_tick_uncaught_exception/main.out2
-rw-r--r--tests/specs/node/next_tick_uncaught_exception/main.ts13
3 files changed, 19 insertions, 0 deletions
diff --git a/tests/specs/node/next_tick_uncaught_exception/__test__.jsonc b/tests/specs/node/next_tick_uncaught_exception/__test__.jsonc
new file mode 100644
index 000000000..5517e693d
--- /dev/null
+++ b/tests/specs/node/next_tick_uncaught_exception/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "run main.ts",
+ "output": "main.out"
+}
diff --git a/tests/specs/node/next_tick_uncaught_exception/main.out b/tests/specs/node/next_tick_uncaught_exception/main.out
new file mode 100644
index 000000000..45b756515
--- /dev/null
+++ b/tests/specs/node/next_tick_uncaught_exception/main.out
@@ -0,0 +1,2 @@
+caught Error: thrown from next tick
+ at file:///[WILDCARD]/specs/node/next_tick_uncaught_exception/main.ts:4:15
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;
+});