v3.2.0
Breaking Changes📦 vitestView on GitHub →
⚠ 3 breaking✨ 14 features🐛 21 fixes⚡ 1 deprecations🔧 19 symbols
Summary
Vitest vX.Y introduces many new features such as `ctx.signal`, custom test name colors, and browser enhancements, while deprecating `workspace` in favor of `projects` and fixing numerous bugs.
⚠️ Breaking Changes
- Removed unused exports may cause import errors for code that imported them.
- The `workspace` configuration option has been removed; using it will cause a runtime error.
- The internal pattern matching library was switched from `micromatch` to `picomatch`, which may change pattern matching behavior.
Migration Steps
- Replace any usage of the `workspace` configuration option with `projects`.
- Check your imports for symbols that were removed as unused exports and delete or replace them.
- If you relied on `micromatch`‑specific pattern behavior, verify patterns work as expected with `picomatch`.
- Update any custom reporters or CI integrations to handle the new `onWritePath` option if used.
- Review browser configuration to use the new `connect`, `screenshot.save`, and custom locators APIs where applicable.
- If you use per‑file or per‑worker fixtures, adjust your fixture definitions to the new API.
✨ New Features
- Added `ctx.signal` to provide abort signals for test execution.
- Supported custom colors for `test.name`.
- Introduced `vi.mockObject` to automock any object.
- Added `watchTriggerPatterns` option for fine‑grained watch triggering.
- Implemented explicit resource management support in mocked functions.
- Added `sequence.groupOrder` option to control test sequence ordering.
- Initial support for Temporal equality assertions.
- Added support for Vite 7.
- Tracked module execution `totalTime` and `selfTime` metrics.
- Introduced an Annotation API for attaching metadata to tests.
- Browser provider enhancements: `connect` option for Playwright, `screenshot.save` option, and a custom locators API.
- Coverage: experimental V8 AST‑aware source map remapping.
- Reporter: added `onWritePath` option to the `github-actions` reporter.
- Vitest: allowed per‑file and per‑worker fixtures.
🐛 Bug Fixes
- Replaced `micromatch` with `picomatch` for pattern matching.
- Improved handling of unhandled errors occurring outside of a test.
- Generated a separate config for `vitest init browser` instead of a workspace file.
- Switched ExpectStatic `any` types to `AsymmetricMatcher<unknown>` with `DeeplyAllowMatchers<T>`.
- Removed unused exports from the public API.
- Now throws an error when the type‑checker fails to spawn.
- Ignored non‑string `stack` properties when serialising errors.
- Applied browser CLI options only when the project already has a browser configured.
- Ensured errors retain their message and stack after `toJSON` serialisation.
- Browser: resolved filesystem commands relative to the project root.
- Browser: runs tests serially when the provider lacks a mocker.
- Browser: resolved `upload` files relative to the project root.
- Browser: awaited mocker invalidation to avoid race conditions.
- Browser: shared Vite cache with the project cache.
- Browser: added `this` type to `locators.extend`.
- Cache: preserved test results from previous runs.
- CLI: added built‑in reporters list to `--help` output.
- CLI: correctly parsed `--silent` flag values.
- Coverage: Istanbul provider no longer uses Vite‑preserved query parameters.
- Coverage: fixed missing source tests for browser + V8.
- Coverage: ensured in‑source test cases are not excluded.
🔧 Affected Symbols
ctx.signaltest.namevi.mockObjectwatchTriggerPatternsworkspaceprojectsmocked functions resource managementsequence.groupOrderTemporal equalitytotalTimeselfTimeAnnotation APIbrowser.connectscreenshot.savelocators.extendonWritePathfixturesmicromatchpicomatch⚡ Deprecations
- `workspace` configuration option is deprecated in favor of `projects`.