Skip to content

Upgrading @vitest/ui 3 to 4

Breaking3.2.7 → 4.1.12Breaking35Security2Platform3Deprecated5New122Changed53Fixed360Other3

BreakingUpgrade verdict

32 breaking changes and 3 platform requirement changes and 2 security fixes.

  • Renames collect to import and removes prepare.
  • The minWorkers option is gone; in non watch mode the minimum is now 0 automatically.
  • The simple built-in 'basic' test reporter is no longer available.
  • The default set of files excluded from test runs is now simpler, which may change which files are picked up.
Top 5 of 42 that need code or config changes

@vitest/ui publishes an official migration guide for version 4. It covers more than the release notes do.

Migration guide ↗
Breaking32
Renames collect to import and removes prepare.
collectimportprepare
Removes minWorkers and sets it automatically to 0 in non watch mode.
minWorkers
Removes the 'basic' reporter.
basic
Simplifies the default exclude pattern.
Removes the deprecated getSourceMap API.
getSourceMap
Removes the UserConfig type in favor of ViteUserConfig.
UserConfigViteUserConfig
Removes deprecated coverage options in favor of vitest/node exports.
vitest/node
Removes deprecated typecheck and runner types.
Removes Node types from the main entry point, use vitest/node instead.
vitest/node
Removes support for Vite 5.
Removes deprecated types.
Removes deprecated environmentMatchGlobs and poolMatchGlobs options.
environmentMatchGlobspoolMatchGlobs
Removes the deprecated workspace option in favor of projects.
workspaceprojects
Removes deprecated reporter APIs.
Removes the ast export from utils.
ast
Removes coverage .all and reworks include/exclude.
.allincludeexclude
Rewrites the spying implementation to make module mocking more intuitive.
Replaces the deprecated ErrorWithDiff with TestError.
ErrorWithDiffTestError
Removes deprecated internal helpers and environment exports.
Ignores --standalone when a CLI filename filter is used.
--standalone
Uses module-runner instead of vite-node.
module-runnervite-node
Includes shadow root contents in pretty-format output.
Removes the deprecated order option from the test() API.
test()order
Browser mode now requires a provider factory instead of a provider string.
browser.provider
Passes current equality testers to asymmetric matchers.
expect
Projects only accept files with vitest.config or vite.config in the name.
projectsvitest.configvite.config
Supports spying on classes.
spy
V8 coverage now supports only AST based remapping.
V8
Verbose reporter prints tests in a list and introduces a tree reporter.
verbosetree
Rewrites the test pools without tinypool.
tinypool
Sets mode to todo when no function is passed to test or describe.
testdescribetodo
Fails tests with obsolete snapshots on CI.
Security2
Restricts redirect mocks to the fs allowlist.
Bumps flatted and removes version pinning to resolve flatted's CVE related issues.
flatted
Platform3
Updates Vite's peer dependency range in mocker.
Updates the engines field to drop Node 18 support.
engines
Updates @types/node peer dependencies.
@types/node
Deprecated5
Deprecates several vitest/* entry points.
Deprecates unused types in the matcher context.
Deprecates toBe* spy assertions in favor of toHaveBeen* and toThrowError.
toBe*toHaveBeen*toThrowError
Logs a deprecation warning when test.poolOptions is set.
test.poolOptions
Browser mode inherits the isolate option and deprecates browser.isolate and browser.fileParallelism.
isolatebrowser.isolatebrowser.fileParallelism

Generated by DepDelta from published .d.ts files. Not mixed with prose notes.

  • changed: const default: (ctx: Vitest) => Plugin → const default: (ctx: Vitest) => Vite.Plugin