Skip to content

refactor(web): switch web tests to bun runner#1656

Merged
tyler-dane merged 160 commits intomainfrom
feat/webpack-to-bun
Apr 18, 2026
Merged

refactor(web): switch web tests to bun runner#1656
tyler-dane merged 160 commits intomainfrom
feat/webpack-to-bun

Conversation

@tyler-dane
Copy link
Copy Markdown
Contributor

Summary

  • switch the web test entrypoint from Jest to bun test with the existing web preload
  • remove the web project from jest.config.js so backend and scripts remain on Jest only
  • update web test typing and package metadata for Bun, and delete the superseded Jest-only web test setup files

Validation

  • bun install
  • bun test packages/web/src --preload packages/web/src/__tests__/web.preload.ts --bail 1 (fails: jest.mock is not a function in packages/web/src/sse/provider/SSEProvider.interaction.test.tsx)

Follow-up in this branch

  • fix Bun/Jest compat for jest.mock
  • promote remaining DOM globals needed by eager module evaluation
  • get bun run test:web passing before review

@tyler-dane tyler-dane force-pushed the feat/webpack-to-bun branch from eeeae56 to 39f05a5 Compare April 17, 2026 02:22
The test was using vi (Vitest) for fake timers which is not available in bun.
Replaced with native setSystemTime() from bun:test - no jest shim needed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@tyler-dane tyler-dane force-pushed the feat/webpack-to-bun branch from 22bd5bc to b07394c Compare April 17, 2026 22:43
tyler-dane and others added 2 commits April 17, 2026 15:47
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Batch replaced vi.clearAllMocks() with mock.restore() and removed vi imports
across 18 test files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@tyler-dane tyler-dane force-pushed the feat/webpack-to-bun branch from 9b372fb to f82676f Compare April 17, 2026 22:48
tyler-dane and others added 16 commits April 17, 2026 15:55
…hModal tests

The delete window.location pattern doesn't work in bun's jsdom. This fix uses
setTestWindowUrl which properly updates the URL via history.replaceState.

Note: URL Parameter Support tests still need investigation - the setTestWindowUrl
approach may need additional work to properly update window.location.search
before the component mounts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ortcutHint test

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There failed when running 'bun test --bail=1'

There was likely one or more bad mocks that cascaded to the others, due to Bun's single-process approach (vs jest's resetting of all mocks automatically)

https://bun.com/docs/test/runtime-behavior#test-isolation
@tyler-dane tyler-dane force-pushed the feat/webpack-to-bun branch from 1c9afdf to 6adfbce Compare April 18, 2026 01:45
@tyler-dane
Copy link
Copy Markdown
Contributor Author

See this commit and its message for context about why so many web tests were deleted.

2faaf82

@tyler-dane tyler-dane marked this pull request as ready for review April 18, 2026 02:13
@tyler-dane tyler-dane merged commit 0be1592 into main Apr 18, 2026
@tyler-dane tyler-dane deleted the feat/webpack-to-bun branch April 18, 2026 02:14
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