Files
VoiceStudio/frontend/src/utils/consoleBuffer.test.js
T
b61d17dd61 fix(diagnostics): filter Tauri's benign IPC-fallback warning from frontend log capture (#975) (#998)
On some Windows configurations, Tauri's custom-protocol IPC probe fails
once at startup and Tauri logs a console.warn before silently — and
successfully — falling back to postMessage + WebSocket. Fully functional,
happens at most once per launch, and not a bug in our code (confirmed:
this is Tauri's own internal fallback mechanism, structurally intentional
across its recent 2.11.x releases, not something being actively patched
upstream — so not bumping the framework speculatively for this).

It IS real noise though: as a captured console.warn it spuriously flips
the Settings > Logs footer's Frontend pill to "1 warning" on every
affected Windows launch. Filtered at the capture source (consoleBuffer.js)
rather than the display layer, so it never enters the ring buffer or a
copied diagnostic dump either — narrowly scoped to this one known message
prefix, not a general warning-suppression mechanism.

Co-authored-by: mergetest <test@local>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 05:17:12 +05:30

38 lines
1.5 KiB
JavaScript

import { beforeEach, describe, expect, it } from 'vitest';
import { clearFrontendLogs, getFrontendLogs, installConsoleCapture } from './consoleBuffer';
describe('consoleBuffer', () => {
// installConsoleCapture() wraps console.* exactly once per page load (a
// module-level `installed` guard) — it must NOT be re-installed or have
// console.warn restored between tests, or later tests run against the
// un-wrapped original. Install once; only the ring buffer resets per test.
installConsoleCapture();
beforeEach(() => {
clearFrontendLogs();
});
it('captures an ordinary warning', () => {
console.warn('something genuinely worth seeing');
expect(getFrontendLogs().some((l) => l.msg.includes('something genuinely worth seeing'))).toBe(
true,
);
});
it("#975: filters Tauri's benign IPC-fallback warning out of the captured buffer", () => {
console.warn(
'IPC custom protocol failed, Tauri will now use the postMessage interface instead',
);
expect(getFrontendLogs().some((l) => l.msg.includes('IPC custom protocol failed'))).toBe(false);
});
it('does not filter a different warning that merely mentions IPC', () => {
// Prefix match, not a substring match — only Tauri's exact known message
// is suppressed; anything else that happens to mention "IPC" is not.
console.warn('some other IPC warning entirely');
expect(getFrontendLogs().some((l) => l.msg.includes('some other IPC warning entirely'))).toBe(
true,
);
});
});