chore: bump vitest from v3 to v4#2715
Conversation
68a9dc2 to
8ada9ed
Compare
1469eb3 to
6cd9596
Compare
Upgrade vitest, @vitest/coverage-v8, and @vitest/ui from 3.2.4 to 4.0.18 across all workspaces. Additional fixes required by the upgrade: - Add @types/node to @vm0/core devDependencies (vitest v4 no longer provides it transitively) - Add "node" to tsconfig types in @vm0/core and @vm0/platform (vitest v4 changed type resolution paths) Type check passes (8/8 workspaces). Test failures (88/231 files) are expected and will be addressed in follow-up commits. Ref: vm0-ai#2621 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…v4 CI failures esbuild transpiles `function` keyword in mockImplementation to arrow functions, which breaks vitest v4's constructor detection (arrow functions can't be called with `new`). Using `class` syntax instead, which is preserved by the transpiler. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
eed0e38 to
d3127b0
Compare
- Add factory mocks for @e2b/code-interpreter, @aws-sdk/client-s3, and @aws-sdk/s3-request-presigner to setup.ts (v4 automocks return undefined) - Remove bare vi.mock() automock lines from ~80 test files (now handled centrally in setup.ts) - Fix Date.now spy infinite recursion by using bare vi.spyOn without mockImplementation (v4 changed spy proxy behavior) - Fix Ably.Rest constructor mocks to use function syntax instead of arrow functions (v4 rejects arrow functions with new) - Remove unused vi imports from files that only used vi for automock calls - Use caret range for @vitest/coverage-v8 version Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d3127b0 to
fd61566
Compare
Code Review: PR #2715SummaryWell-executed major dependency upgrade from vitest v3.2.4 to v4.0.18 across all 7 workspaces. The PR is cleanly structured into 3 commits: version bump, CLI/runner test fixes, and web test infrastructure migration. All lint, type check, and test CI jobs pass. Net result: ~433 lines removed, ~400 lines of duplicated mock boilerplate centralized in Key FindingsCritical Issues (P0)None. High Priority (P1)None. Medium Priority (P2)
Bad Smell Analysis
All 17 bad smell categories are clean. Positive Highlights
Recommendations
VerdictLGTM -- The two P2 issues are cosmetic and should not block merge. This is a well-planned and thoroughly executed infrastructure upgrade. Full review details: |
| "module": "ESNext", | ||
| "skipLibCheck": true, | ||
| "types": ["vite/client"], | ||
| "types": ["vite/client", "node"], |
There was a problem hiding this comment.
Most of the platform code doesn't require Node types since they run in the browser/client side.
Can we have a better solution? For example, avoid depending on Node types in the platform, or isolate those files that need Node types with a separate tsconfig?
|
Thank you for the PR, the overall quality is very good. I will merge this PR first. I will create a separate issue to follow up on the platform/core dependency node type issue. |
Summary
Upgrade vitest from v3.2.4 to v4.0.18 across all workspaces.
Closes #2621
Changes
Commit 1: Version bump
vitest,@vitest/coverage-v8,@vitest/uito ^4.0.18 in 7 package.json files@types/nodeto@vm0/coredevDependencies (v4 no longer provides it transitively)"node"to tsconfigtypesin@vm0/coreand@vm0/platformCommit 2: CLI/Runner mock fixes
classsyntax (v4 rejects arrow functions withnew)Commit 3: Web test infrastructure migration
@e2b/code-interpreter,@aws-sdk/client-s3,@aws-sdk/s3-request-presignerto setup.ts (v4 automocks return undefined for getters)vi.mock()automock calls from ~80 test files (now centralized in setup.ts)Date.nowspy infinite recursion (v4 changed spy proxy behavior)functionsyntaxviimports from 48 files@vitest/coverage-v8Key vitest v4 breaking changes addressed
undefinedvi.mock("pkg")classorfunctionsyntaxvi.spyOnproxy behavior changeDate.nowinfinite recursion in test-helpers.tsvi.spyOnwithoutmockImplementation@types/nodeno longer transitive@types/nodedependencyResults
Test plan
🤖 Generated with Claude Code