Skip to content

chore: upgrade vitest to v4#1115

Merged
brendan-kellam merged 3 commits intomainfrom
brendan/upgrade-vitest-v4
Apr 14, 2026
Merged

chore: upgrade vitest to v4#1115
brendan-kellam merged 3 commits intomainfrom
brendan/upgrade-vitest-v4

Conversation

@brendan-kellam
Copy link
Copy Markdown
Contributor

@brendan-kellam brendan-kellam commented Apr 14, 2026

Summary

  • Upgrade vitest from v2 to v4.1.4 across all 4 packages (shared, queryLanguage, backend, web)
  • Upgrade vitest-mock-extended from v3 to v4.0.0 in web
  • Fix constructor mock tests in repoIndexManager.test.ts that used arrow functions (Vitest 4 requires function/class keyword for mocks called with new)
  • Fix listCommitsApi.test.ts to use explicit fs mock factory instead of bare vi.mock('fs') auto-mocking (behavior changed in Vitest 4 for Node built-ins)

Test plan

  • All 676 tests pass across all 4 packages (queryLanguage: 265, shared: 32, backend: 118, web: 261)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated development dependencies across packages: test runner upgraded to latest version, testing utilities updated for improved compatibility and performance.
    • Refined internal test mock implementations and infrastructure for enhanced testing reliability.

Upgrade vitest from v2 to v4.1.4 across all packages, and
vitest-mock-extended from v3 to v4.0.0. Fix constructor mock
tests that used arrow functions (now require function/class
keyword in Vitest 4) and explicit fs mock factory for Node
built-in auto-mocking changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

This comment has been minimized.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 99faa5ce-b579-4f9e-80fc-f066b56f4c38

📥 Commits

Reviewing files that changed from the base of the PR and between ca8a0d3 and ea8e5e6.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • packages/backend/package.json
  • packages/backend/src/repoIndexManager.test.ts
  • packages/queryLanguage/package.json
  • packages/shared/package.json
  • packages/web/package.json
  • packages/web/src/features/git/listCommitsApi.test.ts

Walkthrough

This pull request upgrades vitest across four packages (from ^2.1.9 to ^4.1.4) and vitest-mock-extended in one package (^3.1.0 to ^4.0.0). Test file mocks were also updated to align with the newer vitest version's requirements, including changes to mock implementation styles and filesystem mocking strategies.

Changes

Cohort / File(s) Summary
Vitest Dependency Upgrades
packages/backend/package.json, packages/queryLanguage/package.json, packages/shared/package.json, packages/web/package.json
Updated vitest devDependency from ^2.1.9 to ^4.1.4 across three packages; packages/web also updated vitest-mock-extended from ^3.1.0 to ^4.0.0.
Backend Test Mock Updates
packages/backend/src/repoIndexManager.test.ts
Refactored Vitest mocks for bullmq Queue/Worker and redlock from arrow-function implementations to function-expression implementations while maintaining identical mock behavior.
Web Test Mock Updates
packages/web/src/features/git/listCommitsApi.test.ts
Changed fs mock from simple vi.mock() to explicit factory function with mocked existsSync returning true by default.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: upgrade vitest to v4' directly and clearly summarizes the main change—a major version upgrade of the vitest testing framework across multiple packages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 brendan/upgrade-vitest-v4

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 and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

License Audit

⚠️ Status: PASS

Metric Count
Total packages 2128
Resolved (non-standard) 10
Unresolved 0
Strong copyleft 0
Weak copyleft 39

Weak Copyleft Packages (informational)

Package Version License
@img/sharp-libvips-darwin-arm64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-darwin-arm64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-darwin-x64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-darwin-x64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-arm 1.0.5 LGPL-3.0-or-later
@img/sharp-libvips-linux-arm 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-arm64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-arm64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-ppc64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-riscv64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-s390x 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-s390x 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-x64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-x64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linuxmusl-arm64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-linuxmusl-arm64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linuxmusl-x64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-linuxmusl-x64 1.2.4 LGPL-3.0-or-later
@img/sharp-wasm32 0.33.5 Apache-2.0 AND LGPL-3.0-or-later AND MIT
@img/sharp-wasm32 0.34.5 Apache-2.0 AND LGPL-3.0-or-later AND MIT
@img/sharp-win32-arm64 0.34.5 Apache-2.0 AND LGPL-3.0-or-later
@img/sharp-win32-ia32 0.33.5 Apache-2.0 AND LGPL-3.0-or-later
@img/sharp-win32-ia32 0.34.5 Apache-2.0 AND LGPL-3.0-or-later
@img/sharp-win32-x64 0.33.5 Apache-2.0 AND LGPL-3.0-or-later
@img/sharp-win32-x64 0.34.5 Apache-2.0 AND LGPL-3.0-or-later
axe-core 4.10.3 MPL-2.0
dompurify 3.3.1 (MPL-2.0 OR Apache-2.0)
lightningcss 1.32.0 MPL-2.0
lightningcss-android-arm64 1.32.0 MPL-2.0
lightningcss-darwin-arm64 1.32.0 MPL-2.0
lightningcss-darwin-x64 1.32.0 MPL-2.0
lightningcss-freebsd-x64 1.32.0 MPL-2.0
lightningcss-linux-arm-gnueabihf 1.32.0 MPL-2.0
lightningcss-linux-arm64-gnu 1.32.0 MPL-2.0
lightningcss-linux-arm64-musl 1.32.0 MPL-2.0
lightningcss-linux-x64-gnu 1.32.0 MPL-2.0
lightningcss-linux-x64-musl 1.32.0 MPL-2.0
lightningcss-win32-arm64-msvc 1.32.0 MPL-2.0
lightningcss-win32-x64-msvc 1.32.0 MPL-2.0
Resolved Packages (10)
Package Version Original Resolved Source
@react-grab/cli 0.1.23 UNKNOWN MIT GitHub repo github.com/aidenybai/react-grab (monorepo, MIT license at root)
@react-grab/cli 0.1.29 UNKNOWN MIT GitHub repo github.com/aidenybai/react-grab (monorepo, MIT license at root)
@react-grab/mcp 0.1.29 UNKNOWN MIT GitHub repo github.com/aidenybai/react-grab (monorepo, MIT license at root)
codemirror-lang-elixir 4.0.0 UNKNOWN Apache-2.0 GitHub repo github.com/livebook-dev/codemirror-lang-elixir — LICENSE file
element-source 0.0.3 UNKNOWN MIT GitHub repo github.com/aidenybai/element-source
lezer-elixir 1.1.2 UNKNOWN Apache-2.0 GitHub repo github.com/livebook-dev/lezer-elixir — LICENSE file
map-stream 0.1.0 UNKNOWN MIT GitHub repo github.com/dominictarr/map-stream — LICENCE file
memorystream 0.3.1 UNKNOWN MIT npm registry — license object {"type":"MIT","url":"http://github.com/JSBizon/node-memorystream/raw/master/LICENSE"}
posthog-js 1.345.5 SEE LICENSE IN LICENSE Apache-2.0 GitHub repo github.com/PostHog/posthog-js — LICENSE file (Apache-2.0 primary, with MIT for some bundled third-party files)
valid-url 1.0.9 UNKNOWN MIT GitHub repo github.com/ogt/valid-url — LICENSE file

@brendan-kellam brendan-kellam merged commit 55c391d into main Apr 14, 2026
8 of 9 checks passed
@brendan-kellam brendan-kellam deleted the brendan/upgrade-vitest-v4 branch April 14, 2026 23: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.

1 participant