Fix e2e workspace-setup helper: use Node WebSocket factory
The workspace-setup helper was creating DaemonClient without providing a webSocketFactory, causing failures on Node 20 where globalThis.WebSocket is not available. Use createNodeWebSocketFactory() like all other e2e helpers do.
This commit is contained in:
@@ -5,6 +5,7 @@ import { pathToFileURL } from "node:url";
|
|||||||
import { expect, type Page } from "@playwright/test";
|
import { expect, type Page } from "@playwright/test";
|
||||||
import { parseHostWorkspaceRouteFromPathname } from "../../src/utils/host-routes";
|
import { parseHostWorkspaceRouteFromPathname } from "../../src/utils/host-routes";
|
||||||
import { gotoAppShell } from "./app";
|
import { gotoAppShell } from "./app";
|
||||||
|
import { createNodeWebSocketFactory, type NodeWebSocketFactory } from "./node-ws-factory";
|
||||||
import type { SessionOutboundMessage } from "@server/shared/messages";
|
import type { SessionOutboundMessage } from "@server/shared/messages";
|
||||||
|
|
||||||
type WorkspaceSetupDaemonClient = {
|
type WorkspaceSetupDaemonClient = {
|
||||||
@@ -73,6 +74,7 @@ async function loadDaemonClientConstructor(): Promise<
|
|||||||
url: string;
|
url: string;
|
||||||
clientId: string;
|
clientId: string;
|
||||||
clientType: "cli";
|
clientType: "cli";
|
||||||
|
webSocketFactory?: NodeWebSocketFactory;
|
||||||
}) => WorkspaceSetupDaemonClient
|
}) => WorkspaceSetupDaemonClient
|
||||||
> {
|
> {
|
||||||
const repoRoot = path.resolve(process.cwd(), "../..");
|
const repoRoot = path.resolve(process.cwd(), "../..");
|
||||||
@@ -84,6 +86,7 @@ async function loadDaemonClientConstructor(): Promise<
|
|||||||
url: string;
|
url: string;
|
||||||
clientId: string;
|
clientId: string;
|
||||||
clientType: "cli";
|
clientType: "cli";
|
||||||
|
webSocketFactory?: NodeWebSocketFactory;
|
||||||
}) => WorkspaceSetupDaemonClient;
|
}) => WorkspaceSetupDaemonClient;
|
||||||
};
|
};
|
||||||
return mod.DaemonClient;
|
return mod.DaemonClient;
|
||||||
@@ -91,10 +94,12 @@ async function loadDaemonClientConstructor(): Promise<
|
|||||||
|
|
||||||
export async function connectWorkspaceSetupClient(): Promise<WorkspaceSetupDaemonClient> {
|
export async function connectWorkspaceSetupClient(): Promise<WorkspaceSetupDaemonClient> {
|
||||||
const DaemonClient = await loadDaemonClientConstructor();
|
const DaemonClient = await loadDaemonClientConstructor();
|
||||||
|
const webSocketFactory = createNodeWebSocketFactory();
|
||||||
const client = new DaemonClient({
|
const client = new DaemonClient({
|
||||||
url: getDaemonWsUrl(),
|
url: getDaemonWsUrl(),
|
||||||
clientId: `workspace-setup-${randomUUID()}`,
|
clientId: `workspace-setup-${randomUUID()}`,
|
||||||
clientType: "cli",
|
clientType: "cli",
|
||||||
|
webSocketFactory,
|
||||||
});
|
});
|
||||||
await client.connect();
|
await client.connect();
|
||||||
return client;
|
return client;
|
||||||
|
|||||||
Reference in New Issue
Block a user