Conversation
Co-authored-by: nickgros <17580037+nickgros@users.noreply.github.com>
Migrating to Vitest 4.0Migrating to Vitest 4.0 {#vitest-4}V8 Code Coverage Major ChangesVitest's V8 code coverage provider is now using more accurate coverage result remapping logic. In the past Vitest used
Removed Options
|
Co-authored-by: nickgros <17580037+nickgros@users.noreply.github.com>
Done in cd96f5e. Upgraded |
Upgrades all Vitest-related packages to v4 and fixes breaking changes introduced by the new version.
Package upgrades
vitest,@vitest/coverage-v8,@vitest/ui,@vitest/utils:^3.x→^4.0.18across all workspace packagesvitest-when:^0.6.0→^0.10.0@vitest/eslint-plugin:^1.2.1→^1.6.9vite-configpeer dependencies updated to^4.0.18react-intersection-observer:^9.16.0→^10.0.3Breaking change fixes
Vitest 4 now enforces that
vi.fn()implementations must usefunction/classsyntax (not arrow functions) when the mock is called as a constructor vianew.UploadToS3.test.tsChanged arrow function implementations to regular functions in
vi.fn().mockImplementation():react-intersection-observerupgradereact-intersection-observer/test-utilsv9 passed an arrow function tovi.fn()for theIntersectionObservermock, which Vitest 4 would reject when used as a constructor. Upgrading to v10 resolves this — v10'stest-utilsuses a named regular function (function IntersectionObserverMock(...)) that is compatible with Vitest 4's constructor requirements.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.