@vitest/mocker
5.0.5 · 15 Oct 2026MIT76M / weekRepositoryHomepagenpmAtom feed
71 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 5.x · latest line
5.0.5
15 Oct 2026Keep vite default
fs.denywith api token fileHandle quoted file names in
--changedAdd
datato theimport.meta.hotstub
Bug Fixes
Keep vite default
fs.denywith api token fileHandle quoted file names in
--changedAdd
datato theimport.meta.hotstubSet
skipinskipIf, ignoreundefinedoptionsSkip builtin loading in async leak detector
Keep the import frame in native loader errors
Run hook cleanups when a later hook fails
Release mocks of finished test files
Abort all running tests on cancel
browser: Ignore synthetic pagehide events
browser: Run plugin buildStart on server creation
browser: Drop late connections of closed sessions
browser: Wait 30s for the browser to close
browser: Run global setup once with instances
reporter: End reason
'failed'on worker crash
5.0.4
12 Oct 2026experimental: Tag cache directories with CACHEDIR.TAG
experimental: Support
test.ui.themeoptionexperimental: Highlight selector multiple matches in trace view
Features
experimental: Tag cache directories with CACHEDIR.TAG
experimental: Support
test.ui.themeoptionexperimental: Highlight selector multiple matches in trace view
experimental: Print how many tests were affected and a total when running
--changedexperimental: Add an option to cache dependencies instead of statically parsing them
experimental: Add fit and zoom controls to trace viewer
Bug Fixes
Fail the run on git and location filter errors
Enable fsModuleCache by default
Track project files and mocks with --changed
Refactor caching, fix
:in project and change the shape ofresultscacheKeep full
$string values whentaskTitleValueFormatTruncateis 0Resolve node builtins in client environments
Fix module graph builtin externals after #11421
Wrap module mocks during in-source testing
Handle line endings in snapshot
Respect root in projects
Resolve mocks in directories with spaces
api: Publish the api token atomically
browser: Close the mock route interception race
browser: Allow toHaveTextContent without arguments
browser: Apply API options without browser config
browser: Preserve undefined command arguments
browser: Wait for setup mocks before importing a test file
browser: Avoid extra scroll outside the iframe
browser: Run browser instances as workers
⚠️ This can degrade performance if you have a custom
maxWorkerssetting. Previously, it was applied incorrectly and could lead to Vitest using too many resources. For example, a lower number would still open too many browsers. Fixing it means Vitest opens less instances by default now.
browser: Open one cdp session per tester
browser: Clean up unmocked and pending mocks
coverage: V8 browser memory leak between test files
coverage:
allowExternalfails to include uncovered filescoverage: Filenames containing brackets incorrectly showing as uncovered
coverage: Istanbul coverage wrong when module transform warmups
deps: Update all non-major dependencies
expect: Fix
MapandSetdeep equality in some assertionsexpect: Check value in chai-style returned
mocker: Fix native loader mocking edge cases
pretty-format: Support boxed symbols
reporters: Junit to strip ANSI sequences from all XML attributes
runner: Don't cache failed fixture setups
typecheck: Use typescript pool in toTestSpecification
ui: Remove duplicate browser-open call opening two tabs
ui: Simplify explorer filtering + fix nested tests when search matches a suite
ui: Store module graph once per environment
ui: Mount index.html handler on the ui base path
ui: Center split pane resize handle
vm: Bind
thistomodule.exports
Performance
Reuse fsModuleCache when filtering by source
spy: Reset only mocks that were called or reconfigured
5.0.3
30 Sep 2026Isolate
result.statusbetweenrepeatsrunsDon't print an interceptor warning in browser mode
Don't retry when
test.failsexpectedly failed
Bug Fixes
Isolate
result.statusbetweenrepeatsrunsDon't print an interceptor warning in browser mode
Don't retry when
test.failsexpectedly failedScope cache key generators to projects
browser: Delay server
listenuntil tests start runningbrowser: Check mock path boundaries
browser: Keep config of browser-consumed environments
browser: Ignore page crash while cancelling
browser:
toMatchScreenshotuses wrong reference on retried testscache: Revalidate imports of cached modules
deps: Pin
why-is-node-runningto3.2.1to avoid users running intoERR_PNPM_TRUST_DOWNGRADEexpect: Pass current equality testers to
expect.extendasymmetric matchersjsdom: Support Blob on jsdom 30.1
pool: Preserve unique pool ids when
groupOrderis setui: Split-pane handle overlapping iframe
vitest: Remove root temp dir on close
vm: Do not optimize deps from index.html
vm: Don't reuse scripts across vite environments
5.0.2
25 Sep 2026Bind
processin case global is overwrittendetect-async-leaks: Ignore
process.stdiohandlesexpect: Fix
toMatchObjectwith asymmetric matchers
Bug Fixes
Bind
processin case global is overwrittendetect-async-leaks: Ignore
process.stdiohandlesexpect: Fix
toMatchObjectwith asymmetric matchersjsdom: Fix
RequestwithBlobbody on jsdom 28+reporter:
agentto respect--silentreporters: Handle concurrent
createReportcallsreporters:
hanging-processto use ESM entrypointspy: Fix stack overflow when spying
Set.prototype.addui: Persist authentication cookie beyond current browser session
5.0.1
15 Sep 2026ui: Move trace attempts selector to viewer header
ui: Add focused trace view layout mode
Exit 1 when vitest list fails collection
Features
ui: Move trace attempts selector to viewer header
ui: Add focused trace view layout mode
Bug Fixes
Exit 1 when vitest list fails collection
Keep parse error details in static collection
Avoid recursive prototype in automocking
Prevent false Vitest import resolution
Keep metadata file when clearing the cache
Correct typos in error message and comments
Resolve ResolvedConfig exactOptionalPropertyTypes errors
Share the server on self-referencing
extendsWarn when deprecated
deps.optimizer.webis usedbrowser: Avoid double quotes in
config.definedoctor: Measure vm pools for custom environments
expect: Correct return value in
toMatchAriaSnapshotfakeTimers: Force
queueMicrotaskandnextTickintoNotFakesnapshot: Report obsolete keys next to skipped tests
types: Make public declarations self-contained
ui: Fix collapse/expand suite with file name search
ui: Fix explorer file summary count
utils: Fix
deepMergeto handle prototype
5.0.0
3 Sep 2026- breaking
Replace
loupe.inspectwith pretty-format - breaking
Remove quotes from string values in
test.for/eachtitle$variable (take 2) - breaking
Default
attachmentsDirfrom.vitest-attachements/to.vitest/attachments/
Vitest 5 is officially out! This release focuses on performance and brings a lot of new features while fixing long-standing bugs. See our blog post for the official announcement.
Breaking Changes
- breaking
Replace
loupe.inspectwith pretty-format - breaking
Remove quotes from string values in
test.for/eachtitle$variable (take 2) - breaking
Default
attachmentsDirfrom.vitest-attachements/to.vitest/attachments/ - breaking
Remove
sequentialtest/suite options in favor ofconcurrent - breaking
Represent locator as an object instead of a string
- breaking
Inline
expectpackage - breaking
Remove deprecated entry points
- breaking
Require Node.js 22 and Vite 6.4
- breaking
Fail
expect.pollwhen function didn't resolve in time - breaking
Throw an error if hoistable methods are outside the top level scope
- breaking
toHaveTextContentis strict, addtoMatchTextContentas alternative - breaking
Don't lookup config file from ancestor directories
- breaking
Inline
@vitest/runnerpackage, do not publish it anymore - breaking
Allow mutating happy-dom/jsdom window object
- breaking
Expose
concurrencyId/workerIdon TestModule's diagnostics, make id 1-based - breaking
Add
screenshotDirectoryconfig tobrowser.expect.toMatchScreenshot - breaking
Update
@sinonjs/fake-timersand support mockingTemporal - breaking
Remove webdriverio package
- breaking
Clear mocks by default before each test
- breaking
Don't emit localStorage warnings on Node 26, fail gracefully when worker fails to start
- breaking
Separate config resolution from the server creation
- breaking
Inline projects extend the root config by default
- breaking
Enable mocking Temporal without fake timers
- breaking
Support nested projects
- breaking
Use
>as separator in-t, calculateonlyonce - breaking
Fail the test when an asynchronous assertion is not awaited
- breaking
Share the Vite server between inline projects
- breaking
Parse files statically in vitest list by default
- breaking
benchmark: Rewrite the public API
- breaking
browser: Iframe scale
- breaking
browser: Enable
locators.exactby default - breaking
browser: Require
sessionIdfor orchestrator html request - breaking
browser: Save failure screenshots in
attachmentsDir - breaking
coverage:
include/excludeglobs too eager - breaking
coverage: Allow
thresholds.perFileto accept an object - breaking
expect: Fix
toThrow("")behavior by reverting #6710 - breaking
mocker: Deserialize automock as automock
- breaking
reporters:
blobreporter and--merge-reportsdefault to.vitest/blob/ - breaking
reporters: Write json and junit reporter output files to
.vitestby default - breaking
spy: Preserve class mock prototype methods on instances
- breaking
types: Add better promise support in expects and matchers
- breaking
ui: Harden UI API access
- breaking
ui: Change html reporter default output to
.vitest
Features
Add
createReportand.vitestreport directory conventionExpose default reporters through
configDefaults.reportersSupport merge reports for non-sharded multi-environment runs (take 2)
Add
logger.formatErrorSupport typescript build mode
Add toggable
injectCjsGlobalsoptionPromote fsModuleCache to a top-level option
Support non-ascii characters in
for/eachtitle placeholdersReport the duration breakdown as percentages
Promote parseSpecifications out of experimental
Promote clearCache out of experimental
api: Expose logs recorded during the test
benchmark: Add pluggable benchmark provider API
browser: Export aria tree utils
browser: Support dom snapshot trace view
browser: Provide project reference in
ToMatchScreenshotResolvePathbrowser: Show aria tree on locator element error
browser: Support custom
kindinpage.markbrowser: Live update trace view on watch UI
browser: Add
context.markfor custom command tracingbrowser: Show trace view steps in editor panel
browser: Display nested mark trace in UI
cli: Add
--repeatsCLI optioncli: Support -p shorthand for --project
coverage: V8 to track
node:child_processandnode:worker_threadscontextscoverage:
thresholds.autoUpdateto receive previous threshold as argumentcoverage: Switch to
@vitest/istanbuljspackagesjunit-reporter: Add jest-junit-compatible naming options
reporter: Support html reporter single file output
reporter: Add custom GitHub Actions summary title
ui: Highlight editor source locations
ui: Navigate trace steps with keyboard and remove indirect editor focus
ui: Persist trace view selection in URL
ui: Toggle trace target highlight
ui: Add link to open playwright trace
vitest: Create
vi.when()vm: Support
require(esm)in vm pools
Bug Fixes
Global
sequence.concurrent: truewith top-leveltest(..., { concurrent: false })+ depreactesequentialtest API and optionsTest
tagsoptions should overwrite inherited suite options + inherit suite options intaskAPIUdpate optimize deps config
Shell injection safety via github.ref_name in publish workflow
Make
attachmentsDirroot only configApply cjs interop for truthy
__esModulePreserve
vi.defineHelpercallsite for async error stackRespect
disableConsoleInterceptin browser modeForceRerunTriggers uses directory globs against files
Unify typechecking and ast collection
Don't print typecheck warning more than once
Correct collumn when parsing tests
Fix mixed stdout/stderr log timestamps in
onUserConsoleLogFix
importOriginalwith optimizer and query importCorrect transform time calculation in merged report
Fix
setImmediateawait in detect-async-leakFix per-project
sequenceconfigAdd handshake timeout to iframe communication
Don't print column in test names when
includeTaskLocationis enabledDisable server HMR before plugins read it in their config hook
Close the pool before the Vite servers
Remove listeners in the typecheck worker's
offKeep per-file isolation in vm pools when maxWorkers is 1
Node.js 20 deprecation warning for
ci.ymlPrevent node builtins double prefix
Set non-zero exit code when teardown throws during close
Don't race the typechecker spawn grace period on windows
Coalesce concurrent watch-mode restarts, deflake the pool stderr fixture
Prevent
vitest --typecheckfrom reporting a false success when thetscprocess crashesCollect in-source tests when the module is cached
Swap replace() arguments so timeout error stack shows the real message
Stale mock metadata breaks automocking with isolate:false
Don't lose worker output on teardown, deflake timing-sensitive tests
Revive global concurrency limit for test lifecycle
Own the post-restart rerun, keep
process.exitdisabled in workersPreserve correct root during resolve config
Combine multiple --project filters correctly
Fix
recordArtifactlocation withvi.defineHelperInvalidate resolved setup files
Accept awaited value in vi.when thenResolve
Ignore computed member calls in static collection
Don't duplicte
oxc.targetif user provides a custom arrayPropagate --maxWorkers to projects
Apply queued mocks from doMock() in queue order
Add a warning if inline project has duplicate plugins due to unexpected
extends: trueTreat test.describe as a suite during static collection
browser: Fix trace highlight of shadow dom on webdriverio
browser: Simplify orchestrator otel carrier
browser: Remove orphaned Playwright route when same module is mocked via multiple ids
browser: Skip
wrapDynamicImporttransform on ssr environmentbrowser: Fix stale source map on watch mode
browser: Escape inline orchestrator scripts
browser: Disable client
cdpAPI whenallowWrite/allowExec: falsebrowser: Wait for orchestrator readiness before resolving browser sessions
browser: Wait for iframe tester readiness before preparing
browser: Encode iframeId in tester iframe URL
browser: Always derive a positive locator action timeout
browser: Resize the browser ui only if it's not headless
browser: Check fs access in builtin commands
browser: Preserve pre-transform request defaults
browser: Fix error stacktrace location off-by-one
browser: Inlined awaited import should not trigger syntax error after transform
browser: Mock window.print to avoid hanging
browser: Ignore channel events in a tester opened as a top-level window
browser: Resolve
connectTimeoutfrom the project configbrowser: Prebundle vite module runner with vitest
browser: Restore dependency reload warning
browser: Configure internal optimizer dependencies
browser: Trigger playwright/chromium gc on lower disk availability
browser: Disallow filter-only options in getBy* locators - by Arjun in #10295 and #10933
browser: Fail instead of hanging when the browser stops responding
browser: Exit gracefully when the browser disconnects during cancellation
browser: Don't redirect vitest in client environment
browser: Don't hang when
ui: truein projectsbrowser: Preserve trace popover state
browser: Report the action error when a task times out
cache: Improve
fsModuleCacheresiliency during external modificationscli: Respect
FORCE_COLORover agent detectioncli: Exit on
CTRL+ceven whenglobalSetupruns blocked codecoverage:
excludeto not inherit negation globs fromtest.includecoverage: Avoid matching sibling project roots
coverage: Non-awaited module imports cause wrong offsets
coverage: Fail fast when
coverage.reportsDirectoryconflicts between concurrent runscoverage: V8 to ignore Vite SSR's generated import bindings
coverage: Prevent crash on
/@fs/prepended virtual filesdeps: Update ivya to fix empty aria tree snapshot
deps: Update fake-timers to 15.3.2. support
toNotFakedeps: Update all non-major dependencies
deps: Update all non-major dependencies
deps: Update all non-major dependencies
deps: Update all non-major dependencies - in #10966
deps: Update all non-major dependencies - in #11043
expect: Allow readonly arrays and sets in toBeOneOf
expect: Handle nullish toHaveProperty values
junit: Include unhandled errors in JUnit XML report
mocker: Skip hoist transform without ast mock calls
mocker: Hoist vi.mock() for vite-plus/test imports
mocker: Restrict redirect mocks to the fs allowlist
pool: Prevent test run hang on worker crash
pool: Improve error message when worker exits unexpectedly
pool: Vm pools to respect cgroupsv2 memory limit
pool: Worker init to handle queued synchronous messages
pool: Report the worker exit instead of a pipe error that raced it
reporter: Guard against non-finite slowTestThreshold in summary reporter
reporter: Fix non-existing import subpath module blob serialization
reporters: Fix blob file name with label
reporters:
summaryto intercept logger's streams even when they are notprocess.std*streamsreporters: Fix missing
testModulesinonTestRunEndwhen merging blobs from different root directory test runsreporters: Print parent describe suites when the passed-test list is hidden
reporters: Display
test.namein GitHub Actions reporter summary headerrunner: Propagate chainable flags in describe.for
runner: Limit concurrency per task branch in addition to per leaf callbacks
runner: Remove AbortSignal listener leak in withCancel
runner: Don't fail collection when accessing
error.stackthrowssnapshot: Fail test when snapshot assertion is used with
test.failssnapshot: Treat empty string as valid snapshot
snapshot: Support no-unsafe-eval CSP by evaluating snapshot files on server
snapshot: Reject when
toMatchFileSnapshotuses same snapshot file astoMatchSnapshotspy: Support private method spy types
spy: Point ESM namespace spy error to module mocking docs
typecheck: Report a checker crash on Windows instead of a spawn failure
types: Allow
changedin configuration optionsui: Fix duplicate colored error message
ui: Fix missing source code in html reporter metadata when merging blobs with different root directory test runs
ui: Fix module graph in browser mode with --ui
ui: Render ANSI color codes in editor panel inline error widget
ui: Fix code editor error and annotations gadgets layout shifts
ui: Synchronize watch-run UI state on file removal
ui: Require auth for coverage report and all UI subtree requests
ui: Improve suite interaction and layout in explorer tree
ui: Reveal explorer virtual scroller on resize
ui: Persist trace step-iframe split pane sizes
ui: Add suite level report view
ui: Hide running count in static reports
utils: Don't crash on a malformed inline source map
vitest: Strip non-serializable functions from inline diff config
- removed
vitest: Remove broken "./src/*" export from package.json
vitest: Render non-Error causes from env setup so the actual diagnostic is not dropped
vm: Fix external module resolve error with deps optimizer query for encoded URI
vm: Stop retaining every finished test file in vm pool workers
vm: Fall back to compiling from source when a module's code cache is rejected
vm: Link module graphs one at a time
webdriverio: Allow gpu in headless chrome
worker: Bind stdio's early in case overriden
Performance
Stringify diff objects only once
Improve performance in hot paths
Serve warm modules to workers in one round-trip, enable the node compile cache
Make the Node compile cache opt-in, persist worker caches on teardown
Reuse compiled code across vm pool contexts and prewarm the module graph
Bundle vitest's own dependencies
Lowers peak memory usage when using
--changedon a large graphInitialize trace view in the orchestrator once per worker
browser: Reduce matching screenshot overhead
browser: Open browser sessions adaptively instead of maxWorkers upfront
browser: Cut per-file round trips
browser: Stop serving framework sourcemaps in headless runs
browser: Prewarm the browser while the Vite server starts
browser: Pre-bundle the vitest runtime in optimizeDeps
browser: Serve framework assets as immutable
cache: Hash the environment-invariant part of the fs module cache key once
coverage: Speed up v8 report generation (bounded-memory merge + precompiled globs)
coverage: Reduce RPC data and unnecessary serializations
expect: Avoid redefining matcher state
expect: Lazily format spy matcher failures
spy: Avoid scanning cleared mocks
vm: Don't prewarm modules the worker never requests
vm: Let environments opt out of the module graph prewarm
- 4.x
4.1.12
15 Oct 2026mocker: Harden manual and redirect mocks [backport to v4]
4.1.11
18 Aug 2026Revive global concurrency limit for test lifecycle [backport to v4]
browser: Encode iframeId in tester iframe URL [backport to v4]
browser: Trigger playwright/chromium gc on lower disk availability [backport to v4]
Bug Fixes
Revive global concurrency limit for test lifecycle [backport to v4]
browser: Encode iframeId in tester iframe URL [backport to v4]
browser: Trigger playwright/chromium gc on lower disk availability [backport to v4]
mocker: Restrict redirect mocks to the fs allowlist [backport to v4]
4.1.10
6 Jul 2026Reading the note…
4.1.9
15 Jun 2026Reading the note…
4.1.8
1 Jun 2026Reading the note…
4.1.7
20 May 2026Reading the note…
4.1.6
11 May 2026Reading the note…
4.1.5
21 Apr 2026Reading the note…
4.1.4
9 Apr 2026Reading the note…
4.1.3
7 Apr 2026Reading the note…
4.1.2
26 Mar 2026Reading the note…
4.1.1
23 Mar 2026Reading the note…
4.1.0
12 Mar 2026Reading the note…
4.0.18
22 Jan 2026Reading the note…
4.0.17
12 Jan 2026Reading the note…
4.0.16
16 Dec 2025Reading the note…
4.0.15
2 Dec 2025Reading the note…
4.0.14
25 Nov 2025Reading the note…
4.0.13
21 Nov 2025Reading the note…
4.0.12
20 Nov 2025Reading the note…
4.0.11
20 Nov 2025Reading the note…
4.0.10
17 Nov 2025Reading the note…
4.0.9
14 Nov 2025Reading the note…
4.0.8
7 Nov 2025Reading the note…
4.0.7
4 Nov 2025Reading the note…
4.0.6
31 Oct 2025Reading the note…
4.0.5
29 Oct 2025Reading the note…
4.0.4
27 Oct 2025Reading the note…
4.0.3
24 Oct 2025Reading the note…
4.0.2
23 Oct 2025Reading the note…
4.0.1
22 Oct 2025Reading the note…
4.0.0
22 Oct 2025Reading the note…
- 3.x
3.2.7
6 Jul 2026Reading the note…
3.2.6
1 Jun 2026Reading the note…
3.2.5
1 Jun 2026Reading the note…
3.2.4
17 Jun 2025Reading the note…
3.2.3
9 Jun 2025Reading the note…
3.2.2
5 Jun 2025Reading the note…
3.2.1
3 Jun 2025Reading the note…
3.2.0
2 Jun 2025Reading the note…
3.1.4
19 May 2025Reading the note…
3.1.3
5 May 2025Reading the note…
3.1.2
21 Apr 2025Reading the note…
3.1.1
31 Mar 2025Reading the note…