@@ -144,29 +144,32 @@ test('session stops when browser exits', async ({ cli, server }) => {
144144 expect ( listAfter ) . toContain ( '(no browsers)' ) ;
145145} ) ;
146146
147- test ( 'session stops when temporary socket directory disappears' , async ( { cli, server } ) => {
148- test . skip ( process . platform === 'win32' ) ;
149-
150- // Keep this short because macOS limits Unix socket paths to 103 bytes.
151- const tempDir = await fs . promises . mkdtemp ( path . join ( os . tmpdir ( ) , 'p-' ) ) ;
152- const removedTempDir = tempDir + '.removed' ;
153- try {
154- const { daemonPid } = await cli ( 'open' , server . HELLO_WORLD , {
155- env : {
156- PWTEST_SOCKETS_DIR : '' ,
157- TMPDIR : tempDir ,
158- } ,
159- } ) ;
160- expect ( daemonPid ) . toBeDefined ( ) ;
161- expect ( isProcessAlive ( daemonPid ) ) . toBe ( true ) ;
162-
163- await fs . promises . rename ( tempDir , removedTempDir ) ;
164- await expect . poll ( ( ) => isProcessAlive ( daemonPid ) ) . toBe ( false ) ;
165- } finally {
166- await fs . promises . rm ( tempDir , { force : true , recursive : true } ) ;
167- await fs . promises . rm ( removedTempDir , { force : true , recursive : true } ) ;
168- }
169- } ) ;
147+ for ( const envName of [ 'XDG_RUNTIME_DIR' , 'TMPDIR' ] ) {
148+ test ( `session stops when socket directory in ${ envName } disappears` , async ( { cli, server } ) => {
149+ test . skip ( process . platform === 'win32' ) ;
150+
151+ // Keep this short because macOS limits Unix socket paths to 103 bytes.
152+ const tempDir = await fs . promises . mkdtemp ( path . join ( os . tmpdir ( ) , 'p-' ) ) ;
153+ const removedTempDir = tempDir + '.removed' ;
154+ try {
155+ const { daemonPid } = await cli ( 'open' , server . HELLO_WORLD , {
156+ env : {
157+ PWTEST_SOCKETS_DIR : '' ,
158+ XDG_RUNTIME_DIR : '' ,
159+ [ envName ] : tempDir ,
160+ } ,
161+ } ) ;
162+ expect ( daemonPid ) . toBeDefined ( ) ;
163+ expect ( isProcessAlive ( daemonPid ) ) . toBe ( true ) ;
164+
165+ await fs . promises . rename ( tempDir , removedTempDir ) ;
166+ await expect . poll ( ( ) => isProcessAlive ( daemonPid ) ) . toBe ( false ) ;
167+ } finally {
168+ await fs . promises . rm ( tempDir , { force : true , recursive : true } ) ;
169+ await fs . promises . rm ( removedTempDir , { force : true , recursive : true } ) ;
170+ }
171+ } ) ;
172+ }
170173
171174test ( 'session reopen with different config' , async ( { cli, server } , testInfo ) => {
172175 const config = { browser : { contextOptions : { viewport : { width : 700 , height : 500 } } } } ;
0 commit comments