summaryrefslogtreecommitdiff
path: root/tests/testdata/node/unhandled_rejection_web_process.ts
blob: 2aaacfbff791cd074da9c679dbf25e90becb46b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import chalk from "npm:chalk";
import process from "node:process";

console.log(chalk.red("Hello world!"));

process.on("unhandledRejection", (_e) => {
  console.log('process.on("unhandledRejection");');
});

globalThis.addEventListener("unhandledrejection", (_e) => {
  console.log('globalThis.addEventListener("unhandledrejection");');
});

// deno-lint-ignore require-await
(async () => {
  throw new Error("boom!");
})();

setTimeout(() => {
  console.log("Success");
}, 1000);