diff options
Diffstat (limited to 'tests/specs/node/next_tick_uncaught_exception')
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; +}); |