Omit unicode control character escapes from test logs

Change-type: patch
This commit is contained in:
Thodoris Greasidis 2024-07-13 17:41:14 +03:00
parent 9f9fd97795
commit 4e101e2fd9

View File

@ -64,18 +64,24 @@ export function filterCliOutputForTests({
err: string[];
out: string[];
}): { err: string[]; out: string[] } {
// eslint-disable-next-line no-control-regex
const unicodeCharacterEscapesRegex = /\u001b\[3[0-9]m/g;
return {
err: err.filter(
(line: string) =>
line &&
!line.match(/\[debug\]/i) &&
// TODO stop this warning message from appearing when running
// sdk.setSharedOptions multiple times in the same process
!line.startsWith('Shared SDK options') &&
!line.startsWith('WARN: disabling Sentry.io error reporting') &&
!matchesNodeEngineVersionWarn(line),
),
out: out.filter((line: string) => line && !line.match(/\[debug\]/i)),
err: err
.map((line) => line.replaceAll(unicodeCharacterEscapesRegex, ''))
.filter(
(line: string) =>
line &&
!line.match(/\[debug\]/i) &&
// TODO stop this warning message from appearing when running
// sdk.setSharedOptions multiple times in the same process
!line.startsWith('Shared SDK options') &&
!line.startsWith('WARN: disabling Sentry.io error reporting') &&
!matchesNodeEngineVersionWarn(line),
),
out: out
.map((line) => line.replaceAll(unicodeCharacterEscapesRegex, ''))
.filter((line) => line && !line.match(/\[debug\]/i)),
};
}