summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2023-10-02 21:13:57 +0900
committerGitHub <noreply@github.com>2023-10-02 14:13:57 +0200
commitd5b6c636b09823bfaa97fe8cd382b654d85d2add (patch)
treeaa09124fc49c1a2365118b31ad4f8bf6b9a9796b /cli
parent6fd2d0841871018bd394ebbdccd4c1f39e5cf773 (diff)
fix(ext/node): don't call undefined nextTick fn (#20724)
The `process` global is not defined in this file. Fixes #20441 --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/tests/integration/node_unit_tests.rs1
-rw-r--r--cli/tests/unit_node/events_test.ts28
2 files changed, 29 insertions, 0 deletions
diff --git a/cli/tests/integration/node_unit_tests.rs b/cli/tests/integration/node_unit_tests.rs
index 05aa4c45a..5489a7255 100644
--- a/cli/tests/integration/node_unit_tests.rs
+++ b/cli/tests/integration/node_unit_tests.rs
@@ -58,6 +58,7 @@ util::unit_test_factory!(
crypto_hash_test = crypto / crypto_hash_test,
crypto_key_test = crypto / crypto_key_test,
crypto_sign_test = crypto / crypto_sign_test,
+ events_test,
fs_test,
http_test,
http2_test,
diff --git a/cli/tests/unit_node/events_test.ts b/cli/tests/unit_node/events_test.ts
new file mode 100644
index 000000000..e341a17cb
--- /dev/null
+++ b/cli/tests/unit_node/events_test.ts
@@ -0,0 +1,28 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
+import { deferred } from "../../../test_util/std/async/deferred.ts";
+import { EventEmitter } from "node:events";
+
+EventEmitter.captureRejections = true;
+
+Deno.test("regression #20441", async () => {
+ const promise = deferred();
+
+ const ee = new EventEmitter();
+
+ ee.on("foo", function () {
+ const p = new Promise((_resolve, reject) => {
+ setTimeout(() => {
+ reject();
+ }, 100);
+ });
+ return p;
+ });
+
+ ee.on("error", function (_) {
+ promise.resolve();
+ });
+
+ ee.emit("foo");
+ await promise;
+});