diff --git a/_dev/src/ts/utils/logsUtils.ts b/_dev/src/ts/utils/logsUtils.ts index 6fecd6b2c..b28a14376 100644 --- a/_dev/src/ts/utils/logsUtils.ts +++ b/_dev/src/ts/utils/logsUtils.ts @@ -34,7 +34,7 @@ const severityPattern = [ */ export function parseLogWithSeverity(log: string): LogEntry { const logTrimed = log.trim(); - const severityRegex = new RegExp(`^(${severityPattern})\\s*-\\s*(.*)$`); + const severityRegex = new RegExp(`^(${severityPattern})\\s*-\\s*(.*)$`, 's'); const match = severityRegex.exec(logTrimed); if (match) { diff --git a/_dev/tests/utils/logsUtils.test.ts b/_dev/tests/utils/logsUtils.test.ts index fee185c7f..5d8bdf1a8 100644 --- a/_dev/tests/utils/logsUtils.test.ts +++ b/_dev/tests/utils/logsUtils.test.ts @@ -12,6 +12,18 @@ describe('parseLogWithSeverity', () => { }); }); + it('should parse a log with SUCCESS severity on multi-line', () => { + const log = `DEBUG - Migration file: 8.1.7-catchup, Query: /* 8.0.0 */ +DROP TABLE IF EXISTS \`ps_attribute_impact\``; + const result = parseLogWithSeverity(log); + + expect(result).toEqual({ + severity: Severity.SUCCESS, + message: + 'Migration file: 8.1.7-catchup, Query: /* 8.0.0 */\nDROP TABLE IF EXISTS `ps_attribute_impact`' + }); + }); + it('should parse a log with WARNING severity', () => { const log = 'WARNING - Disk space is low'; const result = parseLogWithSeverity(log);