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.
In plain terms
- 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.
Must act 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).
What you must change
Breaking32
Renames collect to import and removes prepare.
collectimportprepareRemoves the 'basic' reporter.
basicRemoves minWorkers and sets it automatically to 0 in non watch mode.
minWorkersSimplifies the default exclude pattern.
Removes the deprecated getSourceMap.
getSourceMapRemoves the UserConfig type in favor of ViteUserConfig.
UserConfigViteUserConfigRemoves deprecated coverage options in favor of vitest/node exports.
vitest/nodeRemoves deprecated typecheck and runner types.
Removes Node types from the main entry point, use vitest/node instead.
vitest/nodeRemoves support for Vite 5.
Removes deprecated types.
Removes deprecated environmentMatchGlobs and poolMatchGlobs.
environmentMatchGlobspoolMatchGlobsRemoves the deprecated workspace option in favor of projects.
workspaceprojectsRemoves deprecated reporter APIs.
reporterRemoves the ast export from utils.
astRemoves the .all coverage option and reworks include/exclude.
.allincludeexcludeRewrites the spying implementation to make module mocking more intuitive.
Replaces deprecated ErrorWithDiff with TestError.
ErrorWithDiffTestErrorRemoves deprecated internal helpers and environment exports.
Ignores --standalone when a CLI filename filter is used.
--standaloneUses module-runner instead of vite-node.
module-runnervite-nodeIncludes shadow root contents in pretty-format output.
Removes the deprecated order option from the test() API.
test()orderBrowser mode now requires a provider factory instead of a provider string.
browserproviderPasses current equality testers to asymmetric matchers, changing matcher behavior.
expectasymmetric matcherProjects only accept files whose names contain vitest.config or vite.config.
vitest.configvite.configAdds support for spying on classes.
spyV8 coverage now supports only AST based remapping.
Verbose reporter prints tests in a list and introduces a tree reporter.
verbosetreeRewrites the test pools without tinypool, changing pool internals.
tinypoolSets mode to todo when no function is passed to test or describe.
testdescribetodoFails tests with obsolete snapshots on CI.
snapshotSecurity3
Restricts redirect mocks to the fs allowlist.
Disables the browser client cdp API when allowWrite or allowExec is false.
cdpallowWriteallowExecBumps flatted and removes version pinning to resolve flatted's CVE related issues.
flattedPlatform3
Updates Vite's peer dependency range in mocker.
Updates the
engines field to drop Node 18 support.enginesUpdates
@types/node peer dependencies.@types/nodeDeprecations to plan for
Deprecated5
Deprecates several vitest/* entry points.
Deprecates unused types in matcher context.
Deprecates
toBe* spy assertions in favor of toHaveBeen* and toThrowError.toBe*toHaveBeen*toThrowErrorLogs a deprecation warning when the deprecated
test.poolOptions is set.test.poolOptionsBrowser mode inherits the
isolate option and deprecates browser.isolate and browser.fileParallelism.isolatebrowser.isolatebrowser.fileParallelismAPI changes
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