Write createSpy(implementation), the core of vi.fn(). It returns a function that records every call and then runs the optional implementation, returning its result. It also carries: calls (an array of argument arrays), callCount(), calledWith(...args) (true if any call had exactly those arguments, compared with JSON.stringify), mockReturnValue(value) (from then on return value instead of running the implementation; returns the spy for chaining) and reset() (forget calls and the mocked return value, keeping the implementation).