unstale

npm / vitest

vitest

What changed in vitest 2 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

100 breaking4 security12 deprecations198 new APIs and options12 performance120 behavior and defaults28 tooling265 fixes and other

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

npx @unstale/cli init

@unstale/cli on npm

vitest 5276 changes

Breaking changes 46

  • The run now fails when a tester cannot connect.

    5.1.0release notes

  • 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 top-level bench import is no longer available; benchmarking uses a test-context fixture inside regular test() calls in benchmark files.

    5.0.0upgrade guide

  • Benchmark files receive bench as a test-context fixture, giving benchmarks access to runner fixtures, lifecycle hooks, retries, filtering, and assertions.

    5.0.0upgrade guide

  • The public benchmark API is rewritten.

    5.0.0release notes

  • The browser default port changes to 23315.

    5.0.0release notesupgrade guide

  • The browser.api option is deprecated and no longer has any effect; move its value to the top-level api option.

    5.0.0upgrade guide

  • 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 notesupgrade guide

  • 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 notesupgrade guide

  • The option is no longer experimental and persists transformed modules on disk for reuse across reruns and separate Vitest processes.

    5.0.0upgrade guide

  • 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 notesupgrade guide

  • The interface takes the matcher return type as its first parameter and the received value type as its second parameter.

    5.0.0upgrade guide

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

    5.0.0release notesupgrade guide

  • Asynchronous assertions such as resolves and rejects fail the test if not awaited, instead of being awaited at test end with only a warning.

    5.0.0upgrade guide

  • 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

  • Defines per-argument behaviors on a spy, matching arguments with deep equality and supporting asymmetric matchers.

    5.0.0upgrade guide

  • Vitest 5 requires Vite 6.4.0 or later.

    5.0.0upgrade guide

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

    5.0.0release notes

  • Reporters and integrations write output into a single .vitest directory at the project root by default.

    5.0.0upgrade guide

  • 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 48

  • Adds an environment variable to hide the experimental warning.

    5.1.1release notes

  • Adds environment variables for the fs module cache, allowing developers to configure it.

    5.1.1release notes

  • The V8 coverage provider now supports the ignoreNode option.

    5.1.0release notes

  • Browser tests can mock modules through an import map.

    5.1.0release notes

  • Adds a flag to run only failed tests.

    5.1.0release notes

  • Exposes the result of each retry or repeat attempt.

    5.1.0release notes

  • Introduces an experimental browser pointer API.

    5.1.0release notes

  • Introduces a flag for selecting tests based on the last run.

    5.1.0release notes

  • Adds a message option to vi.waitFor and vi.waitUntil.

    5.1.0release notes

  • 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

  • Controls whether locator errors show HTML, an ARIA snapshot, or both.

    5.0.0upgrade guide

  • Enables Browser Mode Trace View, recording interactions, assertions, and page marks as DOM snapshots that can be replayed step by step.

    5.0.0upgrade guide

  • 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

  • With the v8 provider, tracks coverage of node:child_process and node:worker_threads spawned during the test run.

    5.0.0upgrade guide

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

    5.0.0release notesupgrade guide

  • Plugins can participate in the file system module cache key with this API.

    5.0.0upgrade guide

  • 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 notesupgrade guide

  • The JSON reporter gains a filterMeta option.

    4.1.4, 5.0.0release notesupgrade guide

  • The JUnit reporter supports jest-junit-compatible naming options.

    5.0.0upgrade guide

  • 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 notesupgrade guide

  • -p becomes shorthand for --project.

    5.0.0release notesupgrade guide

  • page.mark supports a custom kind.

    5.0.0release notes

  • Spy types now support private methods.

    5.0.0release notes

  • The project filter is aware of project hierarchy.

    5.0.0upgrade guide

  • The CLI gains a --repeats option.

    5.0.0release notesupgrade guide

  • browser.expect.toMatchScreenshot accepts screenshotDirectory.

    5.0.0release notes

  • The HTML reporter can inline UI assets, metadata, and test attachments into one index.html for uploading as a CI artifact.

    5.0.0upgrade guide

  • 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 notesupgrade guide

  • Assertion that checks whether every registered conditional mock behavior was consumed.

    5.0.0upgrade guide

  • 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

  • Runs the test suite with alternative configurations and recommends options that could make it faster.

    5.0.0upgrade guide

