@@ -169,7 +169,6 @@ describe("chrome MCP page parsing", () => {
169169 "--no-usage-statistics" ,
170170 "--experimentalStructuredContent" ,
171171 "--experimental-page-id-routing" ,
172- "--no-usage-statistics" ,
173172 "--userDataDir" ,
174173 "/tmp/brave-profile" ,
175174 ] ) ;
@@ -189,7 +188,6 @@ describe("chrome MCP page parsing", () => {
189188 "--no-usage-statistics" ,
190189 "--experimentalStructuredContent" ,
191190 "--experimental-page-id-routing" ,
192- "--no-usage-statistics" ,
193191 ] ) ;
194192 } ) ;
195193
@@ -206,7 +204,6 @@ describe("chrome MCP page parsing", () => {
206204 "--no-usage-statistics" ,
207205 "--experimentalStructuredContent" ,
208206 "--experimental-page-id-routing" ,
209- "--no-usage-statistics" ,
210207 ] ) ;
211208 } ) ;
212209
@@ -269,7 +266,6 @@ describe("chrome MCP page parsing", () => {
269266 "--no-usage-statistics" ,
270267 "--experimentalStructuredContent" ,
271268 "--experimental-page-id-routing" ,
272- "--no-usage-statistics" ,
273269 ] ) ;
274270 } ) ;
275271
@@ -307,7 +303,7 @@ describe("chrome MCP page parsing", () => {
307303 ] ) ;
308304 } ) ;
309305
310- it ( "runs Windows Chrome MCP tree cleanup before closing the stdio client " , async ( ) => {
306+ it ( "uses Windows taskkill tree cleanup without waiting for SDK stdio close timeout " , async ( ) => {
311307 const session = createFakeSession ( ) ;
312308 Object . assign ( session , { ownsProcessTree : true } ) ;
313309 const closeOrder : string [ ] = [ ] ;
@@ -324,7 +320,23 @@ describe("chrome MCP page parsing", () => {
324320
325321 await ensureChromeMcpAvailable ( "chrome-live" , undefined , { ephemeral : true } ) ;
326322
327- expect ( closeOrder ) . toEqual ( [ "taskkill:123" , "client.close" ] ) ;
323+ expect ( closeOrder ) . toEqual ( [ "taskkill:123" ] ) ;
324+ } ) ;
325+
326+ it ( "falls back to SDK stdio close when Windows taskkill cleanup fails" , async ( ) => {
327+ const session = createFakeSession ( ) ;
328+ Object . assign ( session , { ownsProcessTree : true } ) ;
329+ const closeMock = vi . fn ( ) . mockResolvedValue ( undefined ) ;
330+ session . client . close = closeMock as typeof session . client . close ;
331+ setChromeMcpProcessCleanupDepsForTest ( {
332+ platform : "win32" ,
333+ taskkillProcessTree : vi . fn ( ) . mockRejectedValue ( new Error ( "taskkill failed" ) ) ,
334+ } ) ;
335+ setChromeMcpSessionFactoryForTest ( async ( ) => session ) ;
336+
337+ await ensureChromeMcpAvailable ( "chrome-live" , undefined , { ephemeral : true } ) ;
338+
339+ expect ( closeMock ) . toHaveBeenCalledTimes ( 1 ) ;
328340 } ) ;
329341
330342 it ( "redacts remote CDP URL secrets from attach failures" , async ( ) => {
0 commit comments