Skip to content

Migrate tests to Vitest 4#67

Open
kentcdodds wants to merge 4 commits intomainfrom
cursor/vitest-latest-version-bf37
Open

Migrate tests to Vitest 4#67
kentcdodds wants to merge 4 commits intomainfrom
cursor/vitest-latest-version-bf37

Conversation

@kentcdodds
Copy link
Copy Markdown
Member

Summary

  • migrate the repo from bun:test to vitest
  • add dedicated Vitest configs for general and unit-only runs
  • update Wrangler-backed integration tests to run under Node-backed Vitest using Node subprocess APIs
  • refresh CI and testing docs to use the new Vitest commands

Testing

  • bun run test:unit
  • bunx vitest run mock-servers/resend/resend-mock.test.ts
  • bun run test:mcp
  • bun run typecheck && bun run lint
Open in Web Open in Cursor 

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kentcdodds kentcdodds marked this pull request as ready for review April 2, 2026 16:24
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

🔎 Preview deployed: https://epicflare-pr-67.kentcdodds.workers.dev

Worker: epicflare-pr-67
D1: epicflare-pr-67-db
KV: epicflare-pr-67-oauth-kv

Mocks:

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@cursor cursor bot temporarily deployed to preview-67 April 2, 2026 16:36 Inactive
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@cursor cursor bot temporarily deployed to preview-67 April 2, 2026 16:41 Inactive
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

resolve(code)
})
})
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Process exit promise can hang forever after early exit

Medium Severity

waitForExit creates a new proc.once('exit', ...) listener each call. Unlike Bun's proc.exited (a reusable Promise that resolves immediately if already settled), a fresh once('exit') listener won't fire if the process already exited. If the child process crashes before stopProcess runs (e.g., during Symbol.asyncDispose), waitForExit returns a promise that never resolves, causing await exitPromise after SIGKILL to hang the test forever.

Additional Locations (2)
Fix in Cursor Fix in Web

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.

2 participants