Skip to content

Commit 5433734

Browse files
Merge commit 'af53100c2a' into fix/desktop-tab-detach-during-setup
2 parents 8a5f6d9 + af53100 commit 5433734

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎apps/server/src/preview/DesktopBrowserChannel.test.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
22
import * as NodeStream from "@effect/platform-node/NodeStream";
33
import { expect, it } from "@effect/vitest";
44
import * as Effect from "effect/Effect";
5-
import * as Exit from "effect/Exit";
65
import * as Layer from "effect/Layer";
76
import * as Queue from "effect/Queue";
8-
import * as Scope from "effect/Scope";
97
import * as Stream from "effect/Stream";
108
import { vi } from "vite-plus/test";
119

@@ -81,9 +79,9 @@ it.live("closes a tab's relay connection when the desktop detaches the tab", ()
8179

8280
yield* send({ type: "attached", ...key });
8381
yield* channel.awaitAttached(key, "5 seconds");
84-
const scope = yield* Scope.make();
85-
const url = yield* channel.endpoint(key).pipe(Scope.provide(scope));
82+
const url = yield* channel.endpoint(key);
8683
const socket = new WebSocket(url);
84+
yield* Effect.addFinalizer(() => Effect.sync(() => socket.close()));
8785
const closed = new Promise<void>((resolve) =>
8886
socket.addEventListener("close", () => resolve()),
8987
);
@@ -94,8 +92,8 @@ it.live("closes a tab's relay connection when the desktop detaches the tab", ()
9492
// Playwright waits on this socket for CDP replies; it must learn the tab is gone.
9593
yield* send({ type: "detached", ...key });
9694
yield* Effect.promise(() => closed).pipe(Effect.timeout("2 seconds"));
97-
yield* Scope.close(scope, Exit.void);
9895
}).pipe(
96+
Effect.scoped,
9997
Effect.provide(
10098
DesktopBrowserChannel.layer.pipe(
10199
Layer.provide(

0 commit comments

Comments
 (0)