bitwarden-estensione-browser/libs/common/spec/intercept-console.ts

21 lines
359 B
TypeScript

const originalConsole = console;
declare let console: any;
export function interceptConsole(): {
log: jest.Mock<any, any>;
warn: jest.Mock<any, any>;
error: jest.Mock<any, any>;
} {
console = {
log: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
};
return console;
}
export function restoreConsole() {
console = originalConsole;
}