@vitest/spy
5.0.5 · 15 Oct 2026MIT202.7M / weekRepositoryHomepagenpmAtom feed
3.2.7 is the newest release of 3.x.
In short
11 breaking39 new59 fixed1 internal
- breaking
There are a few breaking changes, but we expect the migration to be smooth.
- breaking
spy.mockResetchanges - breaking
Pass down context to test hooks
- breaking
Support Vite 6
- breaking
coverage: Always exclude test files
- breaking
deps: Update fake-timers to v14.0.0
- breaking
expect: Check more properties for error equality
- breaking
runner: Support
describe(..., { shuffle: boolean })and inherit from parent suite
Release note
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.mockResetchanges - breaking
Pass down context to test hooks
- breaking
Support Vite 6
- breaking
coverage: Always exclude test files
- breaking
deps: Update fake-timers to v14.0.0
- breaking
expect: Check more properties for error equality
- breaking
runner: Support
describe(..., { shuffle: boolean })and inherit from parent suite - breaking
snapshot: Reset snapshot state for
retryandrepeats - breaking
spy: SpyOn reuses mock if method is already spyed on
- breaking
vitest: Don't expose default toFake config
Features
Support inline
diffoptions and supportprintBasicPrototypeAllow a custom note when calling
ctx.skip()dynamicallyAllow 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/nodeentry point and statically on Vitestdiff.printBasicPrototype: falseby defaultPrepare 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.forapi: Add onBrowserInit event
browser: Support
actionTimeoutas playwright provider optionsbrowser: Support clipboard api
userEvent.copy, cut, pastebrowser: Implement locator.nth()
cli: Support excluding projects with
--project=!patterncli: Support specifying a line number when filtering tests
cli: Support location filters for suites
coverage:
thresholdsto support maximum uncovered itemsexpect: Add
toHaveBeenCalledExactlyOnceWithexpect matcherexpect: Add
toHaveBeenCalledAfterandtoHaveBeenCalledBeforeutilityexpect: Add
toSatisfyasymmetric matcherexpect: Add
toBeOneOfmatcherreporter: Add support for function type to classname option in the junit reporter
reporters:
summaryoption forverboseanddefaultreportersrunner: Test context can inject values from the config's
providerunner: Add "queued" state
snapshot: Provide
configtoresolveSnapshotPathui: Allow run individual tests/suites from the UI
ui: Make clicking on a test in the UI open the report section and scroll to the test failure if applicable
ui: Allow hide/show node_modules in module graph tab
vitest: Include
coverageMapin json reportvitest: Add
onTestsRerunmethod to global setup context
Bug Fixes
Misc fix for vite 6 ecosystem ci
Respect
cacheDirwhen optimizer is enabledReset runningPromise after
finallyin case there is an error to avoid it getting stuckRevert support for Vite 6
Support Node 21
Don't use
Customtype internallyPersist cli filters as watch mode file filter
Don't use dim color for succeeded tests
Fix missing chai types
cancelCurrentRunawaitsrunningPromiseAdd Locator typings for nth, first and last.
Batch console logs by microtask
Allow
getMockImplementationto return "once" implementationcapturePrintErrorlogger duplicate event handlersAllow slots in vitest-browser-vue
Reset root workspace project on restart
Cleanup
vitest/reportersentrypointColors on
forkspoolExport
VitestRunnertype fromvitest/runnersReturn test fn result to runner
Re-apply default conditions if using vite 6 or later
Prevent infinite loop on prettyDOM calls
api: Don't report events during
vitest listbenchmark: Disable type testing while benchmarking
benchmark: Rewrite reporter without
log-updatebrowser: Improve source maps when
vi.mockis presentbrowser: Explain TypeScript support in docs and add asymmetric matchers to types
browser: Fix matchers.d.ts
browser: Fix user event state on preview provider
browser: Fix provider options types
browser: Only use locator.element on last expect.element attempt
browser: Use correct project when filtering
entriesin the browser modebrowser: Fix
console.timewith fake timersbrowser: Add instance validation to resolve coverage error
coverage: Exclude browser mode iframe results
coverage: Correct coverage when
isolate: falseis usedcoverage: Prevent crash when v8 incorrectly merges static_initializer's
deps: Update all non-major dependencies - in #7085
deps: Update all non-major dependencies - in #7116
diff: Truncate to avoid crash on diff large objects
junit: Fix testsuites time to be sum of all testsuite items
pretty-format: Support react 19
reporters: Write buffered stdout/stderr on process exit
reporters: Rewrite
dotreporter withoutlog-updatereporters: Check
--hideSkippedTestsin base reporterreporters: Show
retryandrepeatscountsrunner: Long synchronous tasks does not time out
runner: Mark tests of
describe.todoas'todo'snapshot: Fix "obsolete" message on snapshot update re-run
snapshot: Preserve white space of
toMatchFileSnapshotsnapshot: Fix obsoleteness check of
toMatchSnapshot("...")typecheck: Fix typecheck collect on Vite 6
typecheck: Use unique temp and tsbuildinfo file for each tsconfig file
typecheck: Fix error test case mapping for
@ts-expect-errortypes: Make parameters non-nullable for Playwright options
ui: Wrong module graph when generating html.meta.json.gz in browser mode
ui: Add errors and draft state (*) to the code editor
vite-node: Fix error stack on Windows
vite-node: Properly normalize file url import
vite-node: Fix mandatory node prefix
watch: Don't indicate exit when no matching files
workspace:
extends: truecorrectly inherits all root config properties