v5.0.0-beta.6
Breaking Changes📦 vitestView on GitHub →
⚠ 8 breaking✨ 1 features🐛 12 fixes🔧 14 symbols
Summary
This release introduces `vi.when()` and updates underlying dependencies like fake-timers, while enforcing stricter defaults for mock clearing and reporter output locations, leading to several breaking changes.
⚠️ Breaking Changes
- The `browser.expect.toMatchScreenshot` function now requires a `screenshotDirectory` configuration option.
- The underlying `@sinonjs/fake-timers` dependency was updated, adding support for mocking the `Temporal` API.
- The `webdriverio` package has been removed.
- Mocks are now cleared by default before each test run.
- localStorage warnings are suppressed on Node 26, and the system will fail gracefully if a worker fails to start.
- Reporter output files (json and junit) now default to writing to the `.vitest` directory.
- UI API access has been hardened.
- The HTML reporter's default output location has been changed to `.vitest`.
Migration Steps
- If using `browser.expect.toMatchScreenshot`, ensure you configure the new `screenshotDirectory` option.
- Review code that relies on mock state persisting across tests, as mocks are now cleared before each test.
- If you were using the removed `webdriverio` package, you must find an alternative solution or dependency.
- If you rely on reporter output files being in the root directory, update your configuration to point to `.vitest` or specify a different output path.
✨ New Features
- Introduction of `vi.when()` for mocking control flow.
🐛 Bug Fixes
- Fixed an issue with `setImmediate` await in detect-async-leak.
- Fixed per-project `sequence` configuration application.
- Added a handshake timeout for iframe communication to improve stability.
- Disabled printing column numbers in test names when `includeTaskLocation` is enabled.
- Browser: Ensured locator action timeouts are always derived as positive values.
- Browser: Browser UI resizing is now skipped if the environment is headless.
- Browser: Added file system access checks in builtin commands.
- Coverage: Resolved incorrect offsets caused by non-awaited module imports.
- Coverage: Implemented fast failure when `coverage.reportsDirectory` conflicts during concurrent runs.
- Pool: Improved error messages when a worker exits unexpectedly.
- Types: Allowed `changed` property within configuration options.
- VM: Fixed an external module resolve error related to the deps optimizer query when using an encoded URI.