Performance 6

  • Reuses cached modules during a Vitest run in the browser.

    5.1.1release notes

  • Resolves CLI file filters once instead of once per test file.

    5.1.1release notes

  • Sends source maps to workers as a string.

    5.1.1release notes

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

    5.0.0release notes

  • Inline projects that do not change the Vite config reuse the declaring config's Vite server, so shared files are transformed once.

    5.0.0upgrade guide

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

    5.0.0release notes

Behavior and default changes 45

  • Fake timers now support the node:timers module.

    5.1.0release notes

  • Fake timers now support the node:timers/promise module.

    5.1.0release notes

  • Failure-only trace view is enabled by default.

    5.1.0release notes

  • Now supports Temporal.Instant and Temporal.ZonedDateTime values.

    5.1.0release notes

  • 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 mode now runs on a single Vite server configured by the top-level api option.

    5.0.0upgrade guide

  • 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 notesupgrade guide

  • 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 notesupgrade guide

  • 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

  • Fake timers and vi.setSystemTime() now mock the Temporal API; Temporal is included in the default set of faked APIs.

    5.0.0upgrade guide

  • Logs recorded during a test are exposed.

    5.0.0release notesupgrade guide

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

    5.0.0release notes

  • Title placeholders support non-ASCII characters.

    5.0.0upgrade guide

  • thresholds.perFile accepts an object.

    5.0.0release notesupgrade guide

  • 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 8

  • Adds interactive review for failed snapshots.

    5.1.0release notes

  • 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 120

  • Improves the diffs shown for asymmetric matchers.

    5.1.1release notes

  • Corrects parsing of the bail option.

    5.1.1release notes

  • Scales the iframe for preview when the UI is hidden.

    5.1.1release notes

  • Tests rerun on file changes after a configuration restart.

    5.1.1release notes

  • Allows cache hits in configureServer.

    5.1.1release notes

  • Prevents the context expect from leaking beyond its intended scope.

    5.1.1release notes

  • Transforms untested files with the correct project.

    5.1.1release notes

  • Includes merged errors in the error divider count.

    5.1.1release notes

  • Resets local expect state between retries for assertion-count checks.

    5.1.1release notes

  • Fixes expect.element behavior with message and removes redundant error labels in trace steps.

    5.1.1release notes

  • Skips ambiguous trace steps in concurrent tests.

    5.1.1release notes

  • Tears down fixture contexts one at a time.

    5.1.1release notes

  • Reports fixture teardown errors only once.

    5.1.1release notes

  • Terminates stuck orphaned forks workers.

    5.1.1release notes

  • Watches cached files located outside the project root.

    5.1.1release notes

  • The fs module cache always leaves a manifest.

    5.1.1release notes

  • Treats a removed cache file as a cache miss.

    5.1.1release notes

  • Preserves re-exports of hoisted imports.

    5.1.1release notes

  • Allows assigning to import.meta.env.

    5.1.1release notes

  • With isolate disabled, workers that failed to start are not reused.

    5.1.1release notes

  • Reports crashed test files as failed in JSON output.

    5.1.1release notes

  • Wildcards now match hyphens and periods.

    5.1.1release notes

  • Sorts test files before applying the seeded shuffle.

    5.1.1release notes

  • Applies sharding before the test run starts.

    5.1.1release notes

  • Each test attempt receives a new signal.

    5.1.1release notes

  • Uses primordials to allow spying on builtins.

    5.1.1release notes

  • Shuts down disconnected workers even when testTimeout is disabled.

    5.1.1release notes

  • Timeouts throw error classes instead of a generic Error.

    5.1.1release notes

  • Handles subprocess script coverages separately.

    5.1.1release notes

  • The API now supports port 0.

    5.1.0release notes

  • Setup files are rerun after --changed filtering.

    5.1.0release notes

  • Tests that import a deleted file are now run.

    5.1.0release notes

  • Linked packages now use the root __mocks__ directory.

    5.1.0release notes

  • Projects inherit watch from the root config.

    5.1.0release notes

  • 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 4351 changes

