@vitest/expect breaking changes
Updated December 4, 2026
On this page
Latest version 5.1.2, released November 25, 2026. Source repository
Packages on npm run on Node.js. Node.js end of life dates.
- From 4.1.3 to 5.1.1: 90 breaking changes in 8 versions.
- From 4.0.0 to 5.1.1: 118 breaking changes in 15 versions.
@vitest/expect 5.1.1 breaking changes
- Behavior changed
Timeout errors are now thrown as dedicated timeout error classes rather than generic Error instances, so code checking error types may need to be updated. github.com
@vitest/expect 5.1.0 breaking changes
- Default changed
The browser trace view now opens in failure-only mode by default. Users who want the previous behavior must change the trace view setting. github.com - Default changed
The default browser mode port is now 23315. Code or configs relying on the previous default port must set it explicitly. github.com
@vitest/expect 5.0.0 breaking changes
- Signature changed
Assertion
Was interface Assertion<T = any> extends VitestAssertion<Chai.Assertion, T>, JestAssertion<T>, ChaiMockAssertion, Matchers<T>; now interface Assertion<R extends void | Promise<void> = void, T = unknown> extends... npmjs.com - Signature changed
Assertion.rejects
Was rejects: PromisifyAssertion<T>; now rejects: PromisifyAssertion<unknown>. npmjs.com - Signature changed
Assertion.toBeTypeOf
Was toBeTypeOf: (expected: "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined") => void; now toBeTypeOf: (expected: "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" |... npmjs.com - Signature changed
Assertion.toHaveBeenCalledAfter
Was toHaveBeenCalledAfter: (mock: MockInstance, failIfNoFirstInvocation?: boolean) => void; now toHaveBeenCalledAfter: (mock: MockInstance, failIfNoFirstInvocation?: boolean) => R. npmjs.com - Signature changed
Assertion.toHaveBeenCalledBefore
Was toHaveBeenCalledBefore: (mock: MockInstance, failIfNoFirstInvocation?: boolean) => void; now toHaveBeenCalledBefore: (mock: MockInstance, failIfNoFirstInvocation?: boolean) => R. npmjs.com - Signature changed
Assertion.toHaveBeenCalledExactlyOnceWith
Was toHaveBeenCalledExactlyOnceWith: <E extends any[]>(...args: E) => void; now toHaveBeenCalledExactlyOnceWith: <E extends any[]>(...args: E) => R. npmjs.com - Signature changed
Assertion.toHaveBeenCalledOnce
Was toHaveBeenCalledOnce: () => void; now toHaveBeenCalledOnce: () => R. npmjs.com - Signature changed
Assertion.toHaveLastResolvedWith
Was toHaveLastResolvedWith: <E>(value: E) => void; now toHaveLastResolvedWith: <E>(value: E) => R. npmjs.com - Signature changed
Assertion.toHaveNthResolvedWith
Was toHaveNthResolvedWith: <E>(nthCall: number, value: E) => void; now toHaveNthResolvedWith: <E>(nthCall: number, value: E) => R. npmjs.com - Signature changed
Assertion.toHaveResolved
Was toHaveResolved: () => void; now toHaveResolved: () => R. npmjs.com
And 70 more in this version. Sign up to see every change
@vitest/expect 5.0.0-rc.1 breaking changes
- Behavior changed
An asynchronous assertion that is not awaited now fails the test. Add await to every async expect call. github.com - Signature changed
Types for expect and matchers were changed to handle promises better, which may cause type errors in existing typed code. github.com
@vitest/expect 5.0.0-beta.4 breaking changes
- Behavior changed
toHaveTextContent
toHaveTextContent now uses strict matching. Use toMatchTextContent for the previous looser matching. github.com
@vitest/expect 5.0.0-beta.3 breaking changes
- Behavior changed
expect.poll
expect.poll fails the test if the function has not resolved within the timeout instead of passing silently. github.com
Older versions
11 older versions, each with its first changes. Sign up to see every change
Show 11 older versions
@vitest/expect 5.0.0-beta.2 breaking changes
- Removed
The expect package is folded into Vitest and is no longer published on its own. Code importing it directly must change. github.com
@vitest/expect 5.0.0-beta.1 breaking changes
- Behavior changed
Value formatting in output changes because loupe.inspect is replaced by pretty-format. Check snapshots or custom output that depended on the old format. github.com - Behavior changed
toThrow
toThrow("") behaves as it did before the earlier change in #6710. Check tests that relied on the newer behavior. github.com
@vitest/expect 4.1.3 breaking changes
- Removed
JestExtendError.context
The context property is no longer included when verbose error reporting is used. Code that reads JestExtendError.context from verbose error output must stop relying on it. github.com - Removed
MatcherState.task
MatcherState.task was removed in @vitest/expect 4.1.3 npmjs.com
And 1 more in this version.
@vitest/expect 4.1.1 breaking changes
- Behavior changed
Vitest 4.1.1 no longer supports the vite 8 beta prerelease; users on vite 8.beta must upgrade to a supported vite version. github.com - Signature changed
ChaiMockAssertion.returned
Was readonly returned: Assertion; now returned: <E>(value: E) => void. npmjs.com
And 1 more in this version.
@vitest/expect 4.1.0 breaking changes
- Removed
JestAssertion.lastCalledWith
JestAssertion.lastCalledWith was removed in @vitest/expect 4.1.0 npmjs.com - Removed
JestAssertion.lastReturnedWith
JestAssertion.lastReturnedWith was removed in @vitest/expect 4.1.0 npmjs.com
And 12 more in this version.
@vitest/expect 4.1.0-beta.4 breaking changes
- Removed
deepEqual
The deepEqual option can no longer be set in the chai config because it is not serializable. Remove it from your config. github.com
@vitest/expect 4.0.14 breaking changes
- Removed
prepare
The prepare hook was removed in this release. Code that relies on prepare must be updated. github.com - Renamed
collect
The collect name was changed to import. Code that refers to collect must use import instead. github.com
@vitest/expect 4.0.9 breaking changes
- Signature changed
AsymmetricMatchersContaining.toBeOneOf
Was toBeOneOf: <T>(sample: Array<T>) => any; now toBeOneOf: <T>(sample: Array<T> | Set<T>) => any. npmjs.com - Signature changed
JestAssertion.toBeOneOf
Was toBeOneOf: <T>(sample: Array<T>) => any; now toBeOneOf: <T>(sample: Array<T> | Set<T>) => any. npmjs.com
And 1 more in this version.
@vitest/expect 4.0.6 breaking changes
- Behavior changed
Test environments are now reused when isolation and file parallelism are both disabled. Code relying on fresh environments per file may need review. github.com - Behavior changed
Browser setup files are now re-evaluated on every test run, which may change state carried between runs. github.com
@vitest/expect 4.0.0 breaking changes
- Behavior changed
Asymmetric matchers get the equality testers in use at the call site instead of their own. Check custom equality testers that rely on the old behavior. github.com - Behavior changed
expect.objectContaining
The objectContaining matcher was changed to behave more like Jest's version, so assertions that depended on the previous matching may now give different results. github.com
And 9 more in this version.
@vitest/expect 4.0.0-beta.11 breaking changes
- Behavior changed
Custom asymmetric matchers are now called with the current equality testers. Code that relies on the previous calling convention may need to be updated. github.com
Related packages
- @vitest/ui
- @vitest/browser
- @vitest/browser-playwright
- vitest
- @vitest/coverage-istanbul
- @vitest/coverage-v8
Check your code
These are the changes. To see which of them reach your code, scan a public repository, or have your coding agent call check_code with your manifest or lockfile over MCP. The 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.
See how out of date your code is.
Tell your agent what changed since it was trained.
claude mcp add --transport http since https://api.since.dev/mcpCodex, Cursor and any MCP client use https://api.since.dev/mcp.