---
title: "@vitest/spy 5.0.3 Breaking Changes on npm | Since.dev"
description: "What each @vitest/spy release removed, renamed or changed: 65 breaking changes in 10 versions on npm, each with its source."
canonical_url: https://since.dev/packages/npm/@vitest/spy
last_updated: 2026-12-04
---

# @vitest/spy breaking changes

@vitest/spy 5.0.3 (September 30, 2026) is its newest release with breaking changes. The first: Signature changed Mock. Every breaking API change we have recorded in @vitest/spy on npm: 65 breaking changes in 10 versions. Below, its 10 versions with breaking changes, newest first, removals and renames first, each with its source.

Updated December 4, 2026

Latest version `5.1.2`, released November 25, 2026. [Source repository](https://github.com/vitest-dev/vitest)

Packages on npm run on Node.js. [Node.js end of life dates](https://since.dev/calendar/nodejs.md).

- From [4.1.1](#v-4-1-1) to [5.0.3](#v-5-0-3): 2 breaking changes in 2 versions.
- From [4.0.0](#v-4-0-0) to [5.0.3](#v-5-0-3): 42 breaking changes in 7 versions.

## @vitest/spy 5.0.3 breaking changes

@vitest/spy 5.0.3, released September 30, 2026: 1 breaking change.

- **Signature changed** `Mock`  

Was type Mock\<T extends Procedure | Constructable = Procedure> = MockInstance\<T> & (T extends Constructable ? (T extends Procedure ? {new (...args: ConstructorParameters\<T>): InstanceType\<T>; (...args: Parameters\<T>): ReturnType\<T>;}... [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/5.0.3)

## @vitest/spy 5.0.0-rc.1 breaking changes

@vitest/spy 5.0.0-rc.1, released September 3, 2026: 1 breaking change.

- **Behavior changed**  

Class mocks keep their prototype methods on instances, which changes how mocked classes behave. Code that relied on the previous instance shape should be checked. [github.com](https://github.com/vitest-dev/vitest/releases/tag/v5.0.0-rc.1)

## @vitest/spy 4.1.1 breaking changes

@vitest/spy 4.1.1, released March 23, 2026: 2 breaking changes.

- **Signature changed** `MockedFunction`  

Was type MockedFunction\<T extends Procedure | Constructable> = Mock\<T> & {\[K in keyof T\] : T\[K\]}; now type MockedFunction\<T extends Procedure | Constructable> = Mock\<T> & MockedObject\<T>. [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.1.1)
- **Signature changed** `PartiallyMockedFunction`  

Was type PartiallyMockedFunction\<T extends Procedure | Constructable> = PartialMock\<T> & {\[K in keyof T\] : T\[K\]}; now type PartiallyMockedFunction\<T extends Procedure | Constructable> = PartialMock\<T> & MockedObject\<T>. [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.1.1)

## @vitest/spy 4.1.0 breaking changes

@vitest/spy 4.1.0, released March 12, 2026: 2 breaking changes.

- **Signature changed** `MockReturnType`  

Was type MockReturnType\<T extends Procedure | Constructable> = T extends Constructable ? void : T extends Procedure ? ReturnType\<T> : never; now type MockReturnType\<T extends Procedure | Constructable> = T extends Constructable ?... [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.1.0)
- **Signature changed** `PartiallyMockedFunctionDeep`  

Was type PartiallyMockedFunctionDeep\<T extends Procedure | Constructable> = PartialMock\<T> & MockedObjectDeep\<T>; now type PartiallyMockedFunctionDeep\<T extends Procedure | Constructable> = DeepPartialMock\<T> & MockedObjectDeep\<T>. [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.1.0)

## @vitest/spy 4.0.8 breaking changes

@vitest/spy 4.0.8, released November 7, 2025: 1 breaking change.

- **Signature changed** `spyOn`  

Was function spyOn\<T extends object, M extends Classes\<Required\<T>> | Methods\<Required\<T>>>(object: T, key: M): Required\<T>\[M\] extends {new (...args: infer A): infer R;} ? Mock<{new (...args: A): R;}> : Required\<T>\[M\] extends Procedure ?... [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.8)

## @vitest/spy 4.0.6 breaking changes

@vitest/spy 4.0.6, released October 31, 2025: 24 breaking changes.

- **Removed** `Mock.__call`  

Mock.\_\_call was removed in @vitest/spy 4.0.6 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.6)
- **Removed** `Mock.__new`  

Mock.\_\_new was removed in @vitest/spy 4.0.6 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.6)
- **Removed** `Mock.getMockImplementation`  

Mock.getMockImplementation was removed in @vitest/spy 4.0.6 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.6)
- **Removed** `Mock.getMockName`  

Mock.getMockName was removed in @vitest/spy 4.0.6 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.6)
- **Removed** `Mock.mock`  

Mock.mock was removed in @vitest/spy 4.0.6 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.6)
- **Removed** `Mock.mockClear`  

Mock.mockClear was removed in @vitest/spy 4.0.6 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.6)
- **Removed** `Mock.mockImplementation`  

Mock.mockImplementation was removed in @vitest/spy 4.0.6 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.6)
- **Removed** `Mock.mockImplementationOnce`  

