@@ -201,18 +201,16 @@ describe.each(OPTIONS)("DevEnv (remote: $remote)", ({ remote }) => {
201201 // through a worker (InspectorProxyWorker) which hits the limit (without the fix, compatibilityFlags:["increase_websocket_message_size"])
202202 // By logging a large string we can verify that the inspector messages are being proxied successfully.
203203 it ( "InspectorProxyWorker can proxy messages > 1MB" , async ( t ) => {
204- t . onTestFinished ( ( ) => worker ?. dispose ( ) ) ;
205-
206- const originalConsoleLog = console . log ;
207- const mockConsoleLogImpl = ( message : unknown , ...args : unknown [ ] ) => {
208- if ( typeof message === "string" && / z + / . test ( message ) ) {
209- return ; // don't log chunks of the large string
210- }
211-
212- originalConsoleLog ( message , ...args ) ;
213- } ;
214- vi . spyOn ( console , "info" ) . mockImplementation ( mockConsoleLogImpl ) ;
215- vi . spyOn ( console , "log" ) . mockImplementation ( mockConsoleLogImpl ) ;
204+ const consoleInfoSpy = vi
205+ . spyOn ( console , "info" )
206+ . mockImplementation ( ( ) => { } ) ;
207+ const consoleLogSpy = vi . spyOn ( console , "log" ) . mockImplementation ( ( ) => { } ) ;
208+
209+ t . onTestFinished ( ( ) => {
210+ consoleInfoSpy . mockRestore ( ) ;
211+ consoleLogSpy . mockRestore ( ) ;
212+ return worker ?. dispose ( ) ;
213+ } ) ;
216214
217215 const LARGE_STRING = "This is a large string" + "z" . repeat ( 2 ** 20 ) ;
218216
@@ -250,9 +248,7 @@ describe.each(OPTIONS)("DevEnv (remote: $remote)", ({ remote }) => {
250248 expect ( consoleApiMessages ) . toContainMatchingObject ( {
251249 method : "Runtime.consoleAPICalled" ,
252250 params : expect . objectContaining ( {
253- args : [
254- { type : "string" , value : expect . stringContaining ( "zzzzzzzzz" ) } ,
255- ] ,
251+ args : [ { type : "string" , value : LARGE_STRING } ] ,
256252 } ) ,
257253 } ) ;
258254 } ,
0 commit comments