Skip to content

Migrate shared/* packages to Vitest - #101

Merged
soorya-u merged 2 commits into
mainfrom
issue-91-migrate-shared-vitest
Jul 20, 2026
Merged

Migrate shared/* packages to Vitest#101
soorya-u merged 2 commits into
mainfrom
issue-91-migrate-shared-vitest

Conversation

@soorya-u

@soorya-u soorya-u commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move shared/connections, constants, database, schemas, and utils tests from Bun to Vitest+node
  • Register each package as its own project in the root Vitest workspace
  • Keep apps/cli on Bun unchanged; package test-runner choice stays decoupled from consumers

Closes #91

Test plan

  • bun -F @cyrus/{connections,constants,database,schemas,utils} test:unit passes under Vitest
  • bun -F @cyrus/database test:integration passes under Vitest
  • bunx vitest run from repo root includes all five packages and passes
  • No bun:test imports remain in these five packages
  • bun -F @cyrus/cli test:unit still passes on Bun

Made with Cursor

Summary by CodeRabbit

  • Chores
    • Standardized shared-package testing on Vitest.
    • Added consistent Node-based test configuration across shared packages.
    • Expanded the overall test suite to include connections, constants, database, schemas, and utilities.
  • Bug Fixes
    • Improved reliability for asynchronous event-delivery tests by ensuring queued tasks complete before assertions and cleanup.

Move connections, constants, database, schemas, and utils onto Vitest+node projects in the root workspace so shared package runners stay decoupled from apps/cli's Bun runtime.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cyrus Ready Ready Preview, Comment Jul 20, 2026 11:49am

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 30e54940-e308-4aab-8b46-765db5d59f5d

📥 Commits

Reviewing files that changed from the base of the PR and between 653de45 and 2465df2.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (32)
  • shared/connections/package.json
  • shared/connections/src/rtc/peer.test.ts
  • shared/connections/src/rtc/session.test.ts
  • shared/connections/src/rtc/webrtc-nightly.test.ts
  • shared/connections/tsconfig.json
  • shared/connections/vitest.config.ts
  • shared/constants/package.json
  • shared/constants/src/operation-keys.test.ts
  • shared/constants/tsconfig.json
  • shared/constants/vitest.config.ts
  • shared/database/__tests__/integration/repositories.test.ts
  • shared/database/package.json
  • shared/database/src/utils/repo.test.ts
  • shared/database/tsconfig.json
  • shared/database/vitest.config.ts
  • shared/schemas/package.json
  • shared/schemas/src/rtc/agents.test.ts
  • shared/schemas/src/rtc/chat.test.ts
  • shared/schemas/src/rtc/threads.test.ts
  • shared/schemas/src/signaling.test.ts
  • shared/schemas/tsconfig.json
  • shared/schemas/vitest.config.ts
  • shared/utils/package.json
  • shared/utils/src/conversations/fold.test.ts
  • shared/utils/src/conversations/thread-feed.test.ts
  • shared/utils/src/conversations/turn-waiters.test.ts
  • shared/utils/src/identity.test.ts
  • shared/utils/src/path.test.ts
  • shared/utils/src/timer.test.ts
  • shared/utils/tsconfig.json
  • shared/utils/vitest.config.ts
  • vitest.config.ts

📝 Walkthrough

Walkthrough

Five shared packages migrate their tests from Bun to Vitest with Node-based package configs. Their scripts and dependencies are updated, root Vitest project registration is expanded, and one asynchronous peer test gains a microtask flush helper.

Changes

Shared Vitest migration

Layer / File(s) Summary
Package project wiring
vitest.config.ts, shared/*/package.json, shared/*/tsconfig.json, shared/*/vitest.config.ts
Shared package scripts and dev dependencies now use Vitest, each package defines Node-based test discovery, TypeScript includes the config files, and the root workspace registers all five projects.
Connections, constants, and database test migration
shared/connections/src/rtc/*.test.ts, shared/constants/src/operation-keys.test.ts, shared/database/.../*.test.ts
Test imports switch from bun:test to vitest; the peer event test adds a setImmediate-based asynchronous flush helper.
Schemas and utils test migration
shared/schemas/src/**/*.test.ts, shared/utils/src/**/*.test.ts
Existing schema and utility assertions continue under Vitest with no described test-logic changes.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related issues

  • Issue 88 — Covers the broader repository migration to Vitest, including these shared-package changes.
  • Issue 92 — Targets the remaining Bun-to-Vitest test migrations outside the packages changed here.
  • Issue 96 — Relates to per-package Vitest configuration and workspace wiring.

Possibly related PRs

  • soorya-u/cyrus#35 — Added Bun-based test suites that this PR migrates to Vitest.
  • soorya-u/cyrus#36 — Modifies overlapping connections and database testing areas.
  • soorya-u/cyrus#97 — Updates root Vitest project registration in the same workspace configuration.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: migrating shared packages to Vitest.
Linked Issues check ✅ Passed The shared package test files, package scripts, Vitest configs, and root workspace registration align with #91's migration requirements.
Out of Scope Changes check ✅ Passed The changes are confined to the Vitest migration and workspace wiring for the shared packages, with no obvious unrelated additions.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-91-migrate-shared-vitest

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-authored-by: Cursor <cursoragent@cursor.com>
@soorya-u
soorya-u merged commit 9acc951 into main Jul 20, 2026
9 checks passed
@soorya-u
soorya-u deleted the issue-91-migrate-shared-vitest branch July 20, 2026 11:58
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.

Migrate shared/* packages to Vitest

1 participant