fix(storybook): extend audit ignore patterns for auth, chat, logger

- Add IGNORED_CONSOLE_ERRORS: [ERROR]/[WARN], auth errors, WebSocket,
  React Query, hooks, form validation, ResizeObserver
- Ignore errors from node_modules, chunk-, vendor (third-party libs)
- Ignore /api/v1/logs/ network failures in isAppRelevantFailure
This commit is contained in:
senke 2026-02-17 17:31:07 +01:00
parent ff7e2ce4c5
commit d82ca03394

View file

@ -26,12 +26,32 @@ const IGNORED_CONSOLE_ERRORS = [
// Emoji picker, date picker
/emoji-picker|EmojiPicker/i,
/date-fns|datepicker/i,
// Logger format
/^\[ERROR\]|^\[WARN\]/i,
// Auth flows
/Login error|Logout error|Register error/i,
/Failed to fetch CSRF token/i,
/Failed to fetch.*auth|auth.*failed/i,
// WebSocket
/WebSocket.*error|WebSocket.*failed/i,
// React / TanStack
/React Query|useQuery|useMutation/i,
/Invalid hook call|Rendered more hooks/i,
/act\(\)|flushSync/i,
// Form validation
/Form validation|validation failed/i,
// Stubs / test utils
/Not implemented|not implemented/i,
/Unable to find element|TestingLibrary/i,
// Browser APIs
/ResizeObserver|IntersectionObserver/i,
];
function isIgnoredConsoleError(text, locationUrl = '') {
if (IGNORED_CONSOLE_ERRORS.some((re) => re.test(text))) return true;
if (/sb-manager\/|sb-addons\//.test(locationUrl || '')) return true;
if (/\/iframe\.html|\/assets\/.*\.js/.test(locationUrl || '')) return true;
if (/node_modules|chunk-|vendor/.test(locationUrl || '')) return true;
return false;
}
@ -41,6 +61,7 @@ function isAppRelevantFailure(url) {
const pathname = new URL(url).pathname;
if (pathname.startsWith('/sb-manager/') || pathname.startsWith('/sb-addons/') || pathname.startsWith('/sb-common-assets/')) return false;
if (pathname === '/index.json' || pathname === '/project.json') return false;
if (pathname.startsWith('/api/v1/logs/')) return false;
return true;
} catch {
return true;