Packages

@vitest/mocker

5.1.0 · 2 Nov 2026MIT190.8M / weekRepositoryHomepagenpmAtom feed

Your version

3.0.0

major16 Jan 2025Where it was published

3.2.7 is the newest release of 3.x.

In short

5 breaking15 new24 fixed1 internal

  • Breaking

    There are a few breaking changes, but we expect the migration to be smooth.

  • Breaking

    spy.mockReset changes

  • Breaking

    Pass down context to test hooks

  • Breaking

    Support Vite 6

  • Breaking

    deps: Update fake-timers to v14.0.0

Security

2 advisories affect 3.0.0; 4.1.12 fixes them

Release note

The section about @vitest/mocker of a note shared by several packages.

Vitest 3 is here! There are a few breaking changes, but we expect the migration to be smooth. This release page lists all changes made to the project during the beta. For the migration guide, please refer to the documentation.

Breaking Changes

  • Breaking

    spy.mockReset changes

  • Breaking

    Pass down context to test hooks

  • Breaking

    Support Vite 6

  • Breaking

    deps: Update fake-timers to v14.0.0

Features

  • Support inline diff options and support printBasicPrototype

  • Allow a custom note when calling ctx.skip() dynamically

  • Allow inline workspace configuration

  • Provide the current project to the global setup

  • Print project name as a label

  • Print a deprecation warning if suite or test uses object as the third argument

  • Expose versions from vitest/node entry point and statically on Vitest

  • diff.printBasicPrototype: false by default

  • Prepare the Vitest API to be stable

  • Support Vite v6 in mocker package

  • Allow multi-browser configuration

  • Add resolved project names to the reporter API

  • Introduce the new reporter API

  • Add describe.for

Bug Fixes

  • Misc fix for vite 6 ecosystem ci

  • Respect cacheDir when optimizer is enabled

  • Reset runningPromise after finally in case there is an error to avoid it getting stuck

  • Revert support for Vite 6

  • Support Node 21

  • Don't use Custom type internally

  • Persist cli filters as watch mode file filter

  • Don't use dim color for succeeded tests

  • Fix missing chai types

  • cancelCurrentRun awaits runningPromise

  • Add Locator typings for nth, first and last.

  • Batch console logs by microtask

  • Allow getMockImplementation to return "once" implementation

  • capturePrintError logger duplicate event handlers

  • Allow slots in vitest-browser-vue

  • Reset root workspace project on restart

  • Cleanup vitest/reporters entrypoint

  • Colors on forks pool

  • Export VitestRunner type from vitest/runners

  • Return test fn result to runner

  • Re-apply default conditions if using vite 6 or later

  • Prevent infinite loop on prettyDOM calls

  • deps: Update all non-major dependencies - in #7085

  • deps: Update all non-major dependencies - in #7116

  • types: Make parameters non-nullable for Playwright options

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.