MCPcopy Create free account
hub / github.com/github/copilot-sdk / waitForEvent

Function waitForEvent

nodejs/test/e2e/multi-client.e2e.test.ts:52–69  ·  view source on GitHub ↗
(
        session: { on: (handler: (event: SessionEvent) => void) => () => void },
        type: SessionEvent["type"],
        label: string
    )

Source from the content-addressed store, hash-verified

50 }
51
52 function waitForEvent(
53 session: { on: (handler: (event: SessionEvent) => void) => () => void },
54 type: SessionEvent["type"],
55 label: string
56 ): Promise<SessionEvent> {
57 return withTimeout(
58 new Promise<SessionEvent>((resolve) => {
59 const unsub = session.on((event) => {
60 if (event.type === type) {
61 unsub();
62 resolve(event);
63 }
64 });
65 }),
66 EVENT_TIMEOUT_MS,
67 label
68 );
69 }
70
71 it("both clients see tool request and completion events", async () => {
72 const tool = defineTool("magic_number", {

Callers 1

Calls 2

withTimeoutFunction · 0.70
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…