Breaking changes 35

  • 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 notesupgrade guide

  • 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

  • Install this separate package to define a Playwright browser provider and configure custom options.

    4.0.0upgrade guide

  • Install this separate package to define a Preview browser provider.

    4.0.0upgrade guide

  • Install this separate package to define a WebdriverIO browser provider and configure custom options.

    4.0.0upgrade guide

  • 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 9

  • 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

  • Import browser context APIs such as page from vitest/browser instead of @vitest/browser/context.

    4.0.0upgrade guide

New APIs and options 97

  • Istanbul coverage now supports the instrumenter option.

    4.1.5release notes

  • Experimental support for aria snapshots is added.

    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

  • Pass this option to enable Playwright Traces; off, retry-based, and failure-based values are also available.

    4.0.0upgrade guide

  • 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 notesupgrade guide

  • The enableCoverage method was added.

    4.0.0release notesupgrade guide

  • expect.assert now supports type narrowing.

    4.0.0release notesupgrade guide

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

    4.0.0release notes

  • Use this asymmetric matcher with a Standard Schema v1 object to validate values against the schema.

    4.0.0upgrade guide

  • The module-runner package now supports getBuiltins.

    4.0.0release notes

  • The getGlobalTestNamePattern method was added.

    4.0.0release notesupgrade guide

  • The getSeed method was added.

    4.0.0release notesupgrade guide

  • 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

  • Start Vitest with this flag to connect to DevTools manually; it is available with Playwright and WebdriverIO.

    4.0.0upgrade guide

  • Locators now expose length, and toHaveLength accepts locators.

    4.0.0release notesupgrade guide

  • An onUnhandledError callback is available for handling unhandled errors.

    4.0.0release notes

  • Use this Playwright-provider API to find elements inside an iframe.

    4.0.0upgrade guide

  • TestModule now exposes relativeModuleId.

    4.0.0release notes

  • Matchers for schema validation were added.

    4.0.0release notes

  • Lifecycle hooks on the test object returned by test.extend are aware of its extended context.

    4.0.0upgrade guide

  • Set trace to enable Playwright Traces; supported values include off, on, and retry- or failure-based modes.

    4.0.0upgrade guide

  • 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 notesupgrade guide

  • 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 notesupgrade guide

  • Browser mode adds the trackUnhandledErrors option.

    4.0.0release notes

  • Use the new tree reporter to always print tests as a tree.

    4.0.0upgrade guide

  • 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 notesupgrade guide

  • Return a promise that resolves when all tests have finished running.

    4.0.0upgrade guide

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 52

  • 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

  • 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

  • Browser Mode is no longer experimental.

    4.0.0upgrade guide

  • 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 reporter prints tests in a tree only when a single test file is running.

    4.0.0upgrade guide

  • 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 notesupgrade guide

  • 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 notesupgrade guide

  • The verbose reporter now always prints tests one by one when they finish, including locally.

    4.0.0upgrade guide

  • The package can be removed from dependencies because it is now included automatically in every provider package.

    4.0.0upgrade guide

Tooling 16

  • 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.

    3.0.0, 4.1.0release notesrelease 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

  • The VS Code extension now supports the Debug Test button when running browser tests.

    4.0.0upgrade guide

  • 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

vitest 358 changes

Breaking changes 6

  • Browser mode iframe results are excluded from coverage.

    3.0.0release notes

  • Test files are always excluded from coverage.

    3.0.0release notes

  • Playwright option parameters are now non-nullable.

    3.0.0release notes

  • The behavior of spy.mockReset changes, which may require updating tests that rely on its previous behavior.

    3.0.0release notes

  • The default toFake configuration is no longer exposed.

    3.0.0release notes

  • Vite 6 support is listed as a breaking change, but a later fix says support was reverted.

    3.0.0release notes

Deprecations 1

  • Using an object as the third argument to a suite or test prints a deprecation warning.

    3.0.0release notes

