aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/bun.js/modules/EventsModule.h4
-rw-r--r--test/bun.js/event-emitter.test.ts11
2 files changed, 13 insertions, 2 deletions
diff --git a/src/bun.js/modules/EventsModule.h b/src/bun.js/modules/EventsModule.h
index 00966b858..7d53ff838 100644
--- a/src/bun.js/modules/EventsModule.h
+++ b/src/bun.js/modules/EventsModule.h
@@ -32,6 +32,10 @@ inline void generateEventsSourceCode(JSC::JSGlobalObject *lexicalGlobalObject,
exportValues.append(JSC::JSFunction::create(
vm, lexicalGlobalObject, 0, MAKE_STATIC_STRING_IMPL("on"),
Events_functionOn, ImplementationVisibility::Public));
+ exportNames.append(
+ JSC::Identifier::fromString(vm, "captureRejectionSymbol"_s));
+ exportValues.append(Symbol::create(
+ vm, vm.symbolRegistry().symbolForKey("nodejs.rejection"_s)));
JSFunction *eventEmitterModuleCJS =
jsCast<JSFunction *>(WebCore::JSEventEmitter::getConstructor(
diff --git a/test/bun.js/event-emitter.test.ts b/test/bun.js/event-emitter.test.ts
index f7c73e66a..98ea17d5d 100644
--- a/test/bun.js/event-emitter.test.ts
+++ b/test/bun.js/event-emitter.test.ts
@@ -1,11 +1,18 @@
-import { test, describe, expect } from "bun:test";
+import { test, describe, expect, it } from "bun:test";
import fs from "node:fs";
// this is also testing that imports with default and named imports in the same statement work
// our transpiler transform changes this to a var with import.meta.require
-import EventEmitter, { getEventListeners } from "node:events";
+import EventEmitter, {
+ getEventListeners,
+ captureRejectionSymbol,
+} from "node:events";
describe("EventEmitter", () => {
+ it("captureRejectionSymbol", () => {
+ expect(EventEmitter.captureRejectionSymbol).toBeDefined();
+ expect(captureRejectionSymbol).toBeDefined();
+ });
test("getEventListeners", () => {
expect(getEventListeners(new EventEmitter(), "hey").length).toBe(0);
});