@vitest/spy
5.0.5 · 15 Oct 2026MIT202.7M / weekRepositoryHomepagenpmAtom feed
0.34.7 is the newest release of 0.29.x.
In short
6 breaking7 new4 fixed
- breaking
One of the breaking changes includes adding a link to snapshots inside snapshot files, meaning you will need to update all your snapshots.
- breaking
Vitest as peer dependency for coverage packages
- breaking
Coverage-c8 to use V8 profiler directly instead of
NODE_V8_COVERAGE - breaking
Add a link to the comment at the top of the snapshot file
- breaking
Always run separate environments in isolation
- breaking
Use child_process when --no-threads is used
Release note
This release makes some significant changes to how tests are running. If you were using --no-threads before, you might consider enabling --single-thread instead (because your tests are now running in child_process instead of a worker thread) or try our new performance optimization feature (discussed later). If you were relying on API that was not available inside a worker (like process.chdir(), you can now use this option.
One of the potential breaking bug fixes is that environments do not share the same global scope anymore if you run them with --no-isolate, --no-threads or --single-thread - you might need to update your setup files if you were relying on a global variable before.
If you had performance issues on large code bases before, try the new deps.experimentalOptimizer option instead of disabling threads. Feedback is welcome!
One of the breaking changes includes adding a link to snapshots inside snapshot files, meaning you will need to update all your snapshots.
Breaking Changes
- breaking
Vitest as peer dependency for coverage packages
- breaking
Coverage-c8 to use V8 profiler directly instead of
NODE_V8_COVERAGE - breaking
Add a link to the comment at the top of the snapshot file
- breaking
Always run separate environments in isolation
Tests with
nodeandjsdom(and other environments) now don't share the same global scope, if you run them with--no-isolateor--no-threadsflag. Vitest doesn't provide a way to restore the previous behavior as it is considered a bug.
- breaking
Use child_process when --no-threads is used
Tests inside
chid_processmight run longer due to the communication overhead. If you want to restore the previous behavior, use--single-thread.
Features
Add test seed to banner
Use custom source-map-support implementation
Add an option to enable Vite optimizer
coverage: Add support for coverage reporter options
coverage: Automatic threshold updating
spy: Implement mock.withImplementation API
vite-node: Cli option for vite mode
Bug Fixes
Wait for console.log to print a message before terminating a worker
Cleanup last mocked cache when call vi.doMock
Reload changed configuration file on watch mode
coverage: Custom providers to work inside worker threads