refactor: migrate test runner from bun:test to vitest (WIP)#992
Closed
BYK wants to merge 2 commits into
Closed
Conversation
19967c5 to
7c4061c
Compare
9a05ef5 to
ae3fcb6
Compare
2410f84 to
f276ba6
Compare
f276ba6 to
e136ce6
Compare
Contributor
|
e136ce6 to
3d5fbd6
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3d5fbd6. Configure here.
3d5fbd6 to
56cc841
Compare
Contributor
Codecov Results 📊✅ Patch coverage is 82.36%. Project has 4055 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 76.61% 82.36% +5.75%
==========================================
Files 324 324 —
Lines 63171 22986 -40185
Branches 0 14880 +14880
==========================================
+ Hits 48396 18931 -29465
- Misses 14775 4055 -10720
- Partials 0 1608 +1608Generated by Codecov Action |
56cc841 to
0a35368
Compare
Phase 3 of Bun → Node.js migration. Migrates 327 test files from bun:test to vitest. Mechanical changes: - bun:test imports → vitest imports (327 files) - mock → vi, spyOn → vi.spyOn, mock.module → vi.mock (52 files) - Bun.spawn/spawnSync → node:child_process in test files (12 files) - Bun.file/write/sleep/gzip/etc → Node.js equivalents in tests (40 files) - Bun.serve → node:http createServer in test mock server - import.meta.dir → import.meta.dirname (16 files) - BUN_TEST_WORKER_ID → VITEST_POOL_ID - Added vitest.config.ts with setupFiles, pool: forks, 15s timeout - Added custom toStartWith/toEndWith matchers in preload.ts - Removed bun:sqlite fallback from sqlite.ts - Updated package.json test scripts to use vitest Known remaining issues (WIP): - ESM spy limitations (Cannot spy on ESM namespace exports) - Some vi import gaps in edge cases - Test API signature changes (vitest 4) - self is not defined in model-based tests
0a35368 to
6dc85ed
Compare
Member
Author
|
Recreating PR with a fresh branch to trigger CI (GitHub stopped triggering ci.yml on the old branch after many force pushes). |
auto-merge was automatically disabled
May 21, 2026 13:53
Pull request was closed
BYK
added a commit
that referenced
this pull request
May 21, 2026
Phase 3 of the Bun to Node.js migration. Migrates 327 test files from bun:test to vitest. 306/307 test files pass, 6994/7014 tests pass, 0 failures. See closed PR #992 for full description.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Phase 3 of the Bun to Node.js migration. Migrates 327 test files from bun:test to vitest.
Results
Changes
Infrastructure:
vitestas devDependencyvitest.config.tswith setupFiles, forks pool, custom Vite pluginstoStartWith,toEndWith,toBeString,toBeArraywith { type: "text" }), require .js-to-.ts, resolve .js-to-.tsbun:sqlitefallback fromsqlite.tsTest file migration (327 files):
from "bun:test"tofrom "vitest"mocktovi,spyOntovi.spyOn,mock.moduletovi.mockvi.hoisted()for 12 files with mock factory hoistingvi.mock()withimportOriginalfor 46 files with namespace spy patternsBun API replacements in tests (40+ files):
Bun.spawn/spawnSynctonode:child_processBun.file/write/sleep/gzipto Node.js equivalentsBun.servemock server tonode:http createServerimport.meta.dirtoimport.meta.dirnameBUN_TEST_WORKER_IDtoVITEST_POOL_IDSource changes (minimal):
src/lib/list-command.ts: try-catch aroundrequire("../app.js")for vitest compatsrc/lib/telemetry.ts: top-level import replacing lazy require