@@ -459,7 +459,7 @@ describe('InspectedElement', () => {
459459    const  prevInspectedElement  =  inspectedElement ; 
460460
461461    // This test causes an intermediate error to be logged but we can ignore it. 
462-     console . error   =   ( )  =>  { } ; 
462+     jest . spyOn ( console ,   'error' ) . mockImplementation ( ( )  =>  { } ) ; 
463463
464464    // Wait for our check-for-updates poll to get the new data. 
465465    jest . runOnlyPendingTimers ( ) ; 
@@ -2804,16 +2804,18 @@ describe('InspectedElement', () => {
28042804      ) ; 
28052805
28062806      // Suppress expected error and warning. 
2807-       const  originalError  =  console . error ; 
2808-       const  originalWarn  =  console . warn ; 
2809-       console . error  =  ( )  =>  { } ; 
2810-       console . warn  =  ( )  =>  { } ; 
2807+       const  consoleErrorMock  =  jest 
2808+         . spyOn ( console ,  'error' ) 
2809+         . mockImplementation ( ( )  =>  { } ) ; 
2810+       const  consoleWarnMock  =  jest 
2811+         . spyOn ( console ,  'warn' ) 
2812+         . mockImplementation ( ( )  =>  { } ) ; 
28112813
28122814      // now force error state on <Example /> 
28132815      await  toggleError ( true ) ; 
28142816
2815-       console . error   =   originalError ; 
2816-       console . warn   =   originalWarn ; 
2817+       consoleErrorMock . mockRestore ( ) ; 
2818+       consoleWarnMock . mockRestore ( ) ; 
28172819
28182820      // we are in error state now, <Example /> won't show up 
28192821      withErrorsOrWarningsIgnored ( [ 'Invalid index' ] ,  ( )  =>  { 
0 commit comments