diff --git a/docs/api/mock.md b/docs/api/mock.md index 0211bfd17..8407a7024 100644 --- a/docs/api/mock.md +++ b/docs/api/mock.md @@ -692,7 +692,9 @@ MyClass.mock.instances[0] === a If you return a value from the constructor, it will not be in the `instances` array, but instead inside `results`: ```js -const Spy = vi.fn(() => ({ method: vi.fn() })) +const Spy = vi.fn(function () { + return { method: vi.fn() } +}) const a = new Spy() Spy.mock.instances[0] !== a