Upgrading @vitest/coverage-v8 4 to 5
Breaking4.1.12 → 5.0.5Breaking65Security6Platform1New66Changed56Fixed289Other1
BreakingUpgrade verdict
65 breaking changes and a platform requirement change and 6 security fixes.
In plain terms
- Screenshots and other test attachments are now saved in a different default folder.
- Old import paths that were already deprecated have been deleted.
- Vitest no longer searches parent folders for a config file.
- The webdriverio integration package has been deleted.
Must act Top 5 of 72 that need code or config changes
Adds @vitest/istanbul-lib-coverage ^1.0.2, @vitest/istanbul-lib-report ^1.0.2.
Drops @vitest/utils, istanbul-lib-coverage, istanbul-lib-report, istanbul-reports.
Installs 19 packages in all (was 28).
What you must change
Breaking65
Changes the default
attachmentsDir from .vitest-attachements/ to .vitest/attachments/.attachmentsDirRemoves deprecated entry points.
Stops looking up the config file from ancestor directories.
Removes the webdriverio package.
webdriverioInline projects now extend the root config by default.
Parses files statically in vitest list by default.
vitest listEnables
locators.exact by default in browser mode.locators.exactDefaults
blob reporter and --merge-reports to .vitest/blob/.blob--merge-reportsWrites json and junit reporter output files to
.vitest by default.jsonjunitChanges html reporter default output to
.vitest.htmlRemoves the broken "./src/*" export from package.json.
./src/*Writes json and junit reporter output files to
.vitest by default.jsonjunit.vitestStops looking up the config file from ancestor directories.
Enables locators.exact by default in browser mode.
locators.exactMakes the
blob reporter and --merge-reports default to .vitest/blob/.blob--merge-reportsRefactors caching, fixes
: in project names, and changes the shape of the results cache.resultsReplaces
loupe.inspect with pretty-format for value formatting.loupe.inspectpretty-formatRemoves quotes from string values in
test.for/each title $ variable substitution.test.fortest.eachRemoves the
sequential test and suite options in favor of concurrent.sequentialconcurrentRepresents locators as objects instead of strings.
locatorInlines the
expect package into Vitest.expectMakes
expect.poll fail when the function does not resolve in time.expect.pollThrows an error when hoistable methods are used outside the top level scope.
Makes
toHaveTextContent strict and adds toMatchTextContent as an alternative.toHaveTextContenttoMatchTextContentInlines the
@vitest/runner package and stops publishing it.@vitest/runnerAllows mutating the happy-dom/jsdom window object.
windowExposes
concurrencyId and workerId on TestModule diagnostics and makes the id 1-based.concurrencyIdworkerIdTestModuleAdds a
screenshotDirectory config to browser.expect.toMatchScreenshot.screenshotDirectorybrowser.expect.toMatchScreenshotUpdates
@sinonjs/fake-timers and adds support for mocking Temporal.@sinonjs/fake-timersTemporalClears mocks by default before each test.
Stops emitting localStorage warnings on Node 26 and fails gracefully when a worker fails to start.
localStorageSeparates config resolution from server creation.
Enables mocking Temporal without fake timers.
TemporalAdds support for nested projects.
Uses
> as separator in -t and calculates only once.-tShares the Vite server between inline projects.
Rewrites the public benchmark API.
Changes iframe scale in browser mode.
Requires
sessionId for orchestrator HTML requests.sessionIdSaves failure screenshots in
attachmentsDir.attachmentsDirMakes coverage
include/exclude globs less eager.includeexcludeAllows
thresholds.perFile to accept an object.thresholds.perFileFixes
toThrow("") behavior by reverting #6710.toThrow()Deserializes automock as automock in the mocker.
Adds better promise support in expects and matchers.
Hardens UI API access.
Enables mocking Temporal without fake timers.
TemporalBrowser failure screenshots are saved in
attachmentsDir.attachmentsDirAdds better promise support in expects and matchers types.
Updates
@sinonjs/fake-timers and adds support for mocking Temporal.@sinonjs/fake-timersTemporalHardens UI API access.
Allows mutating the happy-dom/jsdom window object.
Requires sessionId for the browser orchestrator HTML request.
sessionIdAllows coverage thresholds.perFile to accept an object.
thresholds.perFileRewrites the public benchmark API.
Fails
expect.poll when the function did not resolve in time.expect.pollRemoves the
sequential test and suite options in favor of concurrent.sequentialconcurrentDeserializes automock as automock in the mocker.
mockerReplaces
loupe.inspect with pretty-format for value formatting.loupe.inspectpretty-formatChanges iframe scale behavior in browser mode.
Fixes coverage
include/exclude globs being too eager, changing which files are covered.includeexcludeFixes
toThrow("") behavior by reverting #6710.toThrowFails the test when an asynchronous assertion is not awaited.
Preserves class mock prototype methods on instances.
Spy preserves class mock prototype methods on instances.
Security6
Fixes shell injection safety via
github.ref_name in the publish workflow.github.ref_nameEscapes inline orchestrator scripts in the browser mode.
Disables the client cdp API when allowWrite/allowExec is false in the browser mode.
cdpallowWriteallowExecRestricts redirect mocks to the fs allowlist.
Requires authentication for coverage report and all UI subtree requests.
Requires auth for coverage report and all UI subtree requests.
Platform1
Requires Node.js 22 and Vite 6.4.
API changes
Generated by DepDelta from published .d.ts files. Not mixed with prose notes.
- changed:
const default: CoverageProviderModule → const default: CoverageProviderModule & { extendedContextCoverageDir?: string; session?: unknown | null }
- added:
property ScriptCoverageWithOffset.isExtendedContext?: boolean