unstale

npm / vitest

vitest

What changed in vitest 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-17.

67 breaking4 security10 deprecations119 new APIs and options8 performance87 behavior and defaults22 tooling219 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.1.0 on npm

vitest 5200 changes

Breaking changes 35

  • Browser instances now run as workers, changing resource usage and maxWorkers behavior.

    5.0.4release notes

  • Runs now fail when git or location filters report errors.

    5.0.4release notes

  • Reset operations now affect only spies that were called or reconfigured.

    5.0.4release notes

  • vitest list now exits with status 1 when collection fails.

    5.0.1release notes

  • Tests fail when asynchronous assertions are not awaited.

    5.0.0release notes

  • The default attachments directory changes to .vitest/attachments/.

    5.0.0release notes

  • attachmentsDir is now restricted to root configuration.

    5.0.0release notes

  • The public benchmark API is rewritten.

    5.0.0release notes

  • The client cdp API is disabled when allowWrite or allowExec is false.

    3.2.5, 4.1.8, 5.0.0release notesrelease notesrelease notes

  • Mocks are cleared before each test by default.

    5.0.0release notes

  • Vitest no longer searches ancestor directories for a configuration file.

    5.0.0release notes

  • Coverage reports and all UI subtree requests now require authentication.

    5.0.0release notes

  • coverage.exclude no longer inherits negation globs from test.include.

    5.0.0release notes

  • Concurrent runs now fail fast when reportsDirectory conflicts.

    5.0.0release notes

  • Deprecated package entry points are no longer available.

    5.0.0release notes

  • expect.poll now fails when its function does not resolve within the allowed time.

    5.0.0release notes

  • Filter-only options are no longer allowed in getBy* locators.

    5.0.0release notes

  • Hoistable methods must be inside the top-level scope or an error is thrown.

    5.0.0release notes

  • The HTML reporter default output changes to .vitest.

    5.0.0release notes

  • Coverage include and exclude globs no longer match too eagerly.

    5.0.0release notes

  • JSON and JUnit reporter output files are written to .vitest by default.

    5.0.0release notes

  • Locators are represented as objects instead of strings.

    5.0.0release notes

  • Browser locator exact matching is enabled by default.

    5.0.0release notes

  • Vitest now requires Node.js 22 and Vite 6.4.

    5.0.0release notes

  • The sequential test and suite options are removed in favor of concurrent.

    5.0.0release notes

  • The orchestrator HTML request now requires sessionId.

    5.0.0release notes

  • The broken ./src/* package export has been removed.

    5.0.0release notes

  • The -t test-name separator changes to >.

    5.0.0release notes

  • Vitest now exits non-zero when teardown throws during close.

    5.0.0release notes

  • Snapshot assertions used with test.fails now fail the test.

    5.0.0release notes

  • String values in title $ variables no longer include quotes.

    5.0.0release notes

  • toHaveTextContent becomes strict; toMatchTextContent provides the alternative matcher.

    5.0.0release notes

  • Using the same snapshot file for toMatchFileSnapshot and toMatchSnapshot is now rejected.

    5.0.0release notes

  • @vitest/runner is inlined and is no longer published.

    5.0.0release notes

  • The webdriverio package is removed.

    5.0.0release notes

Security 1

  • Snapshot files are evaluated on the server to support no-unsafe-eval CSP.

    5.0.0release notes

Deprecations 2

New APIs and options 29

  • The import.meta.hot stub now includes data.

    5.0.5release notes

  • Adds an option to cache dependencies instead of statically parsing them.

    5.0.4release notes

  • Adds an experimental option for configuring the UI theme.

    5.0.4release notes

  • The UI adds a focused trace view layout mode.

    5.0.1release notes

  • Benchmarks support pluggable providers.

    5.0.0release notes

  • The changed option is now allowed in configuration options.

    5.0.0release notes

  • TestModule diagnostics expose concurrencyId and workerId, with IDs becoming 1-based.

    5.0.0release notes

  • Default reporters are exposed through configDefaults.reporters.

    5.0.0release notes

  • context.mark enables custom command tracing.

    5.0.0release notes

  • createReport is added, along with the .vitest report directory convention.

    5.0.0release notes

  • fsModuleCache is promoted to a top-level option.

    5.0.0release notes

  • The GitHub Actions summary title can be customized.

    5.0.0release notes

  • Headless Chrome sessions can use GPU acceleration.

    5.0.0release notes

  • The HTML reporter supports single-file output.

    5.0.0release notes

  • A toggleable injectCjsGlobals option is available.

    5.0.0release notes

  • logger.formatError is added for formatting errors.

    5.0.0release notes

  • Custom environments can opt out of module graph prewarming.

    5.0.0release notes

  • Projects can now be nested.

    5.0.0release notes

  • -p becomes shorthand for --project.

    5.0.0release notes

  • page.mark supports a custom kind.

    5.0.0release notes

  • Spy types now support private methods.

    5.0.0release notes

  • The CLI gains a --repeats option.

    5.0.0release notes

  • browser.expect.toMatchScreenshot accepts screenshotDirectory.

    5.0.0release notes

  • Temporal can be mocked, including without enabling fake timers.

    5.0.0release notes

  • thresholds.autoUpdate receives the previous threshold as an argument.

    5.0.0release notes

  • ToMatchScreenshotResolvePath receives a project reference.

    4.1.6, 5.0.0release notesrelease notes

  • Fake timers now support the toNotFake option.

    5.0.0release notes

  • TypeScript build mode is supported.

    5.0.0release notes

  • vi.when() is added.

    5.0.0release notes

Performance 2

  • Using --changed on a large graph now uses less peak memory.

    5.0.0release notes

  • V8 coverage report generation is faster through bounded-memory merging and precompiled globs.

    5.0.0release notes

Behavior and default changes 38

  • Cancelling a test run now aborts all running tests.

    5.0.5release notes

  • The changed-test run reports how many tests were affected and the total count.

    5.0.4release notes

  • Changed-test detection now tracks project files and mocks.

    5.0.4release notes

  • fsModuleCache is enabled by default.

    5.0.4release notes

  • pretty-format now supports boxed symbols.

    5.0.4release notes

  • toHaveTextContent can now be used without arguments.

    5.0.4release notes

  • The trace attempts selector moved to the viewer header.

    5.0.1release notes

  • The blob reporter and --merge-reports default to .vitest/blob/.

    5.0.0release notes

  • Browser sessions open adaptively instead of allocating maxWorkers upfront.

    5.0.0release notes

  • clearCache is promoted out of experimental status.

    5.0.0release notes

  • Browser connectTimeout is now resolved from project configuration.

    5.0.0release notes

  • Duration breakdowns are reported as percentages.

    5.0.0release notes

  • FORCE_COLOR now takes precedence over agent detection.

    5.0.0release notes

  • Framework assets are now served as immutable resources.

    5.0.0release notes

  • Framework sourcemaps are no longer served during headless runs.

    5.0.0release notes

  • The GitHub Actions reporter summary header now displays test.name.

    5.0.0release notes

  • Editor panel inline errors now render ANSI color codes.

    5.0.0release notes

  • Inline projects extend the root configuration by default.

    5.0.0release notes

  • The maxWorkers setting is now propagated to projects.

    5.0.0release notes

  • Merge reports is supported for non-sharded multi-environment runs.

    5.0.0release notes

  • The Node compile cache is opt-in, and worker caches persist during teardown.

    5.0.0release notes

  • parseSpecifications is promoted out of experimental status.

    5.0.0release notes

  • Expects and matchers provide better promise support.

    5.0.0release notes

  • vm pools support require(esm).

    5.0.0release notes

  • Static reports no longer display the running count.

    5.0.0release notes

  • A top-level test with concurrent false now overrides global sequence.concurrent true.

    4.1.6, 5.0.0release notesrelease notes

  • An empty string is now treated as a valid snapshot.

    5.0.0release notes

  • The summary reporter now intercepts logger streams even when they are not process standard streams.

    5.0.0release notes

  • Tasks now inherit suite options.

    5.0.0release notes

  • Logs recorded during a test are exposed.

    5.0.0release notes

  • test.describe is now treated as a suite during static collection.

    5.0.0release notes

  • thresholds.perFile accepts an object.

    5.0.0release notes

  • toBeOneOf now accepts readonly arrays and sets.

    5.0.0release notes

  • Trace step-iframe split pane sizes are now persisted.

    5.0.0release notes

  • vi.mock() is now hoisted for vite-plus/test imports.

    4.1.9, 5.0.0release notesrelease notes

  • thenResolve now accepts an awaited value.

    5.0.0release notes

  • vitest list parses files statically by default.

    5.0.0release notes

  • happy-dom and jsdom window objects can be mutated.

    5.0.0release notes

Tooling 7

  • Mocks from finished test files are released.

    5.0.5release notes

  • Cache directories are tagged with CACHEDIR.TAG so tools can recognize them.

    5.0.4release notes

  • Browser failure screenshots are saved in attachmentsDir.

    5.0.0release notes

  • Suite interaction and layout in the explorer tree were improved.

    5.0.0release notes

  • loupe.inspect is replaced with pretty-format.

    5.0.0release notes

  • The UI now provides a report view at suite level.

    5.0.0release notes

  • Coverage switches to @vitest/istanbuljs packages.

    5.0.0release notes

Fixes and other changes 86

  • Late connections from closed browser sessions are dropped.

    5.0.5release notes

  • Vitest waits 30 seconds for the browser to close.

    5.0.5release notes

  • Browser plugins' buildStart hooks run when the server is created.

    5.0.5release notes

  • The changed-file filter now handles quoted file names correctly.

    5.0.5release notes

  • Reporter output uses the end reason 'failed' when a worker crashes.

    5.0.5release notes

  • Vite's default fs.deny setting is preserved when an API token file is present.

    5.0.5release notes

  • Global setup runs once when browser instances are used.

    5.0.5release notes

  • Hook cleanup functions now run when a later hook fails.

    5.0.5release notes

  • Synthetic pagehide events are ignored in browser tests.

    5.0.5release notes

  • skipIf sets skip and ignores undefined options.

    5.0.5release notes

  • allowExternal now includes uncovered files correctly in coverage.

    5.0.4release notes

  • Browser API options are applied even when no browser configuration is provided.

    5.0.4release notes

  • Browser command arguments preserve undefined values.

    5.0.4release notes

  • Coverage no longer incorrectly marks filenames containing brackets as uncovered.

    5.0.4release notes

  • Module mocks are wrapped correctly during in-source testing.

    5.0.4release notes

  • JUnit output strips ANSI sequences from all XML attributes.

    5.0.4release notes

  • Deep equality for Map and Set is corrected in some assertions.

    5.0.4release notes

  • vm execution now binds this to module.exports.

    5.0.4release notes

  • Edge cases in native loader mocking are fixed.

    5.0.4release notes

  • Node builtins are resolved correctly in client environments.

    5.0.4release notes

  • Project configurations now respect the configured root.

    5.0.4release notes

  • Setup mocks are awaited before the test file is imported.

    5.0.4release notes

  • Snapshot handling now accounts for line endings.

    5.0.4release notes

  • A zero truncation setting now preserves full dollar-prefixed string values.

    5.0.4release notes

  • Blob is supported when using jsdom 30.1.

    5.0.3release notes

  • Configuration for environments consumed by the browser is preserved.

    5.0.3release notes

  • The browser server waits to listen until tests start running.

    5.0.3release notes

  • Cache key generators are scoped to individual projects.

    5.0.3release notes

  • Imports of cached modules are revalidated.

    5.0.3release notes

  • expect.extend asymmetric matchers now receive the current equality testers.

    5.0.3release notes

  • Dependencies referenced from index.html are no longer optimized in VM mode.

    5.0.3release notes

  • Browser mode no longer prints an interceptor warning.

    5.0.3release notes

  • Browser mock path matching now checks path boundaries.

    5.0.3release notes

  • Page crashes during cancellation are ignored.

    5.0.3release notes

  • Unique pool IDs are preserved when groupOrder is set.

    5.0.3release notes

  • Each repeats run now isolates result.status from other runs.

    5.0.3release notes

  • The split-pane handle no longer overlaps the iframe in the UI.

    5.0.3release notes

  • Expected failures marked with test.fails are no longer retried.

    5.0.3release notes

  • Retried screenshot tests now use the correct reference image.

    5.0.3release notes

  • The agent reporter now respects the --silent command-line option.

    5.0.2release notes

  • The UI authentication cookie now persists beyond the current browser session.

    5.0.2release notes

  • Concurrent createReport calls are now handled correctly by reporters.

    5.0.2release notes

  • Async leak detection now ignores process.stdio handles.

    5.0.2release notes

  • Vitest now binds process correctly when the global process value has been overwritten.

    4.0.7, 5.0.2release notesrelease notes

  • Request now handles Blob bodies correctly when using jsdom 28 or newer.

    5.0.2release notes

  • Spying on Set.prototype.add no longer causes a stack overflow.

    5.0.2release notes

  • toMatchObject now works correctly with asymmetric matchers.

    5.0.2release notes

  • Automocking avoids creating recursive prototypes.

    5.0.1release notes

  • Clearing the cache now preserves the metadata file.

    5.0.1release notes

  • Browser mode avoids inserting double quotes in config.define values.

    5.0.1release notes

  • The doctor command now measures VM pools for custom environments.

    5.0.1release notes

  • deepMerge now handles prototypes correctly.

    5.0.1release notes

  • The UI now shows the correct explorer file summary count.

    5.0.1release notes

  • toNotFake now forces queueMicrotask and nextTick behavior.

    5.0.1release notes

  • UI suite collapse and expansion now works with file name search.

    5.0.1release notes

  • Obsolete snapshot keys are reported next to skipped tests.

    5.0.1release notes

  • Public type declarations are now self-contained.

    5.0.1release notes

  • ResolvedConfig no longer produces exactOptionalPropertyTypes errors.

    5.0.1release notes

  • Configurations using self-referencing extends now share the server.

    5.0.1release notes

  • Static collection preserves parse error details for better failure diagnosis.

    5.0.1release notes

  • toMatchAriaSnapshot now returns the correct value.

    5.0.1release notes

  • Vitest prevents false import resolution results.

    5.0.1release notes

  • Class mock prototype methods are preserved on instances.

    5.0.0release notes

  • CTRL+c now exits even when globalSetup runs blocked code.

    5.0.0release notes

  • describe.for now propagates chainable flags.

    5.0.0release notes

  • Browser mode now respects disableConsoleIntercept.

    5.0.0release notes

  • Queued mocks from doMock() are now applied in queue order.

    5.0.0release notes

  • Non-Error causes from environment setup now render instead of dropping the actual diagnostic.

    5.0.0release notes

  • The explorer virtual scroller is revealed correctly after resizing.

    5.0.0release notes

  • External module resolution now handles encoded URIs with the deps optimizer query.

    4.1.3, 5.0.0release notesrelease notesrelease notes

  • for/each title placeholders support non-ASCII characters.

    5.0.0release notes

  • Directory globs in forceRerunTriggers are now applied against files.

    5.0.0release notes

  • The global concurrency limit now applies to test lifecycle operations.

    4.1.11, 5.0.0release notesrelease notes

  • importOriginal now works with the optimizer and query imports.

    4.1.9, 5.0.0release notesrelease notes

  • Non-serializable functions are stripped from inline diff configuration.

    5.0.0release notes

  • JUnit XML reports now include unhandled errors.

    5.0.0release notes

  • Vitest no longer crashes when processing a malformed inline source map.

    5.0.0release notes

  • Vitest falls back to compiling from source when a module's code cache is rejected.

    5.0.0release notes

  • Mixed stdout and stderr logs now receive correct timestamps.

    5.0.0release notes

  • Vitest no longer duplicates oxc.target when a custom array is provided.

    5.0.0release notes

  • Per-project sequence configuration is now handled correctly.

    5.0.0release notes

  • Test tags options now overwrite inherited suite options.

    5.0.0release notes

  • toHaveProperty now handles nullish values correctly.

    5.0.0release notes

  • The command no longer reports false success when the tsc process crashes.

    5.0.0release notes

  • Watch-run UI state now stays synchronized when files are removed.

    5.0.0release notes

  • Worker startup failures now fail gracefully, and Node 26 localStorage warnings are suppressed.

    5.0.0release notes

vitest 4336 changes

Breaking changes 32

  • Redirect mocks are restricted to paths permitted by the filesystem allowlist.

    4.1.11release notessecurity advisory

  • Removes JestExtendError.context from verbose error reporting.

    4.1.3release notes

  • setupFiles is no longer resolved from a parent directory.

    4.1.2release notes

  • Removes support for the Vite 8 beta, affecting projects relying on that prerelease.

    4.1.1release notes

  • Calling a suite function inside a test is now rejected.

    4.0.16release notes

  • collect is renamed to import and is no longer the supported name.

    4.0.14release notes

  • import replaces collect as the supported name.

    4.0.14release notes

  • prepare is removed.

    4.0.14release notes

  • getBuiltins no longer returns Node builtins unconditionally.

    4.0.5release notes

  • The ast export was removed.

    4.0.0release notes

  • The basic reporter was removed.

    4.0.0release notes

  • In-source tests run only when the containing file is itself a test file.

    4.0.0release notes

  • Deprecated coverage options were removed in favor of vitest/node exports.

    4.0.0release notes

  • coverage.exclude now keeps only string values.

    4.0.0release notes

  • Setting the test environment to browser is forbidden.

    4.0.0release notes

  • The deprecated environmentMatchGlobs option was removed.

    4.0.0release notes

  • ErrorWithDiff was removed in favor of TestError.

    4.0.0release notes

  • Vitest now uses ES2022 language features, which may affect runtime compatibility for projects running Vitest.

    4.0.0release notes

  • The deprecated getSourceMap API was removed.

    4.0.0release notes

  • minWorkers was removed and is automatically set to 0 outside watch mode.

    4.0.0release notes

  • The engines field no longer supports Node 18.

    4.0.0release notes

  • Node types were removed from the main entry point; import them from vitest/node instead.

    4.0.0release notes

  • Tests fail on CI when snapshots are obsolete.

    4.0.0release notes

  • The deprecated order parameter was removed from the test API.

    4.0.0release notes

  • The deprecated poolMatchGlobs option was removed.

    4.0.0release notes

  • Project configuration files are limited to names containing vitest.config or vite.config.

    4.0.0release notes

  • Browser mode now requires a provider factory instead of a provider string.

    4.0.0release notes

  • Calling useFakeTimers multiple times now overrides the existing fake timers.

    4.0.0release notes

  • UserConfig was removed; ViteUserConfig should be used instead.

    4.0.0release notes

  • Vitest no longer supports Vite 5.

    4.0.0release notes

  • Vitest uses module-runner instead of vite-node.

    4.0.0release notes

  • The deprecated workspace option was removed in favor of projects.

    4.0.0release notes

Security 3

  • Browser builtin commands now check filesystem access.

    3.2.7, 4.1.10release notesrelease notes

  • Updates flatted and removes version pinning to resolve CVE-related issues.

    4.1.2release notes

  • When Vitest UI server is listening, arbitrary file can be read and executed

    3.2.6, 4.1.0security advisory

Deprecations 8

  • Vitest now shows a warning when browser.isolate is used.

    4.1.0release notes

  • toBe* spy assertions are deprecated in favor of toHaveBeen* and toThrowError.

    4.1.0release notes

  • toHaveBeen* is the preferred replacement for deprecated toBe* spy assertions.

    4.1.0release notes

  • Vitest warns when vi.hoisted is declared outside the module top level.

    4.1.0release notes

  • Vitest warns when vi.mock is declared outside the module top level.

    4.1.0release notes

  • Several vitest/* entry points are now deprecated.

    4.1.0release notes

  • Vitest logs a deprecation warning when test.poolOptions is configured.

    4.0.16release notes

  • The browser-specific isolate option is deprecated in favor of the inherited isolate option.

    4.0.7release notes

New APIs and options 90

  • Istanbul coverage now supports the instrumenter option.

    4.1.5release notes

  • Experimental support for aria snapshots is added.

    4.1.4release notes

  • The JSON reporter gains a filterMeta option.

    4.1.4release notes

  • Adds an exact matching option for browser locators.

    4.1.3release notes

  • Adds support for custom snapshot matchers.

    4.1.3release notes

  • Exports the custom snapshot matcher helper from vitest.

    4.1.3release notes

  • Adds an experimental preParse configuration flag.

    4.1.3release notes

  • Adds bodyEncoding to TestAttachment.

    4.1.3release notes

  • Introduces the experimental.vcsProvider configuration option.

    4.1.1release notes

  • Exposes matchesTags to test whether the current filter matches tags.

    4.1.1release notes

  • Allows opening the browser in standalone mode without running tests.

    4.1.1release notes

  • Provides vi.advanceTimers to the preview provider.

    4.1.1release notes

  • A new agent reporter reduces AI agent token usage.

    4.1.0release notes

  • Adds the allowExec option to api.

    3.2.5, 4.1.0release notesrelease notes

  • Adds the allowWrite option to api.

    3.2.5, 4.1.0release notesrelease notes

  • aroundAll hooks are now available for wrapping all tests in a suite.

    4.1.0release notes

  • aroundEach hooks are now available for wrapping each test.

    4.1.0release notes

  • An assertion helper can hide internal stack traces from assertion output.

    4.1.0release notes

  • Chai-style assertions are now available in Vitest tests.

    4.1.0release notes

  • Coverage reports can now include only changed files.

    4.1.0release notes

  • createSpecification now accepts filters.

    4.1.0release notes

  • The UI now supports configuring details panel position and provides a button for it.

    4.1.0release notes

  • A CLI option detects asynchronous resource leaks.

    4.1.0release notes

  • webdriverio and preview now expose findElement and enable strict mode.

    4.1.0release notes

  • Coverage now supports ignore start/stop hints in source code.

    4.1.0release notes

  • Import duration reporting now supports print and fail thresholds.

    4.1.0release notes

  • Import duration reporting now supports a limit option.

    4.1.0release notes

  • Import duration reporting now supports a print option.

    4.1.0release notes

  • Playwright launchOptions can now be used together with connectOptions.

    4.1.0release notes

  • Matcher types are now publicly exposed for type-aware integrations.

    4.1.0release notes

  • Test options now support attaching meta information.

    4.1.0release notes

  • Mocks can now be configured to throw errors.

    4.1.0release notes

  • Mocks can now be configured to throw errors once.

    4.1.0release notes

  • An option now allows disabling the module runner.

    4.1.0release notes

  • The page/locator.mark API adds annotations to improve Playwright traces.

    4.1.0release notes

  • Playwright browser mode now supports persistent contexts.

    4.1.0release notes

  • prettyDOM now supports filtering nodes from browser assertion error output.

    4.1.0release notes

  • The UI now supports filtering and sorting projects.

    4.1.0release notes

  • Retry options have been enhanced.

    4.1.0release notes

  • The API now exposes runTestFiles as an alternative to runTestSpecifications.

    4.1.0release notes

  • Timer controls now expose setTickMode through the updated fake-timers integration.

    4.1.0release notes

  • Tests can now use tags for categorization and filtering.

    4.1.0release notes

  • A new test.extend syntax provides improved type inference.

    4.1.0release notes

  • Reported tasks now include toTestSpecification.

    4.1.0release notes

  • toTestSpecification can now receive test cases.

    4.1.0release notes

  • The --update flag now accepts new or all to control snapshot updates.

    4.1.0release notes

  • Snapshot configuration now supports update: "none".

    4.1.0release notes

  • Browser user-event interactions now include wheel events.

    4.1.0release notes

  • vi.mocked now supports deep partial typing.

    4.1.0release notes

  • worker.init now supports an onModuleRunner hook.

    4.0.18release notesrelease notes

  • TRACEPARENT is supported for OpenTelemetry context propagation.

    4.0.17release notes

  • TRACESTATE is supported for OpenTelemetry context propagation.

    4.0.17release notes

  • Custom pools can use the exported setupEnvironment API.

    4.0.16release notes

  • Plugins can opt out of caching, and the internal root cache is fixed.

    4.0.15release notes

  • Exposes utils.configurePrettyDOM for configuring pretty DOM output in browser mode.

    4.0.14release notes

  • Adds an experimental file system cache to improve Vitest performance.

    4.0.11release notes

  • Provides the current task in MatchState for matcher implementations and integrations.

    4.0.11release notes

  • Adds experimental support for OpenTelemetry traces.

    4.0.11release notes

  • Adds an extensible API for working with test artifacts.

    4.0.11release notes

  • The selectOptions element parameter now accepts the Locator type in browser tests.

    4.0.5release notes

  • The jsdom environment now supports the AbortSignal API.

    4.0.0release notes

  • The mocker package adds an automocker entry.

    4.0.0release notes

  • An export for browser/utils was added.

    4.0.0release notes

  • BrowserProviderOption now exposes an options field.

    4.0.0release notes

  • CDP Session is re-exported directly from Playwright.

    4.0.0release notes

  • The vitest list command now supports the --changed flag.

    4.0.0release notes

  • Spying on classes is now supported.

    4.0.0release notes

  • Custom screenshot comparison algorithms are supported.

    4.0.0release notes

  • The disableCoverage method was added.

    4.0.0release notes

  • The enableCoverage method was added.

    4.0.0release notes

  • expect.assert now supports type narrowing.

    4.0.0release notes

  • Custom expect messages are supported for expect.extend matchers.

    4.0.0release notes

  • The module-runner package now supports getBuiltins.

    4.0.0release notes

  • The getGlobalTestNamePattern method was added.

    4.0.0release notes

  • The getSeed method was added.

    4.0.0release notes

  • github-options adds displayAnnotations.

    4.0.0release notes

  • The Playwright provider now supports iframe locators.

    4.0.0release notes

  • webdriverio now supports the --inspect option.

    4.0.0release notes

  • Locators now expose length, and toHaveLength accepts locators.

    4.0.0release notes

  • An onUnhandledError callback is available for handling unhandled errors.

    4.0.0release notes

  • TestModule now exposes relativeModuleId.

    4.0.0release notes

  • Matchers for schema validation were added.

    4.0.0release notes

  • Hooks now support type-safe extra context through TestAPI.

    4.0.0release notes

  • Browser mode adds toBeInViewport for checking whether an element is in the viewport.

    4.0.0release notes

  • The toBeNullable expect function checks whether a value is nullish.

    4.0.0release notes

  • Browser mode adds toMatchScreenshot for visual regression testing.

    4.0.0release notes

  • Browser mode adds the trackUnhandledErrors option.

    4.0.0release notes

  • The verbose reporter now prints tests in a list; tree was introduced as a separate reporter.

    4.0.0release notes

  • vi.mockObject now accepts a spy option.

    4.0.0release notes

  • The Vitest watcher is now exposed.

    4.0.0release notes

Performance 6

  • jsdom reuses abort signals when possible.

    4.0.14release notes

  • When enabled, the filesystem module cache reads from memory whenever possible.

    4.0.13release notes

  • Cached modules avoid an unnecessary fetchModule roundtrip.

    4.0.13release notes

  • Test files are now sorted by project by default, improving pool execution performance.

    4.0.7release notes

  • expect improves performance by optimizing input type checks.

    4.0.5release notes

  • With --no-isolate and --maxWorkers=1, test files are passed at once for improved performance.

    4.0.5release notes

Behavior and default changes 49

  • The agent reporter name is now an alias for the minimal reporter.

    4.1.5release notes

  • Web workers now support MessagePort objects referenced inside postMessage data.

    4.1.5release notes

  • The default snapshot maximum output length has increased.

    4.1.5release notes

  • Test-specification options are now writable.

    4.1.5release notes

  • The experimental assertion field is exposed publicly.

    4.1.4release notes

  • User server options are spread into the browser Vite server in the project.

    4.1.4release notes

  • The text reporter defaults to skipFull when an agent is detected.

    4.1.4release notes

  • Colors are disabled when an agent is detected.

    4.1.2release notes

  • Limits output for large objects.

    4.1.1release notes

  • beforeAll and afterAll fixtures now receive file context.

    4.1.0release notes

  • Async assertions can now be followed by catch and finally handlers.

    4.1.0release notes

  • beforeAll and afterAll fixtures now receive file context.

    4.1.0release notes

  • Cancelling a run now stops the current test immediately.

    4.1.0release notes

  • doMock() can now return a disposable for controlling mock lifetime.

    4.1.0release notes

  • Snapshot assertions now work with expect.soft.

    4.1.0release notes

  • Specification parsing now supports tests whose names start or end with test.

    4.1.0release notes

  • External modules now respect project resolve.conditions.

    4.1.0release notes

  • Vitest now logs the seed when only sequence.shuffle.tests is enabled.

    4.1.0release notes

  • The default SSR environment runner is now the Vitest server module runner.

    4.1.0release notes

  • webdriverio and preview now enable strict mode.

    4.1.0release notes

  • vitest list can statically collect tests without running files to collect them.

    4.1.0release notes

  • Watch mode now uses an agent check instead of only checking TTY.

    4.1.0release notes

  • Injected data-testid attributes are hidden in browser mode.

    4.0.18release notes

  • Asymmetric matcher diffs are more readable because container matchers are unwrapped.

    4.0.17release notes

  • UUID generation no longer relies on crypto.randomUUID, allowing operation in insecure environments.

    4.0.17release notes

  • WebdriverIO falls back to WebDriver Classic when needed.

    4.0.17release notes

  • Forceful CTRL+c exits terminate workers.

    4.0.15release notes

  • The GitHub reporter includes the project in its output.

    4.0.15release notes

  • Tasks now include full names, making task identity clearer in runner output and integrations.

    4.0.14release notes

  • postMessage can send ports to web workers.

    4.0.14release notes

  • Functions are now accepted as standard schemas.

    4.0.14release notes

  • fsModuleCachePath is inherited by default.

    4.0.12release notes

  • The browser mode UI now includes favicon icons.

    4.0.9release notes

  • toBeOneOf now supports Set values in expect assertions.

    4.0.9release notes

  • The --config option now allows a module as its configuration input.

    4.0.5release notes

  • coverage autoUpdate now supports percentage formatting.

    4.0.0release notes

  • When specified, config.browser.instances[].include overrides config.include.

    4.0.0release notes

  • Coverage now includes files selected by the --project filter.

    4.0.0release notes

  • The default exclude pattern was simplified.

    4.0.0release notes

  • defineConfig can now return a promise.

    4.0.0release notes

  • experimental_parseSpecifications is now exposed.

    4.0.0release notes

  • locator.element() now returns HTMLElement or SVGElement.

    4.0.0release notes

  • The spying implementation was rewritten to make module mocking more intuitive.

    4.0.0release notes

  • Synchronous not.toBeInTheDocument() is now supported.

    4.0.0release notes

  • The onConsoleLog callback now receives the logged entity.

    4.0.0release notes

  • Test files are distributed more evenly across shards.

    4.0.0release notes

  • test or describe calls without a function are assigned todo mode.

    4.0.0release notes

  • test.extend now uses the suite's timeout.

    4.0.0release notes

  • trackUnhandledErrors is disabled when the inspector is enabled.

    4.0.0release notes

Tooling 15

  • Static test discovery now recognizes the __vi_import_ prefix.

    4.1.5release notes

  • Adds @vitest/coverage-istanbul as an optional dependency.

    4.1.3release notes

  • Adds @vitest/coverage-v8 as an optional dependency.

    4.1.3release notes

  • CLI tab completions are now available through @bomb.sh/tab.

    4.1.0release notes

  • The UI explorer can now sort tests by duration.

    4.1.0release notes

  • Expectedly failed tests are tracked and displayed in the UI and CLI.

    4.1.0release notes

  • The GitHub Actions Reporter now includes a run summary.

    4.1.0release notes

  • The UI can now run an individual test or suite.

    4.1.0release notes

  • The UI can now filter for slow tests.

    4.1.0release notes

  • Failure screenshots are now stored using the artifacts API.

    4.1.0release notes

  • Browser mode supports OpenTelemetry, enabling telemetry instrumentation during browser tests.

    4.0.17release notes

  • Reporters print a breakdown of import durations.

    4.0.15release notes

  • The UI adds a tabbed screenshot-failure view with a comparison slider.

    4.0.14release notes

  • Playwright tracing is now supported.

    4.0.0release notes

  • The vitest init command now supports qwik.

    4.0.0release notes

Fixes and other changes 133

  • Manual and redirect mocks were hardened, improving mock behavior for developers using Vitest's mocker.

    4.1.12release notes

  • Browser sessions now wait for orchestrator readiness before resolving.

    4.1.9release notes

  • Browser preparation now waits for iframe tester readiness.

    4.1.9release notes

  • Test runs no longer hang when a worker crashes.

    4.1.9release notes

  • Orphaned Playwright routes are removed when the same module is mocked through multiple ids.

    4.1.8release notes

  • Concurrency is now limited per task branch as well as per leaf callbacks.

    4.1.7release notes

  • The HTML reporter now displays project color labels correctly.

    4.1.5release notes

  • Project negation now excludes browser instances.

    4.1.5release notes

  • Coverage reports now provide a descriptive error when the reports directory is removed during a test run.

    4.1.5release notes

  • Soft assertions now respect diff configuration options.

    4.1.5release notes

  • vi.defineHelper now works when called as an object method.

    4.1.5release notes

  • The message passed to expect is consistently used as the error message prefix.

    4.1.4release notes

  • Imports matching class property names are no longer hoisted.

    4.1.4release notes

  • Labeled terminal messages use a black foreground to improve contrast.

    4.1.4release notes

  • Fake timers now advance with the expect.poll interval.

    4.1.3release notes

  • Prevents runner types from leaking into expect types.

    4.1.3release notes

  • Fixes obsolete snapshot warnings for snapshot properties mismatches.

    4.1.3release notes

  • Fixes suite hooks throwing errors for unused auto test-scoped fixtures.

    4.1.3release notes

  • Prevents Vite types from leaking into the UI surface.

    4.1.3release notes

  • Corrects coverageConfigDefaults values and types.

    4.1.2release notes

  • Mock and unmock resolution is now sequential.

    4.1.2release notes

  • Fixes output-limit overcounting in pretty-format output.

    4.1.2release notes

  • Browser tests take a failure screenshot when a stable screenshot cannot be captured.

    4.1.2release notes

  • Preserves the coverage report when the HTML reporter overlaps.

    4.1.1release notes

  • Detects fixtures that return without calling use, preventing incomplete fixture execution from going unnoticed.

    4.1.1release notes

  • Properly re-evaluates actual modules of mocked external modules.

    4.1.1release notes

  • Fixes RegExp serialization for retry.condition.

    4.1.1release notes

  • Fixes the sinon-chai style assertion API.

    4.1.1release notes

  • Soft assertions continue after promise errors from .resolves or .rejects.

    4.1.1release notes

  • Stops treating extra properties on a test return value as tests.

    4.1.1release notes

  • Fixes a type regression affecting static class methods passed through vi.mocked().

    4.1.1release notes

  • bench.reporters no longer reports type errors when given file-name string paths.

    4.1.0release notes

  • Browser mode now handles screenshot artifacts and avoids duplicate failure screenshots.

    4.1.0release notes

  • external and noExternal are now handled during the configEnvironment hook.

    4.1.0release notes

  • userEvent actions now support ensureAwaited.

    4.1.0release notes

  • hideSkippedTests no longer hides test.todo.

    4.1.0release notes

  • Hooks now respect maxConcurrency.

    4.1.0release notes

  • Inline snapshots now work inside test.for/each.

    4.1.0release notes

  • Passing toMatchScreenshot tests no longer updates screenshots.

    4.1.0release notes

  • Artifact attachments are processed when generating the HTML reporter.

    4.0.18release notes

  • createRequire now uses meta.url.

    4.0.18release notes

  • addEventHandler now handles null options without failing.

    4.0.17release notes

  • File uploads now preserve the correct File instance in browser mode.

    4.0.17release notes

  • fileParallelism now works when configured on a browser-mode instance.

    4.0.17release notes

  • The HTML reporter detects gzip using magic numbers instead of the Content-Type header.

    4.0.17release notes

  • import.meta.env defines are fixed for inline browser projects.

    4.0.17release notes

  • Mock transformation now works correctly with classes.

    4.0.17release notes

  • process.env defines are fixed for inline browser projects.

    4.0.17release notes

  • Runner errors are improved when code imports outside of test context.

    4.0.17release notes

  • Reports now identify the test module when it fails to run.

    4.0.17release notes

  • Nested test.only selections are respected inside describe.only blocks.

    4.0.17release notes

  • Typecheck reports provide a better error message when tsc outputs help text.

    4.0.17release notes

  • Environment options are validated when a worker is reused.

    4.0.17release notes

  • Worker start failures are handled gracefully.

    4.0.17release notes

  • Console log string formatting works correctly when placeholders are included.

    4.0.16release notes

  • Fully dynamic imports can now be inlined.

    4.0.16release notes

  • The module graph UI works correctly with headless browser mode.

    4.0.16release notes

  • The browser mode import.meta.env definition is fixed.

    4.0.16release notes

  • Vitest no longer crashes when process.versions is stubbed.

    4.0.16release notes

  • Browser integrations can import recordArtifact from the vitest package.

    4.0.16release notes

  • Source maps for untested Istanbul files are corrected.

    4.0.16release notes

  • Browser mode testTimeout defaults back to 15 seconds.

    4.0.16release notes

  • Extended matchers preserve currentTestName.

    4.0.15release notes

  • External dependency behavior is corrected when using the dependency optimizer.

    4.0.15release notes

  • The Istanbul coverage provider no longer breaks source maps.

    4.0.15release notes

  • Uses optimizeDeps.rolldownOptions to address a deprecated warning and fix ssr.external: true.

    4.0.15release notes

  • Overridden methods are not mocked when the parent was automocked.

    4.0.15release notes

  • Runs toMatchScreenshot only once when used with expect.element.

    4.0.15release notes

  • MessagePort objects work with Worker.postMessage when clone is set to native.

    4.0.15release notes

  • Circular modules are invalidated correctly when rerunning with coverage enabled.

    4.0.14release notes

  • Non-UI browser mode no longer applies the reverted viewport scaling behavior.

    4.0.14release notes

  • VITEST_POOL_ID is initialized before environment setup.

    4.0.14release notes

  • VITEST_WORKER_ID is initialized before environment setup.

    4.0.14release notes

  • Vitest types no longer depend on types from Vite 7.1.

    4.0.13release notes

  • The browser entry no longer imports Node.js-dependent types.

    4.0.13release notes

  • Public types no longer import from @opentelemetry/api.

    4.0.12release notes

  • Stack traces are parsed correctly for the Bun runtime.

    4.0.10release notes

  • The UI uses execution time from the WebSocket reporter when the run finishes.

    4.0.10release notes

  • Browser dependency stack traces are handled correctly when external source maps are used.

    4.0.10release notes

  • The browser UI no longer scales the iframe when the UI is disabled.

    4.0.10release notes

  • The onCancel callback is removed when a worker is terminated.

    4.0.10release notes

  • Vitest no longer starts a new run while cancellation is in progress.

    4.0.10release notes

  • Reporters now report the correct test run duration when the run ends.

    4.0.10release notes

  • The UI now reports file, suite, and test durations correctly.

    4.0.9release notes

  • A cloned request in jsdom is now an actual Request instance.

    4.0.9release notes

  • Fork workers receive more time to start, improving reliability when launching worker processes.

    4.0.9release notes

  • Passes no argument to the Webdriver command when the .click interaction command receives no argument.

    4.0.8release notes

  • Restores the missed context.d.ts file.

    4.0.8release notes

  • Corrects the error message shown when expect.element() is not awaited.

    4.0.8release notes

  • Prevents forks from failing when Windows Defender is enabled.

    4.0.8release notes

  • Cleans up frame-ancestors from the CSP header in the coverage middleware.

    4.0.8release notes

  • Works around the noExternal merging bug on Vite 6.

    4.0.8release notes

  • Properly encodes Uint8Array bodies in annotations.

    4.0.8release notes

  • Copies static properties when a spy is initialized with vi.fn(), and fixes types for vi.spyOn(obj, class).

    4.0.8release notes

  • Fixes types for vi.spyOn(obj, class).

    4.0.8release notes

  • The CLI now parses --execArgv as an array.

    4.0.7release notes

  • With isolate disabled, Vitest creates one environment per worker instead of recreating it.

    4.0.7release notes

  • Browser mode now inherits the general isolate option.

    4.0.7release notes

  • Vitest avoids passing the --require argument when running in Deno.

    4.0.7release notes

  • The matcher now accepts Locator values as possible element types.

    4.0.7release notes

  • Typecheck reruns now work outside tsc.

    4.0.7release notes

  • The jsdom environment now supports URL.createObjectURL.

    4.0.7release notes

  • Additional keys are properly torn down in happy-dom.

    4.0.6release notes

  • Errors with different diffs are no longer merged when reported.

    4.0.6release notes

  • Importing a type from an external package no longer throws.

    4.0.6release notes

  • jsdom now passes Node.js FormData through to Request.

    4.0.6release notes

  • Browser mode now supports module tracking.

    4.0.6release notes

  • Browser setup files are re-evaluated on each test run.

    4.0.6release notes

  • Spying types are improved for more accurate type checking.

    4.0.6release notes

  • The same environment is reused when isolate and fileParallelism are false.

    4.0.6release notes

  • Virtual files are no longer filtered out before remapping to sources during coverage processing.

    4.0.6release notes

  • Pool error messages now use groupOrder instead of groupId.

    4.0.5release notes

  • Dependencies are externalized while respecting ssr.noExternal, fixing Svelte and Astro integrations.

    4.0.5release notes

  • Fixes an RPC listener leak when isolate is disabled.

    4.0.4release notes

  • Built-in modules can now be mocked without using the node: prefix.

    4.0.4release notes

  • The vi.mocked utility now accepts classes.

    4.0.4release notes

  • Publishes a missing context file required for WebdriverIO browser integration.

    4.0.4release notes

  • Worker standard input and output are captured by the logger.

    4.0.4release notes

  • The happy-dom environment supports fetch globals.

    4.0.3release notes

  • Browser in-source testing validation is more stable.

    4.0.3release notes

  • The init command uses the correct JSX or TSX extension.

    4.0.3release notes

  • Reporter options from config are preserved when CLI reporters override configured reporters.

    4.0.3release notes

  • The deprecation notice is no longer printed in node_modules.

    4.0.2release notes

  • Test environment variables are assigned before tests run so they stay synchronized with process.env.

    4.0.2release notes

  • Spies are reset correctly when both restoreMocks and mockReset are enabled in the configuration.

    4.0.2release notes

  • Spies now properly inherit the implementation's length property.

    4.0.2release notes

  • The communication channel is no longer torn down too soon when work is still running after a test.

    4.0.1release notes

  • BrowserCommand can be imported when no browser package is installed.

    4.0.0release notes

  • When expect.poll assertions fail, the assertion error is shown first.

    4.0.0release notes

  • Filename filters no longer run duplicate tests in workspaces.

    4.0.0release notes

  • import.meta.resolve now works on Vite 7.

    4.0.0release notes

  • The standalone mode is ignored when a CLI filename filter is used.

    4.0.0release notes

  • Test errors in Node.js context always have a stacks property.

    4.0.0release notes