Chore: Upgrade Vitest to v4 (#7797)

## Summary

https://vitest.dev/guide/migration.html#vitest-4

## Changes

- **What**: Update Vitest and some associated dependencies
- **What**: Fix issue with our existing mocks and mock types

## Review Focus

Double check the test updates. I tried to keep the changes minimal.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7797-Chore-Upgrade-Vitest-to-v4-2d96d73d3650810cbe3ac42d7bd6585a)
by [Unito](https://www.unito.io)

---------

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Alexander Brown
2025-12-29 19:24:35 -08:00
committed by GitHub
parent 91ed58acc9
commit 3ae2b52649
22 changed files with 615 additions and 576 deletions

View File

@@ -120,7 +120,9 @@ describe('useLoad3dViewer', () => {
forceRender: vi.fn()
}
vi.mocked(Load3d).mockImplementation(() => mockLoad3d)
vi.mocked(Load3d).mockImplementation(function () {
Object.assign(this, mockLoad3d)
})
mockLoad3dService = {
copyLoad3dState: vi.fn().mockResolvedValue(undefined),
@@ -198,7 +200,7 @@ describe('useLoad3dViewer', () => {
})
it('should handle initialization errors', async () => {
vi.mocked(Load3d).mockImplementationOnce(() => {
vi.mocked(Load3d).mockImplementationOnce(function () {
throw new Error('Load3d creation failed')
})
@@ -312,7 +314,7 @@ describe('useLoad3dViewer', () => {
})
it('should handle watcher errors gracefully', async () => {
mockLoad3d.setBackgroundColor.mockImplementationOnce(() => {
mockLoad3d.setBackgroundColor.mockImplementationOnce(function () {
throw new Error('Color update failed')
})