@@ -77,22 +77,18 @@ describe("ServerService.startServer", () => {
7777 }
7878
7979 test ( "cleans up server when lockfile acquisition fails" , async ( ) => {
80- // Skip on Windows where chmod doesn't work the same way
81- if ( process . platform === "win32" ) {
82- return ;
83- }
84-
8580 const service = new ServerService ( ) ;
8681
87- // Make muxHome read-only so lockfile.acquire() will fail
88- await fs . chmod ( tempDir , 0o444 ) ;
82+ // Make muxHome a file (not a directory) so lockfile.acquire fails deterministically.
83+ const muxHomeFile = path . join ( tempDir , "not-a-dir" ) ;
84+ await fs . writeFile ( muxHomeFile , "not a directory" ) ;
8985
9086 let thrownError : Error | null = null ;
9187
9288 try {
9389 // Start server - this should fail when trying to write lockfile
9490 await service . startServer ( {
95- muxHome : tempDir ,
91+ muxHome : muxHomeFile ,
9692 context : stubContext as ORPCContext ,
9793 authToken : "test-token" ,
9894 port : 0 , // random port
@@ -103,7 +99,7 @@ describe("ServerService.startServer", () => {
10399
104100 // Verify that an error was thrown
105101 expect ( thrownError ) . not . toBeNull ( ) ;
106- expect ( thrownError ! . message ) . toMatch ( / E A C C E S | p e r m i s s i o n d e n i e d / i) ;
102+ expect ( thrownError ! . message ) . toMatch ( / E N O T D I R | n o t a d i r e c t o r y / i) ;
107103
108104 // Verify the server is NOT left running
109105 expect ( service . isServerRunning ( ) ) . toBe ( false ) ;
0 commit comments