Mock.mockImplementationOnce was removed in @vitest/spy 4.0.6 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.6)
- **Removed** `Mock.mockName`  

Mock.mockName was removed in @vitest/spy 4.0.6 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.6)
- **Removed** `Mock.mockRejectedValue`  

Mock.mockRejectedValue was removed in @vitest/spy 4.0.6 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.6)

And 14 more in this version. [Sign up to see every change](https://app.since.dev/login?mode=signup&src=package-page)

## Older versions

4 older versions, each with its first changes. [Sign up to see every change](https://app.since.dev/login?mode=signup&src=package-page)

### @vitest/spy 4.0.4 breaking changes

@vitest/spy 4.0.4, released October 27, 2025: 11 breaking changes.

- **Signature changed** `MaybeMocked`  

Was type MaybeMocked\<T> = T extends Procedure ? MockedFunction\<T> : T extends object ? MockedObject\<T> : T; now type MaybeMocked\<T> = T extends Procedure | Constructable ? MockedFunction\<T> : T extends object ? MockedObject\<T> : T. [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.4)
- **Signature changed** `MaybeMockedConstructor`  

Was type MaybeMockedConstructor\<T> = T extends new (...args: Array\<any>) => infer R ? Mock<(...args: ConstructorParameters\<T>) => R> : T; now type MaybeMockedConstructor\<T> = T extends Constructable ? Mock\<T> : T. [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.4)

And 9 more in this version.

### @vitest/spy 4.0.0 breaking changes

@vitest/spy 4.0.0, released October 22, 2025: 21 breaking changes.

- **Removed** `mocks`  

mocks was removed in @vitest/spy 4.0.0 [npmjs.com](https://www.npmjs.com/package/@vitest/spy/v/4.0.0)
- **Behavior changed**  

The spying implementation was rewritten, so spy and module mocking behavior may differ from 3.x. Review existing spy and vi.mock usage after upgrading. [github.com](https://github.com/vitest-dev/vitest/releases/tag/v4.0.0)

And 19 more in this version.

### @vitest/spy 4.0.0-beta.6 breaking changes

@vitest/spy 4.0.0-beta.6, released October 22, 2025: 1 breaking change.

- **Behavior changed**  

The spying implementation was rewritten, so existing mocks and spies may behave differently. Review tests that rely on previous spy behavior. [github.com](https://github.com/vitest-dev/vitest/releases/tag/v4.0.0-beta.6)

### @vitest/spy 4.0.0-beta.2 breaking changes

@vitest/spy 4.0.0-beta.2, released October 22, 2025: 1 breaking change.

- **Behavior changed**  

The spy implementation now supports spying on classes, which changes how spies on classes behave. Review existing class spies in tests. [github.com](https://github.com/vitest-dev/vitest/releases/tag/v4.0.0-beta.2)

## Related packages

- [@vitest/ui](https://since.dev/packages/npm/@vitest/ui.md)
- [@vitest/expect](https://since.dev/packages/npm/@vitest/expect.md)
- [@vitest/browser](https://since.dev/packages/npm/@vitest/browser.md)
- [@vitest/browser-playwright](https://since.dev/packages/npm/@vitest/browser-playwright.md)
- [vitest](https://since.dev/packages/npm/vitest.md)
- [@vitest/coverage-istanbul](https://since.dev/packages/npm/@vitest/coverage-istanbul.md)

## Check your code

These are the changes. To see which of them reach your code, [scan a public repository](https://since.dev/scan.md), or have your coding agent call `check_code` with your manifest or lockfile over [MCP](https://since.dev/docs.md#mcp). [The API](https://since.dev/docs.md#api) reads every change in every version. A fix pull request opens for the changes that reach a connected repository. Nothing merges or deploys.

## Put your code on continuous maintenance.

Scan a public repository now, or give your agent one line.

[Scan a repository](https://since.dev/scan.md). Any public GitHub repository. No sign-in.

### Tell your agent what changed since it was trained.

`claude mcp add --transport http since https://api.since.dev/mcp`

[Get an API key](https://app.since.dev/login?mode=signup)

Codex, Cursor and any MCP client use https://api.since.dev/mcp.

---

Every page on this site as Markdown: https://since.dev/sitemap.md. For agents: https://since.dev/llms.txt.
