diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/node_unit_tests.rs | 1 | ||||
-rw-r--r-- | cli/tests/unit_node/events_test.ts | 28 |
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; +}); |