Never miss a release that matters
AI-powered summaries of every GitHub release.
AI Summaries
Changelogs condensed into clear, actionable insights.
Always Free
Track up to 5 packages at no cost, forever.
Weekly Digest
A curated summary of every release, delivered weekly.
TL;DR
Vitest v5.0.0-beta.4 introduces significant changes to the benchmark API and browser mode, including a new trace view and improved stability, while also addressing several bug fixes related to test execution and reporting.
Breaking
- The benchmark API has been completely rewritten.
toHaveTextContentnow performs a strict match; usetoMatchTextContentfor partial matches.- Methods outside the top-level scope will now cause an error.
- Browser mode now defaults to exact locator matching.
New
- Browser Mode: A trace view is now available in the editor panel for debugging.
- Reporting: HTML reports can now be output to a single file.
Fixes Worth Knowing
- Browser mode now correctly handles source maps in watch mode.
- Console interception is respected when running in browser mode.
- Improved stability and accuracy of test parsing and execution.
- Fixed an issue where typecheck warnings were printed repeatedly.
TL;DR
Vitest now offers more granular control over API access (testing tools) with allowWrite and allowExec options, enhancing security when running tests.
New
- Added
allowWriteandallowExecoptions to the Vitest API, allowing you to restrict file system and process execution access during tests.
Fixes Worth Knowing
- Fixed an issue where the browser client CDP (Chrome DevTools Protocol) API was accessible even when restricted by
allowWrite/allowExec: false.
TL;DR
Vitest now disables certain browser features when restricted, improving security and resolving issues with module mocking in Playwright tests.
Fixes Worth Knowing
- Fixed a security issue where client CDP (Chrome DevTools Protocol - browser debugging tool) access was allowed even when restricted.
- Resolved an issue where multiple mocks of the same module in Playwright (testing framework) could cause orphaned routes and test failures.
TL;DR
Vitest now supports mocking functions to throw errors with mockThrow and mockThrowOnce, and includes improved browser testing with BlazeDiff for visual comparisons and enhanced element finding.
New
- Mocking: Added
mockThrowandmockThrowOncefor more control over mock behavior. - Browser Testing: Switched to BlazeDiff (image comparison tool) and added
findElementfor more robust browser tests. - Coverage: Added an option to only report coverage for changed files.
Fixes Worth Knowing
- Fixed issues with stack traces in assertions and dynamic imports.
- Improved handling of skipped tests when
hideSkippedTestsis enabled. - Corrected issues with module mocking and resolving external dependencies.
- Fixed a bug where cancelling a test didn't immediately stop execution.
Before You Upgrade
If you are using browser testing, be aware that the visual comparison tool has changed to BlazeDiff. You may need to adjust your expectations for visual diff output.
TL;DR
Vitest now supports testing with Temporal objects, bringing it up to date with the latest JavaScript features.
New
- Temporal Support: Added initial support for testing with Temporal objects (date/time API).
- Vite 7 Support: Vitest is now compatible with Vite version 7 (build tool).
- Custom Matchers: You can now define type-safe custom matchers (assertion helpers) for more readable tests.
Fixes Worth Knowing
- Improved browser test stability by addressing race conditions and file resolution issues.
- Fixed an issue where typechecking could fail to start.
- Test results are now preserved between runs when using the cache.
Before You Upgrade
If you use WebdriverIO, be aware that iframe scaling has been disabled; Playwright and preview modes will continue to scale iframes.
TL;DR
Vitest now includes critical security patches, preventing arbitrary file access and remote code execution vulnerabilities when running tests.
Breaking
- Browser mode now restricts file access (prevents serving arbitrary files).
- Accessing malicious websites while the Vitest API server is running is now blocked (prevents remote code execution).
Fixes Worth Knowing
- Fixed an issue where certain files were incorrectly served, improving security.
Before You Upgrade
Update your Vitest installation immediately to mitigate potential security risks.
TL;DR
Vitest now includes critical security patches, addressing a remote code execution vulnerability when the API server is active.
Breaking
- API Server Security (remote code execution) - A vulnerability allowing malicious websites to execute code via the Vitest API server has been resolved; update immediately.
Fixes Worth Knowing
- Fixed an issue with
mockResolvedValuein v1 (compatibility layer).
Before You Upgrade
- Restart your Vitest development server after upgrading to ensure the security patches are active.
TL;DR
Vitest now allows running individual tests or suites directly from the UI, improving workflow for focused debugging and development.
New
- UI Improvements: Run specific tests/suites from the Vitest UI.
- Expect Matchers: Added
toHaveBeenCalledExactlyOnceWith,toHaveBeenCalledAfter, andtoHaveBeenCalledBeforefor more precise mock assertions (mocking frameworks). - Test Context: Test contexts can now access values provided in the Vitest configuration.
Fixes Worth Knowing
- Improved source map support when using
vi.mock. - Correctly respects the
cacheDirsetting when the optimizer is enabled. - React 19 support added.
Before You Upgrade
No specific upgrade steps are required.
TL;DR
Vitest now supports specifying projects to run with the --project flag, allowing for more targeted testing in monorepos (multiple projects).
New
- Project Selection: Use the
--projectflag to run tests within specific projects. - Coverage Hints: Coverage reports now respect
/* v8 ignore...comments to exclude code from coverage analysis.
Fixes Worth Knowing
- Corrected issues with file path filtering, ensuring tests are run as expected.
- Improved handling of
vi.waitUntil(assertion utility) to avoid type errors. - Fixed a bug where fixtures weren’t preserved with
runifandskipif(test conditional execution).
Before You Upgrade
No specific upgrade steps are required.
TL;DR
Vitest now correctly handles custom test environments and global URL configurations, resolving issues with dependency loading and test fixture initialization.
Fixes Worth Knowing
- Fixed an issue where custom test environments (isolated test contexts) weren’t resolving external dependencies.
- Global URL configuration now respects environment variables.
test.extendfixtures (test setup functions) are initialized only once per test suite, improving performance.
Before You Upgrade
No specific action is needed; these changes are backwards compatible.