Skip to content

build(deps): vitest 3→4 + jsdom 25→29#348

Merged
rz1989s merged 1 commit into
mainfrom
chore/vitest4-jsdom
Jun 25, 2026
Merged

build(deps): vitest 3→4 + jsdom 25→29#348
rz1989s merged 1 commit into
mainfrom
chore/vitest4-jsdom

Conversation

@rz1989s

@rz1989s rz1989s commented Jun 25, 2026

Copy link
Copy Markdown
Member

Adopts Dependabot #331 (vitest 3→4) and #334 (jsdom 25→29) together — both are test-infra and both CI-failed as bare bumps. Verified-then-adopted.

The vitest 4 break

vitest 4's spy lib (tinyspy 4) now invokes a mock's implementation as a constructor under new. Class mocks written as arrows throw () => ({...}) is not a constructor. Affected classes: Connection, PublicKey, AgentCore, TorqueMCPClient.

Fix: converted those mocks to function form across 42 test files via an AST codemod (ts-morph):

- Connection: vi.fn().mockImplementation(() => ({ ... }))
+ Connection: vi.fn().mockImplementation(function () { return ({ ... }) })
  • Mock bodies are byte-preserved (only the open/close lines change) — minimal diff.
  • Both declarative (Connection: vi.fn()...) and imperative (mockConnectionCtor.mockImplementation(...), vi.mocked(TorqueMCPClient)...) forms handled, including as never casts.
  • Plain function mocks (loadNetworkConfig, deriveViewingKey, …) are left as arrows — they're called normally, not constructed.

Infra

  • vite stays on ^6 (6.4.1) — vitest 4 compatible; no bump to 7.
  • No @vitest/coverage-v8 to major-match; no vitest.workspace.ts to migrate.
  • vitest bumped in all 4 workspace packages (root, agent, sdk, app) to keep a single major.

Verification

Suite Result
pnpm typecheck green (all 4 projects)
root 563 / 563
packages/agent 1718 passed (2 skipped)
app (jsdom 29) 577 / 577
packages/sdk 118 / 118

Pre-existing order-dependent flakes (rate-limiter, CORS, viewing-key-hierarchy) pass in isolation and are unrelated to this bump.

Supersedes #331 and #334.

Adopts Dependabot #331 (vitest) and #334 (jsdom), both of which CI-failed as bare
bumps. vitest 4's tinyspy invokes a mock's implementation as a constructor under
`new`, so class mocks written as arrows — Connection, PublicKey, AgentCore,
TorqueMCPClient — threw "() => ({...}) is not a constructor". Converted those to
function form ((args) => ({...})  ->  function (args) { return ({...}) }) across
42 test files via an AST codemod; the mock bodies are byte-preserved and plain
function mocks (loadNetworkConfig, deriveViewingKey, ...) are left untouched.

vite stays on ^6 (vitest 4 compatible); no coverage-provider or workspace-config
migration needed. vitest bumped in all 4 workspace packages to keep a single major.

Verified: typecheck green (all 4 projects), root 563/563, agent 1718, app 577,
sdk 118. Pre-existing order-dependent flakes (rate-limiter, CORS, viewing-key)
pass in isolation and are unrelated to this bump.
@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
sipher Ready Ready Preview, Comment Jun 25, 2026 2:29am

@rz1989s rz1989s merged commit fe761a5 into main Jun 25, 2026
8 checks passed
@rz1989s rz1989s deleted the chore/vitest4-jsdom branch June 25, 2026 03:20
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