New APIs and options 30

  • Playwright provider options now support actionTimeout.

    3.0.0release notes

  • Coverage thresholds can set maximum uncovered items.

    3.0.0release notes

  • JSON reports now include coverageMap.

    3.0.0release notes

  • Dynamically skipping a test can include a custom note.

    3.0.0release notes

  • Suites can set shuffle and inherit the setting from their parent suite.

    3.0.0release notes

  • Adds describe.for.

    3.0.0release notes

  • Diff options can be specified inline.

    3.0.0release notes

  • Global setup receives the current project.

    3.0.0release notes

  • Adds locator.nth().

    3.0.0release notes

  • Browser configuration can target multiple browsers.

    3.0.0release notes

  • Adds the onBrowserInit event.

    3.0.0release notes

  • Adds onTestsRerun to the global setup context.

    3.0.0release notes

  • Adds support for the printBasicPrototype diff option.

    3.0.0release notes

  • Projects can be excluded using --project=!pattern.

    3.0.0release notes

  • Adds a queued test state.

    3.0.0release notes

  • Introduces a new reporter API.

    3.0.0release notes

  • The reporter API now exposes resolved project names.

    3.0.0release notes

  • resolveSnapshotPath receives config.

    3.0.0release notes

  • The CLI supports location filters for suites.

    3.0.0release notes

  • The verbose and default reporters support a summary option.

    3.0.0release notes

  • Test context can inject values from the configuration's provide option.

    3.0.0release notes

  • Test filtering can specify a line number.

    3.0.0release notes

  • Adds the toBeOneOf matcher.

    3.0.0release notes

  • Adds utilities to check whether a mock was called after or before another.

    3.0.0release notes

  • Adds the toHaveBeenCalledExactlyOnceWith expect matcher.

    3.0.0release notes

  • Adds the toSatisfy asymmetric matcher.

    3.0.0release notes

  • Browser user events now support clipboard copy, cut, and paste.

    3.0.0release notes

  • The vitest/node entry point exposes versions; versions are also available statically on Vitest.

    3.0.0release notes

  • Exports the VitestRunner type from vitest/runners.

    3.0.0release notes

  • Workspace configuration can now be specified inline.

    3.0.0release notes

Behavior and default changes 9

  • CLI filters persist as the watch mode file filter.

    3.0.0release notes

  • diff.printBasicPrototype is false by default.

    3.0.0release notes

  • Error equality checks now compare more properties.

    3.0.0release notes

  • getMockImplementation can return a once implementation.

    3.0.0release notes

  • The junit reporter classname option accepts a function.

    3.0.0release notes

  • The project name is printed as a label.

    3.0.0release notes

  • Test hooks now receive context.

    3.0.0release notes

  • Calling spyOn for a method that is already spied on reuses the existing mock.

    3.0.0release notes

  • Slots are now allowed in vitest-browser-vue.

    3.0.0release notes

Tooling 2

Fixes and other changes 10

  • The optimizer now respects cacheDir.

    3.0.0release notes

  • cancelCurrentRun now awaits runningPromise.

    3.0.0release notes

  • Coverage is corrected when isolate: false is used.

    3.0.0release notes

  • Tests in describe.todo suites are marked as todo.

    3.0.0release notes

  • extends: true correctly inherits all root configuration properties.

    3.0.0release notes

  • Long synchronous tasks no longer time out.

    3.0.0release notes

  • Prevents an infinite loop when prettyDOM is called.

    3.0.0release notes

  • Snapshot state is reset for retries and repeated tests.

    3.0.0release notes

  • The test function result is returned to the runner.

    3.0.0release notes

  • toMatchFileSnapshot preserves whitespace.

    3.0.0release notes

vitest 254 changes

