diff --git a/src/Web/StellaOps.Web/src/test-setup.ts b/src/Web/StellaOps.Web/src/test-setup.ts index c8b7375c6..3b6bbf84e 100644 --- a/src/Web/StellaOps.Web/src/test-setup.ts +++ b/src/Web/StellaOps.Web/src/test-setup.ts @@ -29,6 +29,8 @@ const angularTestResourcePathCache = new Map(); const angularTestResourceContentCache = new Map(); 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)[angularTestEnvironmentKey]) { } if (!(globalThis as Record)[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)[angularTestConsolePatchKey]) { originalWarn(...args); }; + console.debug = (...args: unknown[]) => { + if (consoleMessageIncludesAny(args, suppressedTestDebugFragments)) { + return; + } + originalDebug(...args); + }; + console.error = (...args: unknown[]) => { if (consoleMessageIncludesAny(args, suppressedTestErrorFragments)) { return;