From 3de18b81f7913eb309c5f31492e38a21a7ef52eb Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 15:27:56 +0100 Subject: [PATCH] docs: fix `mock.instances` docs example to use a constructible mock implementation (#10288) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sheremet-va <16173870+sheremet-va@users.noreply.github.com> --- docs/api/mock.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.51.2