Jest mock console.log


Mock console.log with jest.spyOn:

jest.spyOn(console, 'log');

Restore console.log with mockRestore:

console.log.mockRestore();

Silence or suppress console.log with mockImplementation:

jest.spyOn(console, 'log').mockImplementation();


Please support this site and join our Discord!