summaryrefslogtreecommitdiff
path: root/tests/testdata/node/process_beforeexit_exit_events.ts
diff options
context:
space:
mode:
authorSatya Rohith <me@satyarohith.com>2024-04-16 19:15:41 +0530
committerGitHub <noreply@github.com>2024-04-16 13:45:41 +0000
commit50223c5c532332f4a296b12b027f85429f529690 (patch)
tree75d4494d1ade596038ad52ac0241addcc3a124c2 /tests/testdata/node/process_beforeexit_exit_events.ts
parent0a7f46b8c29d67b579e4ffd4681aa5d0b7e30c6b (diff)
fix(ext/node): dispatch beforeExit/exit events irrespective of listeners (#23382)
Closes https://github.com/denoland/deno/issues/23342 Closes https://github.com/denoland/deno/issues/21757
Diffstat (limited to 'tests/testdata/node/process_beforeexit_exit_events.ts')
-rw-r--r--tests/testdata/node/process_beforeexit_exit_events.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/testdata/node/process_beforeexit_exit_events.ts b/tests/testdata/node/process_beforeexit_exit_events.ts
new file mode 100644
index 000000000..a4c87f27e
--- /dev/null
+++ b/tests/testdata/node/process_beforeexit_exit_events.ts
@@ -0,0 +1,9 @@
+import process from "node:process";
+
+const originalEmit = process.emit;
+process.emit = function (event, ...args) {
+ if (event === "exit" || event === "beforeExit") {
+ console.log(`${event} emitted from processEmit`);
+ }
+ return originalEmit.call(this, event, ...args);
+};