From a338333f973715847c65c09c48d06650f6df5031 Mon Sep 17 00:00:00 2001 From: Ruggero Cino Date: Mon, 8 Jan 2024 14:57:05 +0100 Subject: [PATCH] Update testLogger.ts --- src/test/utils/testLogger.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test/utils/testLogger.ts b/src/test/utils/testLogger.ts index 5d11a8f01..75142116f 100644 --- a/src/test/utils/testLogger.ts +++ b/src/test/utils/testLogger.ts @@ -3,13 +3,15 @@ class TestLogger { private shouldSuppressErrors = false; private originalConsoleError = console.error; + private testErrorLogger = jest.fn((...params) => { + if (!this.shouldSuppressErrors) { + this.originalConsoleError.apply(console, params); + } + }); + setup = () => { beforeEach(() => { - console.error = jest.fn((...params) => { - if (!this.shouldSuppressErrors) { - this.originalConsoleError.apply(console, params); - } - }); + console.error = this.testErrorLogger; }); afterEach(() => {