Suppress verbose web test trace output
This commit is contained in:
@@ -29,6 +29,8 @@ const angularTestResourcePathCache = new Map<string, string>();
|
||||
const angularTestResourceContentCache = new Map<string, string>();
|
||||
const suppressedTestWarnFragments = [
|
||||
'WARNING: sanitizing HTML stripped some content',
|
||||
'Translation key not found:',
|
||||
'[TenantAuth] ',
|
||||
];
|
||||
const suppressedTestErrorFragments = [
|
||||
"Not implemented: navigation to another Document",
|
||||
@@ -41,6 +43,14 @@ const suppressedTestErrorFragments = [
|
||||
'GraphViz render error:',
|
||||
'Evidence bundle export failed:',
|
||||
];
|
||||
const suppressedTestLogFragments = [
|
||||
'[TenantAuth] ',
|
||||
'Downloading evidence:',
|
||||
];
|
||||
const suppressedTestDebugFragments = [
|
||||
'[VulnHttpClient]',
|
||||
'[TenantAuth] ',
|
||||
];
|
||||
|
||||
class TestResizeObserver {
|
||||
observe(): void {}
|
||||
@@ -125,9 +135,18 @@ if (!(globalThis as Record<string, unknown>)[angularTestEnvironmentKey]) {
|
||||
}
|
||||
|
||||
if (!(globalThis as Record<string, unknown>)[angularTestConsolePatchKey]) {
|
||||
const originalLog = console.log.bind(console);
|
||||
const originalWarn = console.warn.bind(console);
|
||||
const originalDebug = console.debug.bind(console);
|
||||
const originalError = console.error.bind(console);
|
||||
|
||||
console.log = (...args: unknown[]) => {
|
||||
if (consoleMessageIncludesAny(args, suppressedTestLogFragments)) {
|
||||
return;
|
||||
}
|
||||
originalLog(...args);
|
||||
};
|
||||
|
||||
console.warn = (...args: unknown[]) => {
|
||||
if (consoleMessageIncludesAny(args, suppressedTestWarnFragments)) {
|
||||
return;
|
||||
@@ -135,6 +154,13 @@ if (!(globalThis as Record<string, unknown>)[angularTestConsolePatchKey]) {
|
||||
originalWarn(...args);
|
||||
};
|
||||
|
||||
console.debug = (...args: unknown[]) => {
|
||||
if (consoleMessageIncludesAny(args, suppressedTestDebugFragments)) {
|
||||
return;
|
||||
}
|
||||
originalDebug(...args);
|
||||
};
|
||||
|
||||
console.error = (...args: unknown[]) => {
|
||||
if (consoleMessageIncludesAny(args, suppressedTestErrorFragments)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user