@@ -2,10 +2,8 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
22import * as NodeStream from "@effect/platform-node/NodeStream" ;
33import { expect , it } from "@effect/vitest" ;
44import * as Effect from "effect/Effect" ;
5- import * as Exit from "effect/Exit" ;
65import * as Layer from "effect/Layer" ;
76import * as Queue from "effect/Queue" ;
8- import * as Scope from "effect/Scope" ;
97import * as Stream from "effect/Stream" ;
108import { 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