[EC-515] Re-enable node consoleLog.service test (#3448)

This commit is contained in:
Thomas Rittson 2022-09-08 08:02:53 +10:00 committed by GitHub
parent 04c594203c
commit 233c85f7a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 30 deletions

View File

@ -1,32 +1,9 @@
import { ConsoleLogService } from "@bitwarden/common/services/consoleLog.service";
const originalConsole = console;
import { interceptConsole, restoreConsole } from "../shared/interceptConsole";
let caughtMessage: any;
declare let console: any;
export function interceptConsole(interceptions: any): object {
console = {
log: function () {
// eslint-disable-next-line
interceptions.log = arguments;
},
warn: function () {
// eslint-disable-next-line
interceptions.warn = arguments;
},
error: function () {
// eslint-disable-next-line
interceptions.error = arguments;
},
};
return interceptions;
}
export function restoreConsole() {
console = originalConsole;
}
describe("ConsoleLogService", () => {
let logService: ConsoleLogService;
beforeEach(() => {

View File

@ -0,0 +1,25 @@
const originalConsole = console;
declare let console: any;
export function interceptConsole(interceptions: any): object {
console = {
log: function () {
// eslint-disable-next-line
interceptions.log = arguments;
},
warn: function () {
// eslint-disable-next-line
interceptions.warn = arguments;
},
error: function () {
// eslint-disable-next-line
interceptions.error = arguments;
},
};
return interceptions;
}
export function restoreConsole() {
console = originalConsole;
}

View File

@ -1,10 +1,7 @@
import {
interceptConsole,
restoreConsole,
} from "@bitwarden/common/../spec/services/consolelog.service.spec";
import { ConsoleLogService } from "@bitwarden/node/cli/services/consoleLog.service";
import { interceptConsole, restoreConsole } from "../../../common/spec/shared/interceptConsole";
let caughtMessage: any = {};
describe("CLI Console log service", () => {