From ca0e3851c304e4ce7b3767a07340dc272f1d1b88 Mon Sep 17 00:00:00 2001 From: Kazuhito Hokamura Date: Wed, 13 Mar 2024 23:02:09 +0900 Subject: [PATCH] fix(common): fix stacktrace regex --- packages/common/services/console-logger.service.ts | 2 +- packages/common/test/services/logger.service.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/common/services/console-logger.service.ts b/packages/common/services/console-logger.service.ts index 7ac05409c02..a6da2a41986 100644 --- a/packages/common/services/console-logger.service.ts +++ b/packages/common/services/console-logger.service.ts @@ -343,7 +343,7 @@ export class ConsoleLogger implements LoggerService { return false; } - return /^(.)+\n\s+at .+:\d+:\d+$/.test(stack); + return /^(.)+\n\s+at .+:\d+:\d+/.test(stack); } private getColorByLogLevel(level: LogLevel) { diff --git a/packages/common/test/services/logger.service.spec.ts b/packages/common/test/services/logger.service.spec.ts index 905e36d7c9e..e3a61464d06 100644 --- a/packages/common/test/services/logger.service.spec.ts +++ b/packages/common/test/services/logger.service.spec.ts @@ -411,7 +411,7 @@ describe('Logger', () => { it('should print one error to the console with stacktrace', () => { const message = 'random error'; - const stacktrace = 'Error: message\n at :1:2'; + const stacktrace = new Error('err').stack; logger.error(message, stacktrace);