summaryrefslogtreecommitdiff
path: root/tests/specs/node/next_tick_uncaught_exception/main.ts
blob: 2679d3d54b5cbb98490ccc43780eb9575b4eca1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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;
});