2022-09-08 00:02:53 +02:00
|
|
|
const originalConsole = console;
|
|
|
|
|
|
|
|
declare let console: any;
|
|
|
|
|
2024-04-30 18:58:16 +02:00
|
|
|
export function interceptConsole(): {
|
|
|
|
log: jest.Mock<any, any>;
|
|
|
|
warn: jest.Mock<any, any>;
|
|
|
|
error: jest.Mock<any, any>;
|
|
|
|
} {
|
2022-09-08 00:02:53 +02:00
|
|
|
console = {
|
2024-04-30 18:58:16 +02:00
|
|
|
log: jest.fn(),
|
|
|
|
warn: jest.fn(),
|
|
|
|
error: jest.fn(),
|
2022-09-08 00:02:53 +02:00
|
|
|
};
|
2024-04-30 18:58:16 +02:00
|
|
|
return console;
|
2022-09-08 00:02:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export function restoreConsole() {
|
|
|
|
console = originalConsole;
|
|
|
|
}
|