Skip to content

test(web): silence msw and jsdom log noise - #2524

Merged
tyler-dane merged 2 commits into
mainfrom
fix/web-test-msw-jsdom-noise
Jul 31, 2026
Merged

test(web): silence msw and jsdom log noise#2524
tyler-dane merged 2 commits into
mainfrom
fix/web-test-msw-jsdom-noise

Conversation

@tyler-dane

Copy link
Copy Markdown
Contributor

Summary

  • Add global MSW handlers for GET /calendars/availability and GET|PUT /user/email-updates so authenticated mounts stop tripping unhandled-request errors.
  • Export defaultCalendarsHandlers / defaultMockCalendars for opt-in server.use when a test needs a default /calendars response (not registered globally — a default success changes event-list calendarIds and breaks suite-order-dependent hook/grid tests).
  • Redact jsdom Window/Document/Node/Event graphs from Bun expect() diffs and console output via util.inspect.custom plus an Event impl _globalObject Proxy.
  • Clarify Week/MainGrid test comments about why query clients are seeded in useState initializers.

Simplicity

Implementation is already minimal: test-only MSW defaults, scoped calendars export for reuse, and jsdom inspect hooks with no production surface. No further simplification pass.

Automated validation

  • bun test:web — 1506 pass / 0 fail
  • Focused Week/MainGrid + shortcuts tests (57 pass)
  • bun lint — clean

Independent review

Fresh diff review flagged global /calendars as a regression risk (8 failing tests when registered globally). Addressed by scoping calendars to exported defaultCalendarsHandlers instead of globalHandlers; full suite green after change. jsdom Proxy/inspect hooks reviewed safe (no assertion regressions).

Test plan

  • bun test:web
  • bun test:web -- packages/web/src/views/Week/components/Grid/MainGrid/MainGrid.test.tsx packages/web/src/views/Week/components/Grid/MainGrid/MainGridBusyPeriods.test.tsx packages/web/src/views/Week/components/Grid/MainGrid/eventReadOnlyInteraction.test.tsx packages/web/src/views/Week/hooks/shortcuts/useWeekShortcuts.test.tsx
  • bun lint

Add global MSW handlers for availability and email-updates, export scoped
calendars defaults for opt-in tests, and redact jsdom Window/Event graphs
from Bun expect diffs and console output.
Keep /calendars off globalHandlers to avoid calendarIds regressions and
satisfy knip without exporting dead handler helpers.
@tyler-dane
tyler-dane merged commit f2f5403 into main Jul 31, 2026
20 checks passed
@tyler-dane
tyler-dane deleted the fix/web-test-msw-jsdom-noise branch July 31, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant