1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-06 09:20:43 +01:00
bitwarden-browser/libs/common/spec/intercept-console.ts
Matt Gibson b4631b0dd1
Ps/improve-log-service (#8989)
* Match console method signatures in logService abstraction

* Add a few usages of improved signature

* Remove reality check test

* Improve electron logging
2024-04-30 12:58:16 -04:00

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;
}