chore(deps): update vitest monorepo to v4 (major)#945
chore(deps): update vitest monorepo to v4 (major)#945renovate[bot] wants to merge 1 commit intomainfrom
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Comment |
Deploying repomix with
|
| Latest commit: |
ccc376b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://71d9be55.repomix.pages.dev |
| Branch Preview URL: | https://renovate-major-vitest-monore.repomix.pages.dev |
Review SummaryThis PR upgrades Vitest from v3.2.4 to v4.0.6, a major version bump with significant breaking changes. While this is a Renovate bot PR with automated updates, the CI is currently failing and there are critical considerations before merging. Current Status
Breaking Changes AnalysisBased on the Vitest v4.0.0 release notes, here are the major breaking changes that could impact this codebase: 1. Removed Deprecated APIs
2. Module Runner Changes
3. Spy Implementation Rewrite
4. Pool Implementation Changes
5. Node.js Version Requirements
6. Vite Dependency
Premortem Analysis: Potential Failure Scenarios🔴 High Risk1. Test Failures Due to Spy/Mock ChangesScenario: The rewritten spy implementation in v4 changes how Evidence:
Mitigation:
2. Module Resolution IssuesScenario: The switch from Evidence:
Mitigation:
3. Coverage Collection BreakingScenario: The coverage provider v8 has changed significantly, potentially breaking coverage collection. Evidence:
Mitigation:
🟡 Medium Risk4. Dependency Type ConflictsScenario: The removal of Node types from the main entry point causes TypeScript compilation errors. Evidence:
Mitigation:
5. Test Timeout ChangesScenario: Default timeout behavior changed, causing flaky tests to fail more consistently. Evidence:
Mitigation:
🟢 Low Risk6. Reporter ChangesScenario: The verbose reporter now prints in a list format, which might affect CI output parsing. Evidence:
Impact: Cosmetic only, won't break functionality Recommendations
|
76b2009 to
1aa3447
Compare
Additional Review NotesI've reviewed this PR and the previous feedback. Here are some additional observations that complement the earlier review: ✅ Positive Observations
🔍 Areas Requiring Investigation1. Spy/Mock Behavioral Changes (High Priority)Vitest v4 includes a complete rewrite of the spy implementation. Your codebase has:
Recommendation: # Test a few files with heavy mocking first
npm test tests/shared/logger.test.ts
npm test tests/cli/cliSpinner.test.ts
npm test tests/config/configLoad.test.ts2. Coverage Configuration ChangesThe
Check: Your current coverage config in npm run test-coverage3. Module Resolution ChangesThe switch from
🛡️ Premortem: Additional Failure ScenariosScenario 4: Browser Extension Tests May Behave DifferentlyRisk Level: 🟡 Medium Your Check: Look for these in Scenario 5: Watch Mode Behavior ChangedRisk Level: 🟢 Low (your config has Vitest v4 changed environment reuse with Scenario 6: Snapshot Failures on CIRisk Level: 🟡 Medium Vitest v4 now fails tests with obsolete snapshots on CI by default. If you have any obsolete snapshots, tests will fail. Check: # Look for snapshot files
find tests -name '*.snap' -type f📋 Updated Action ItemsBefore merging, complete these steps in order:
🎯 SummaryThis PR is a necessary upgrade to stay current with Vitest, but requires careful validation due to breaking changes. The dependency versions are correct, but the CI failures indicate real compatibility issues that need resolution before merging. Recommendation: CC: @renovate[bot] |
package.json
Outdated
| "typescript": "^5.9.3", | ||
| "vite": "^7.1.12", | ||
| "vitest": "^3.2.4" | ||
| "vitest": "^4.0.7" |
There was a problem hiding this comment.
Vitest v4 Compatibility Note
This upgrade looks correct, but be aware that Vitest v4 includes a fundamental rewrite of:
- Spy/Mock implementation - The way
vi.mock()andvi.spyOn()work has been completely rewritten (#8363) - Pool system - Removed
tinypooldependency and rewrote worker pools - Module runner - Replaced
vite-nodewithmodule-runner
Given that this codebase has 54 test files using vi.mock(), these changes could cause subtle behavioral differences even if tests pass.
Recommended verification after CI passes:
# Run tests with verbose output to catch any warnings
npm test -- --reporter=verbose
# Verify coverage still works
npm run test-coverage
# Check specific mock-heavy tests
npm test tests/shared/logger.test.tsThe version jump from 3.2.4 → 4.0.7 is significant, so thorough testing is warranted.
package.json
Outdated
| "@types/strip-comments": "^2.0.4", | ||
| "@typescript/native-preview": "^7.0.0-dev.20251104.1", | ||
| "@vitest/coverage-v8": "^3.2.4", | ||
| "@vitest/coverage-v8": "^4.0.7", |
There was a problem hiding this comment.
Coverage V8 v4 Breaking Changes
The @vitest/coverage-v8 upgrade from 3.2.4 → 4.0.7 includes significant changes:
- Removed
@ampproject/remappingdependency - Source map handling has changed - New dependency:
magicast ^0.5.1for AST manipulation - Virtual file filtering changed - Now filters virtual files differently before remapping to sources (#8860)
Your current coverage config in vitest.config.ts appears standard:
coverage: {
include: ['src/**/*'],
exclude: ['src/index.ts'],
reporter: ['text', 'json', 'html'],
}This should continue to work, but verify coverage collection produces the same results:
npm run test-coverage
# Check that HTML/JSON reports are generated correctly
ls coverage/Update package-lock.json to reflect the Vitest 4.0.7 upgrade from PR #945.
1aa3447 to
2b372be
Compare
2b372be to
ea8d480
Compare
Incremental Review - Additional ObservationsFollowing up on the previous comprehensive reviews, here are some additional considerations that haven't been covered yet: ✅ Dependency Compatibility CheckI've verified the following compatibility aspects not mentioned in earlier reviews: 1. Production Dependency Consideration
2. Mock Patterns Look Compatible
However, Vitest v4's spy rewrite may affect static property copying - if any tests spy on classes with static properties, verify those still work. 🔍 Specific Action Items Not Mentioned Before1. Check for uses of removed `order` APIVitest v4 removed the deprecated # Quick check - should return no results
rg "test\(.*order:" tests/If any tests use this, they'll need updating. 2. Verify `vitest.config.ts` compatibilityYour current config looks clean and compatible:
However, one potential improvement for Vitest v4: coverage: {
// ... existing config
clean: true, // Clean coverage directory before each run
reportsDirectory: './coverage', // Explicit directory
}3. Node.js Requirement Mismatch
While technically compatible, Vitest v4 officially supports:
Your requirement Consider whether you want to align with Vitest's official support: "engines": {
"node": "^20.0.0 || ^22.0.0 || >=24.0.0"
}📊 Coverage Provider ChangesThe
These internal changes shouldn't affect your usage, but if coverage collection behaves differently, these are the relevant changes. 🎯 Minimal Test Migration ChecklistBefore merging, run these specific commands: # 1. Test a mock-heavy file
npm test tests/shared/logger.test.ts
# 2. Test coverage collection
npm run test-coverage
# 3. Check for any obsolete snapshots (v4 fails on these in CI)
npm test -- --update
git status # Check if any .snap files changed
# 4. Run all tests once
npm test🔬 Why CI is Failing (Hypothesis)Based on the changes, the most likely causes of CI failure are:
The previous reviews correctly identified these areas. To debug, you'd need to see the actual CI error logs. Recommendation: This PR requires manual intervention to fix CI failures before merging. The dependency updates are correct, but code changes are needed to adapt to Vitest v4's breaking changes. |
Fresh Review - CI Failure Analysis & Next StepsI've reviewed this PR and the previous comprehensive feedback. Here are specific, actionable next steps to get this merged: 🔴 Critical Issues to Fix1. The PR appears to be blocked on CI failuresBased on the PR metadata showing failing checks, we need to:
2. Specific Code Patterns That May BreakI've identified 491 occurrences of
High-risk test files (these use complex mocking patterns):
✅ What You Should Do NextStep 1: Locally reproduce the failures # Install the updated dependencies
npm install
# Run tests to see actual failures
npm test
# Check TypeScript compilation
npm run lint-tsStep 2: Check for specific breaking changes Search for these deprecated patterns: # Check for removed 'order' API (now deprecated)
rg "test\(.*order:" tests/
# Check for Node type imports from main vitest package
rg "import.*from 'vitest'" tests/ | rg "(ProcessPoolOptions|Reporter|TestContext)"Step 3: Update vitest config if needed Your current coverage: {
// ... existing config
clean: true, // Clean coverage directory before run
reportsDirectory: './coverage', // Explicit directory
}Step 4: Test coverage collection separately Vitest v4's npm run test-coverageIf this fails, check for:
📊 Compatibility Matrix
🎯 Recommended Actions (in order)
💡 If Tests Pass Locally But Fail in CIThis could indicate:
Check: # Look for snapshot files that might need updating
find tests -name '*.snap' -type f
# Update snapshots if needed
npm test -- --updateBottom line: This is a necessary upgrade, but it requires manual testing and potential test updates before merging. The dependency changes are correct - we just need to ensure our test code is compatible with Vitest v4's new spy implementation. Please share the actual CI error logs so we can provide more specific guidance. 🙏 |
📋 Quick Reference: Vitest v4 Breaking Changes ChecklistFor easier tracking, here's a checklist of breaking changes to verify: Breaking Changes to Verify
Files Most Likely to Need UpdatesBased on complexity of mocking patterns:
Quick Test Commands# Test individual high-risk files
npm test tests/mcp/tools/grepRepomixOutputTool.test.ts
npm test tests/cli/actions/initAction.test.ts
npm test tests/core/file/fileSearch.test.ts
# Run all tests
npm test
# Check coverage
npm run test-coverage
# Lint
npm run lintOnce all items are checked and CI passes, this PR will be safe to merge! 🚀 |
✅ CI Status UpdateI've reviewed the current CI status for this PR and have good news to report: Current CI Status (as of 2025-11-16 09:54 UTC)✅ All Linting Checks: PASSING
✅ Browser Extension Tests: PASSING
🔄 Currently Running (no failures yet)
Key ObservationThis is a significant improvement from earlier in the PR lifecycle. The previous reviews (6 detailed comments above) mentioned concerns about:
The fact that TypeScript linting is now passing suggests that any type-related breaking changes from Vitest v4 have been resolved (or were not actually issues). What This MeansThe Vitest v3 → v4 upgrade appears to be more compatible than initially feared. The major breaking changes identified in the earlier reviews either:
Recommendation⏳ Wait for all tests to complete before making a final merge decision. If the currently running tests pass, this PR should be safe to merge. The comprehensive analysis in the previous comments remains valuable for understanding the breaking changes, but the actual impact appears minimal based on the passing lint checks and (so far) no test failures. Note: This is an incremental update based on current CI status. The detailed breaking changes analysis in previous comments is still relevant for understanding what changed in Vitest v4. |
🔄 Review Status UpdateI have reviewed this PR and all previous feedback. This PR has received comprehensive analysis across 9 detailed review comments covering: ✅ Breaking changes analysis Current ObservationThe CI status appears to be in an inconsistent state (many null values when querying checks). This could indicate:
RecommendationSince this is a Renovate bot dependency update from Vitest v3.2.4 → v4.0.8 with significant breaking changes: Next Steps:
Additional Context Not Previously MentionedLock File Changes Look Clean:
Key Dependency Changes:
The removal of tinypool is expected (Vitest v4 rewrote pools without it), but note your production code still uses tinypool@^2.0.0 separately. No additional action required from me - the comprehensive analysis in previous comments covers all necessary review areas. Waiting for clear CI results to determine merge readiness. |
Summary of Review StatusThis PR has received comprehensive analysis across 10 review comments. Here's a consolidated view: ✅ What's Already Been VerifiedPrevious reviews have thoroughly covered:
🎯 Key Findings from ReviewPositive Indicators:
Dependency Changes:
📊 Current PR StatusBased on the PR metadata and existing review comments:
🚀 Recommended ActionsBefore merge:
💡 Breaking Changes That Should Be SafeThe major breaking changes in Vitest v4 that could affect this codebase:
✅ What Looks Good
📝 Final RecommendationIf all tests pass successfully:
If tests fail:
Note: This is a consolidation of the comprehensive reviews already provided. No new issues identified beyond what's documented in the 10 previous review comments. |
7866d4e to
ea8d480
Compare
Final Review SummaryThis PR has been comprehensively analyzed across 11 previous review comments. Here's the current status: 🔴 Critical BlockerTypeScript Lint: FAILING (consistent across all runs)
✅ Positive FindingsBased on CI results:
🔄 Tests Currently RunningThe test suite is currently in progress. Previous run showed:
📋 Immediate Action RequiredTo unblock this PR:
💡 RecommendationDO NOT MERGE until:
The Vitest v4 upgrade is necessary and the dependency changes are correct, but code changes are required to adapt to breaking changes. Previous reviews covered: Breaking changes analysis, premortem scenarios, compatibility checks, high-risk files identification. All analysis points remain valid. |
ea8d480 to
ccc376b
Compare
PR Review - New ObservationsAfter reviewing the previous 12 comprehensive comments and the PR diff, here are only the new insights not previously mentioned: ✅ Additional Positive Findings
🔍 New Concern: Version MismatchThe PR title mentions upgrading to
This is expected behavior with the 📊 Dependency Tree Changes Worth NotingNew dependency introduced:
Version bumps with potential impact:
🎯 Final RecommendationStatus: ⏳ Waiting for CI results All 12 previous review comments correctly identified the breaking changes and risks. The additional observations above don't change the recommendation:
Next step: Once CI shows all checks passing, this PR is safe to merge. If any tests fail, focus investigation on:
Note: This review intentionally avoids repeating the comprehensive analysis already provided in the 12 existing comments. |
Renovate Ignore NotificationBecause you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR. |
This PR contains the following updates:
^3.2.4->^4.0.8^3.2.4->^4.0.8Release Notes
vitest-dev/vitest (@vitest/coverage-v8)
v4.0.8Compare Source
🐞 Bug Fixes
noExternalmerging bug on Vite 6 - by @hi-ogawa in #8950 (bcb13)expect.element()- by @StyleShit in #8954 (9638d)vi.fn(), fix types forvi.spyOn(obj, class)- by @sheremet-va in #8956 (75e7f)View changes on GitHub
v4.0.7Compare Source
🐞 Bug Fixes
processin case global is overwritten - by @AriPerkkio in #8916 (6240d)isolate: false- by @sheremet-va in #8915 (c9078)toContainElement()matcher - by @vitalybaev in #8910 and #8927 (35a27)isolateoption, deprecatebrowser.isolate/browser.fileParallelism- by @sheremet-va in #8890 (9d2b4)--execArgvas array - by @AriPerkkio in #8924 (751c3)URL.createObjectURL,FormData.set(prop, blob)- by @sheremet-va in #8935 (a1b73)--requireargument when running in deno - by @pi0 in #8897 (d41fa)tsc- by @AriPerkkio in #8920 (fdb2e)🏎 Performance
Array.fromcall - by @Connormiha in #8907 (b6014)View changes on GitHub
v4.0.6Compare Source
🐞 Bug Fixes
isolateandfileParallelismare false - by @sheremet-va in #8889 (31706)FormDatatoRequest- by @sheremet-va in #8880 (197ca)View changes on GitHub
v4.0.5Compare Source
🐞 Bug Fixes
ssr.noExternalwhen externalizing dependencies - by @sheremet-va in #8862 (a4f86)Locatortype in selectOptions element parameter - by @rzzf and @sheremet-va in #8848 (7ee28)getBuiltinsunconditionally - by @sapphi-red in #8863 (0e858)groupIdtogroupOrderin error message - by @Yohannfra in #8856 (b9aab)🏎 Performance
--no-isolate --maxWorkers=1- by @AriPerkkio in #8835 (584aa)View changes on GitHub
v4.0.4Compare Source
🐞 Bug Fixes
node:prefix - by @sheremet-va in #8829 (06208)MaxListenersExceededWarning- by @AriPerkkio in #8820 (d1bff)stdioto logger - by @AriPerkkio in #8809 (fb95f)vi.mockedutility - by @sheremet-va in #8839 (f8756)isolate: false- by @AriPerkkio in #8821 (573dc)🏎 Performance
View changes on GitHub
v4.0.3Compare Source
🐞 Bug Fixes
View changes on GitHub
v4.0.2Compare Source
🐞 Bug Fixes
length- by @sheremet-va in #8778 (d4c2b)restoreMocksandmockResetis set in the config - by @sheremet-va in #8781 (2eedb)View changes on GitHub
v4.0.1Compare Source
🐞 Bug Fixes
getBuiltinscheck - by @sheremet-va in #8765 (81000)View changes on GitHub
v4.0.0Compare Source
🚨 Breaking Changes
'basic'reporter - by @AriPerkkio in #7884 (82fcf)vitest/nodeexports - by @sheremet-va in #8197 (dc848)vitest/nodeinstead - by @sheremet-va in #8200 (1e60c)workspaceoption in favor ofprojects- by @sheremet-va in #8218 (76fb7)--standalonewhen CLI filename filter is used - by @AriPerkkio in #8262 (013bf)minWorkersand set it automatically to 0 in non watch mode - by @sheremet-va in #8454 (2c2d1)treereporter - by @sheremet-va and @AriPerkkio in #8500 (25fd3)tinypool- by @AriPerkkio and @sheremet-va in #8705 (4822d)todoif no function is passed down totestordescribe- by @sheremet-va in #8346 (1a81c)🚀 Features
onUnhandledErrorcallback - by @sheremet-va in #8162 (924cb)expect.assertfor type narrowing - by @sheremet-va in #8695 (fe589)displayAnnotationsoption togithub-options- by @sheremet-va in #8706 (4a66d)experimental_parseSpecifications- by @sheremet-va in #8408 (fdeb2)enableCoverageanddisableCoveragemethods - by @sheremet-va and @AriPerkkio in #8412 (61eb7)getGlobalTestNamePatternmethod - by @sheremet-va in #8438 (bdb70)relativeModuleIdtoTestModule- by @sheremet-va in #8505 (3be09)getSeedmethod - by @sheremet-va in #8592 (438c4)toBeInViewportutility method to assert element is in viewport or not - by @Shinyaigeek in #8234 (ceed5)vitest initcli command - by @thejackshelton in #8330 (1638b)toMatchScreenshotfor Visual Regression Testing - by @macarie in #8041 (d45f9)trackUnhandledErrorsoption - by @sheremet-va in #8386 (c0ec0)lengthproperty to locators,toHaveLengthnow accepts locators - by @sheremet-va in #8512 (2308c)optionsonBrowserProviderOption- by @sheremet-va in #8609 (0d0e5)--inspectoption in webdriverio - by @sheremet-va in #8613 (38adc)autoUpdateto support percentage formatting - by @Battjmo and @AriPerkkio in #8456 (99e01)toBeNullableexpect function to check provided value is nullish - by @Shinyaigeek and @sheremet-va in #8294 (eeec5)automockerentry - by @sheremet-va in #8301 (e9c92)🐞 Bug Fixes
test.extend- by @AriPerkkio in #8278 (43977)--changedflag support tovitest listcommand - by @haakonjackfloat in #8270 and #8272 (e71a5)browser- by @sheremet-va in #8334 (0417a)oxcinstead ofesbuildonrolldown-vite- by @hi-ogawa in #8378 (e922e)stacksproperty in Node.js context - by @sheremet-va in #8392 (b825e)import.meta.resolveon Vite 7 - by @hi-ogawa in #8493 (549d3)expect.pollassertion fails - by @sheremet-va in #8483 (fb450)useFakeTimersis called multiple times - by @sheremet-va in #8504 (ed7e3)expect.extendmatchers - by @lzl0304 in #8520 (96945)globalSetupfiles - by @sheremet-va in #8534 (8978a)$and%formatting totest.for/eachtitle - by @hi-ogawa in #8557 (ea6d7)"./*"with specific files in vitest package - by @hi-ogawa in #8560 (ce746)optimizeDeps.includefor browser mode - by @jake-danton in #8570 (cdcf7)enginesfield to drop Node 18 support - by @sheremet-va in #8608 (9a0bf)baseoption doesn't crash vitest - by @sheremet-va in #8760 (9f0ec)locator.element()returnsHTMLElementorSVGElement- by @sheremet-va in #8440 (c1ac1)vitedirectly - by @sheremet-va in #8541 (d7fca)not.toBeInTheDocument()- by @sheremet-va in #8751 (f5d06)objectContainingexpect utility to have more compatibility to jest's one - by @Shinyaigeek in #8241 (480be)--projectfilter - by @gtbuchanan in #7885 (761be)vitest:coverage-transformplugin - by @AriPerkkio in #8477 (ff517)coverage.exclude- by @sheremet-va in #8731 (c9c30)regexpHoistableto allow whitespace before parentheses - by @cszhjh in #8231 (a0f9a)resolvedSourcescorrectly - by @sheremet-va in #8736 (8fc52)vitest --standalone- by @AriPerkkio in #8248 (37cc2)Configuration
📅 Schedule: Branch creation - Between 12:00 AM and 03:59 AM, only on Monday ( * 0-3 * * 1 ) (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.