Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 633fedd

Browse files
committed
Include WebSocket in sandbox, fixes #30
1 parent 1c0ed30 commit 633fedd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/modules/ws.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ export class WebSocketsModule extends Module {
183183
MessageEvent,
184184
CloseEvent,
185185
ErrorEvent,
186+
WebSocket,
186187
WebSocketPair,
187188
};
188189
}

test/modules/ws.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,10 @@ test("terminateWebSocket: throws if web socket already closed", async (t) => {
249249
});
250250
});
251251

252-
test("buildSandbox: includes WebSocketPair", (t) => {
252+
test("buildSandbox: includes WebSocket and WebSocketPair", (t) => {
253253
const module = new WebSocketsModule(new NoOpLog());
254254
const sandbox = module.buildSandbox();
255+
t.true(typeof sandbox.WebSocket === "function");
255256
t.true(typeof sandbox.WebSocketPair === "function");
256257
});
257258
test("buildSandbox: sends and responds to web socket messages", async (t) => {

0 commit comments

Comments
 (0)