diff --git a/packages/sanity/src/core/form/studio/FormBuilderInputErrorBoundary.test.tsx b/packages/sanity/src/core/form/studio/FormBuilderInputErrorBoundary.test.tsx index 297b489ac0e..79db7b51289 100644 --- a/packages/sanity/src/core/form/studio/FormBuilderInputErrorBoundary.test.tsx +++ b/packages/sanity/src/core/form/studio/FormBuilderInputErrorBoundary.test.tsx @@ -1,18 +1,18 @@ -import {beforeAll, describe, expect, it, jest} from '@jest/globals' import {render, screen} from '@testing-library/react' import {type SanityClient} from 'sanity' +import {beforeAll, describe, expect, it, vi} from 'vitest' import {createMockSanityClient} from '../../../../test/mocks/mockSanityClient' import {createTestProvider} from '../../../../test/testUtils/TestProvider' import {FormBuilderInputErrorBoundary} from './FormBuilderInputErrorBoundary' -jest.mock('use-hot-module-reload', () => ({ - useHotModuleReload: jest.fn(), +vi.mock('use-hot-module-reload', () => ({ + useHotModuleReload: vi.fn(), })) describe('FormBuilderInputErrorBoundary', () => { beforeAll(() => { - jest.clearAllMocks() + vi.clearAllMocks() }) it('renders children when there is no error', async () => { @@ -26,7 +26,7 @@ describe('FormBuilderInputErrorBoundary', () => { }) it('calls onUncaughtError when an error is caught', async () => { - const onUncaughtError = jest.fn() + const onUncaughtError = vi.fn() const ThrowErrorComponent = () => { throw new Error('An EXPECTED, testing error occurred!') diff --git a/packages/sanity/src/core/store/_legacy/document/utils/__test__/eventChainUtils.test.ts b/packages/sanity/src/core/store/_legacy/document/utils/__test__/eventChainUtils.test.ts index 94ef846e713..043c8fed5b6 100644 --- a/packages/sanity/src/core/store/_legacy/document/utils/__test__/eventChainUtils.test.ts +++ b/packages/sanity/src/core/store/_legacy/document/utils/__test__/eventChainUtils.test.ts @@ -1,4 +1,4 @@ -import {describe, expect, it} from '@jest/globals' +import {describe, expect, it} from 'vitest' import {discardChainTo, toOrderedChains} from '../eventChainUtils' import {mutationEvent} from './test-utils' diff --git a/packages/sanity/src/core/store/_legacy/document/utils/__test__/sequentializeEvents.test.ts b/packages/sanity/src/core/store/_legacy/document/utils/__test__/sequentializeEvents.test.ts index 87ea9fd485d..024c074492e 100644 --- a/packages/sanity/src/core/store/_legacy/document/utils/__test__/sequentializeEvents.test.ts +++ b/packages/sanity/src/core/store/_legacy/document/utils/__test__/sequentializeEvents.test.ts @@ -1,7 +1,7 @@ /* eslint-disable no-nested-ternary */ -import {expect, test} from '@jest/globals' import {from, lastValueFrom} from 'rxjs' import {toArray} from 'rxjs/operators' +import {expect, test} from 'vitest' import {type MutationPayload} from '../../buffered-doc' import {type ListenerEvent} from '../../getPairListener' diff --git a/packages/sanity/src/core/studio/workspaceLoader/WorkspaceRouterProvider.test.tsx b/packages/sanity/src/core/studio/workspaceLoader/WorkspaceRouterProvider.test.tsx index 14044f080e0..97eadb626d2 100644 --- a/packages/sanity/src/core/studio/workspaceLoader/WorkspaceRouterProvider.test.tsx +++ b/packages/sanity/src/core/studio/workspaceLoader/WorkspaceRouterProvider.test.tsx @@ -1,34 +1,34 @@ -import {describe, expect, it, jest} from '@jest/globals' import {render, screen} from '@testing-library/react' import {type SanityClient, type Workspace} from 'sanity' +import {describe, expect, it, vi} from 'vitest' import {createMockSanityClient} from '../../../../test/mocks/mockSanityClient' import {createTestProvider} from '../../../../test/testUtils/TestProvider' import {WorkspaceRouterProvider} from './WorkspaceRouterProvider' -jest.mock('../router/RouterHistoryContext', () => ({ +vi.mock('../router/RouterHistoryContext', () => ({ useRouterHistory: () => ({ location: {pathname: '/'}, - listen: jest.fn(), + listen: vi.fn(), }), })) -jest.mock('../router', () => ({ +vi.mock('../router', () => ({ createRouter: () => ({ - getBasePath: jest.fn(), - decode: jest.fn(), - isNotFound: jest.fn(), + getBasePath: vi.fn(), + decode: vi.fn(), + isNotFound: vi.fn(), }), })) -jest.mock('sanity/router', () => ({ +vi.mock('sanity/router', () => ({ RouterProvider: ({children}: {children: React.ReactNode}) =>