mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 21:57:51 +00:00
Omit unicode control character escapes from test logs
Change-type: patch
This commit is contained in:
parent
9f9fd97795
commit
4e101e2fd9
@ -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)),
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user