Breaking changes 13

  • The browser.fileParallelism option was removed.

    2.0.0release notes

  • When coverage.exclude is overridden, Vitest no longer adds test files to the exclude patterns; add test patterns manually or merge with the defaults.

    2.0.0release notes

  • This option is enabled by default, which may cause coverage results to differ from Vitest v1.

    2.0.0release notes

  • Custom pools now require a collectTests method alongside runTests.

    2.0.0release notes

  • All environment variables from .env files are exposed, not only those with a VITE_ prefix.

    2.0.0release notes

  • The location field now identifies the test function's line and column rather than the error location; includeTaskLocation must be enabled.

    2.0.0release notes

  • Mock function generic types were simplified and aligned with Jest, which may require updating type annotations.

    2.0.0release notes

  • The browser config key indexScripts was renamed to orchestratorScripts.

    2.0.0release notes

  • The browser provider formerly named none was renamed preview, and preview is now the default.

    2.0.0release notes

  • The flag was removed; the notes recommend using the new default forks pool instead.

    2.0.0release notes

  • Returned promises are no longer unwrapped; async results remain Promises. Use settledResults or toHaveResolved for unwrapped values.

    2.0.0release notes

  • Suite hooks now run in a stack, a behavior change that may make tests run a little slower.

    2.0.0release notes

  • The watchExclude option was removed.

    2.0.0release notes

New APIs and options 23

  • Browser mode gained commands for communication between the server and browser.

    2.0.0release notes

  • An init command was added for browser tests.

    2.0.0release notes

  • Module mocking is now implemented in browser mode.

    2.0.0release notes

  • An option was added to take screenshots when a browser test fails.

    2.0.0release notes

  • Browser tests can change the viewport; the Playwright provider supports resizing it.

    2.0.0release notes

  • A browser.ui configuration option was added.

    2.0.0release notes

  • The browser interactive API now supports the click event.

    2.0.0release notes

  • An option was added to print a console stack trace.

    2.0.0release notes

  • Expect options can now be configured in the config.

    2.0.0release notes

  • Browser mode adds expect.dom and bundles jest-dom matchers with @vitest/browser.

    2.0.0release notes

  • A polling utility was added to expect.

    2.0.0release notes

  • Mocks now collect their contexts.

    2.0.0release notes

  • Browser tests can take screenshots, with an option to return the screenshot as base64.

    2.0.0release notes

  • An option was added to return a screenshot as base64.

    2.0.0release notes

  • The blob reporter generates reports in separate processes for later combination with vitest --merge-reports.

    2.0.0release notes

  • This new property unwraps promises returned by mocked functions.

    2.0.0release notes

  • The runner now provides test.for.

    2.0.0release notes

  • thresholds.autoUpdate now supports mergeConfig.

    2.0.0release notes

  • This matcher accepts an unwrapped promise value.

    2.0.0release notes

  • The interactive API now supports tripleClick.

    2.0.0release notes

  • Vitest now allows testing unhandled rejections and exceptions.

    2.0.0release notes

  • Several userEvent methods were implemented, including fill and dragAndDrop events, and tripleClick was added to the interactive API.

    2.0.0release notes

  • A list API prints collected tests without running them; custom pools must implement collectTests alongside runTests.

    2.0.0release notes

Behavior and default changes 14

  • The browser page no longer reloads during watch mode.

    2.0.0release notes

  • Suites can now run concurrently.

    2.0.0release notes

  • The config.test.env value can now be augmented.

    2.0.0release notes

  • The --exclude option can now be repeated.

    2.0.0release notes

  • Tests now run in parallel in headless mode.

    2.0.0release notes

  • JSON output now includes meta.

    2.0.0release notes

  • The merge-reports command now supports coverage reports.

    2.0.0release notes

  • JSON output now includes the median.

    2.0.0release notes

  • The default pool changed to forks for compatibility; it may be slightly slower than the previous threads pool.

    2.0.0release notes

  • StackBlitz now uses the preview provider.

    2.0.0release notes

  • Pool options are now marked as unavailable in project config.

    2.0.0release notes

  • provide is now exposed on the public API.

    2.0.0release notes

  • Browser mode now supports shadow roots and SVG elements.

    2.0.0release notes

  • The workers option now accepts percentage values.

    2.0.0release notes

Tooling 2

  • The package is now supported out of the box in browser mode.

    2.0.0release notes

  • An import statement can now be used as the vi.mock path, improving IDE support.

    2.0.0release notes

Fixes and other changes 2

  • Browser mode now allows iframes to load with a custom CSP header.

    2.0.0release notes

  • The project.provide type was corrected.

    2.0.0release notes