diff --git a/docs/guide/mocking/globals.md b/docs/guide/mocking/globals.md index fe195628c..28e84332d 100644 --- a/docs/guide/mocking/globals.md +++ b/docs/guide/mocking/globals.md @@ -7,12 +7,12 @@ By default, Vitest does not reset these globals, but you can turn on the [`unstu ```ts import { vi } from 'vitest' -const IntersectionObserverMock = vi.fn(() => ({ - disconnect: vi.fn(), - observe: vi.fn(), - takeRecords: vi.fn(), - unobserve: vi.fn(), -})) +const IntersectionObserverMock = vi.fn(class { + disconnect = vi.fn() + observe = vi.fn() + takeRecords = vi.fn() + unobserve = vi.fn() +}) vi.stubGlobal('IntersectionObserver', IntersectionObserverMock)