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