v4.0.0-beta.1
Breaking Changes📦 vitestView on GitHub →
⚠ 11 breaking✨ 1 features🐛 1 fixes🔧 16 symbols
Summary
Vitest v4.0.0‑beta.1 introduces major breaking changes, removes many deprecated APIs, adds an `onConsoleLog` entity, and includes a small bug fix for Chai typings.
⚠️ Breaking Changes
- Removed the 'basic' reporter; replace it with a supported reporter (e.g., 'default' or a custom reporter) in the Vitest config.
- Simplified the default exclude pattern; update any custom exclude patterns that relied on the previous defaults.
- Removed the deprecated `getSourceMap` function; use the new source map APIs provided by Vitest instead.
- Replaced deprecated `ErrorWithDiff` with `TestError`; update error handling code to import and use `TestError`.
- Removed `UserConfig` type; switch to using `ViteUserConfig` for configuration typing.
- Removed deprecated coverage options; import coverage utilities from `vitest/node` and adjust configuration accordingly.
- Removed deprecated internal helpers and environment exports; import required helpers directly from their new locations.
- Removed deprecated `typecheck` and `runner` types; update type imports to the new definitions.
- Node-specific types are no longer exported from the main entry point; import them from `vitest/node` instead.
- Coverage: V8 now supports only AST‑based remapping; adjust any custom V8 remapping logic to work with AST.
- Coverage: `.all` option removed and `include`/`exclude` reworked; update coverage config to use the new `include` and `exclude` arrays.
Migration Steps
- Replace the 'basic' reporter with another supported reporter in the Vitest configuration.
- Review and adjust any custom exclude patterns that depended on the previous default pattern.
- Remove usages of `getSourceMap` and adopt the new source map API provided by Vitest.
- Change imports from `ErrorWithDiff` to `TestError` and update error handling accordingly.
- Update TypeScript configuration to use `ViteUserConfig` instead of the removed `UserConfig` type.
- Migrate coverage configuration to the exports from `vitest/node` and drop the deprecated options.
- Update imports for internal helpers and environment exports to their new module locations.
- Replace `typecheck` and `runner` type imports with the new type definitions.
- Import Node‑specific types from `vitest/node` rather than the root package entry point.
- Adapt any custom V8 coverage remapping to use the new AST‑based approach.
- Remove the `.all` coverage option and configure coverage using the new `include` and `exclude` arrays.
✨ New Features
- Added an entity to `onConsoleLog` allowing users to receive structured console log events.
🐛 Bug Fixes
- Fixed TypeScript declaration merging for Chai so that it works correctly with TS‑Go.
🔧 Affected Symbols
basic reportergetSourceMapErrorWithDiffTestErrorUserConfigViteUserConfigcoverage optionsinternal helpersenvironment exportstypecheckrunnerNode types (main entry point)vitest/nodeV8 coverage remappingcoverage .allcoverage include/exclude