Skip to content

Upgrading @vitest/coverage-v8 3 to 4

Breaking3.2.7 → 4.1.12Breaking35Security3Platform3Deprecated5New118Changed54Fixed359Other3

BreakingUpgrade verdict

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

  • Renames collect to import and removes prepare.
  • The simple built-in 'basic' test reporter is no longer available.
  • The minWorkers option is gone; in non watch mode it is now automatically 0.
  • The default set of files excluded from tests is now defined by a simpler pattern.
Top 5 of 43 that need code or config changes

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

Migration guide ↗

Adds @vitest/utils 4.1.12, obug ^2.1.1.

Drops @ampproject/remapping, debug, istanbul-lib-source-maps, magic-string, test-exclude.

Installs 28 packages in all (was 76).

Breaking32
Renames collect to import and removes prepare.
collectimportprepare
Removes the 'basic' reporter.
basic
Removes minWorkers and sets it automatically to 0 in non watch mode.
minWorkers
Simplifies the default exclude pattern.
Removes the deprecated getSourceMap.
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.
environmentMatchGlobspoolMatchGlobs
Removes the deprecated workspace option in favor of projects.
workspaceprojects
Removes deprecated reporter APIs.
reporter
Removes the ast export from utils.
ast
Removes the .all coverage option and reworks include/exclude.
.allincludeexclude
Rewrites the spying implementation to make module mocking more intuitive.
Replaces 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.
browserprovider
Passes current equality testers to asymmetric matchers, changing matcher behavior.
expectasymmetric matcher
Projects only accept files whose names contain vitest.config or vite.config.
vitest.configvite.config
Adds support for spying on classes.
spy
V8 coverage now supports only AST based remapping.
Verbose reporter prints tests in a list and introduces a tree reporter.
verbosetree
Rewrites the test pools without tinypool, changing pool internals.
tinypool
Sets mode to todo when no function is passed to test or describe.
testdescribetodo
Fails tests with obsolete snapshots on CI.
snapshot
Security3
Restricts redirect mocks to the fs allowlist.
Disables the browser client cdp API when allowWrite or allowExec is false.
cdpallowWriteallowExec
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 matcher context.
Deprecates toBe* spy assertions in favor of toHaveBeen* and toThrowError.
toBe*toHaveBeen*toThrowError
Logs a deprecation warning when the deprecated 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.

  • removed: property V8CoverageProvider.testExclude: InstanceType<typeof TestExclude>
  • changed: class V8CoverageProvider extends BaseCoverageProvider<ResolvedCoverageOptions<'v8'>> implements CoverageProvider → class V8CoverageProvider extends BaseCoverageProvider implements CoverageProvider