Vitest
Dev ToolsNext generation testing framework powered by Vite.
Release History
View all versions →v4.1.114 fixesThis release focuses on bug fixes, including restoring the global concurrency limit and improving browser testing stability by correctly encoding iframe IDs and managing garbage collection. It also enhances the mocker by restricting redirect mocks.
v5.0.0-rc.219 fixes1 featureThis release introduces custom GitHub Actions summary titles and includes numerous bug fixes across various modules like browser, mocker, pool, and UI. It also updates non-major dependencies and improves error handling and reporting.
v5.0.0-rc.1Breaking18 fixes3 featuresVitest v1.5 introduces significant changes to project configuration, asynchronous assertion handling, and browser mode capabilities. It also includes numerous bug fixes and performance improvements.
v5.0.0-beta.7Breaking13 fixes4 featuresThis release introduces a new pluggable benchmark provider API and enhances performance by optimizing module serving and caching. It also includes several bug fixes across core functionalities and browser testing.
v5.0.0-beta.6Breaking12 fixes1 featureThis 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.
v4.1.102 fixesThis patch release primarily focuses on backporting bug fixes related to file system access in browser commands and module resolution in the VM context to the v4 branch.
v3.2.71 fixThis release primarily contains a bug fix related to file system access checks within builtin commands in the browser environment.
v4.1.95 fixesThis patch release for v4.1.x focuses on backporting several bug fixes related to imports, browser testing readiness, mocking, and worker stability.
v5.0.0-beta.5Breaking10 fixes3 featuresThis release introduces several breaking changes, including changes to configuration lookup and diagnostic IDs, alongside new features like the `--repeats` CLI option and UI improvements for browser testing. Numerous bug fixes address issues across browser, coverage, and mocking functionality.
v3.2.61 fixThis patch release addresses a bug by pinning the last supported version of vite-node.
v5.0.0-beta.4Breaking10 fixes2 featuresThis release introduces new features like trace view steps in the browser and HTML reporter single file output, alongside several breaking changes affecting hoistable methods and assertion strictness. Numerous bug fixes address issues across browser, UI, and mocking functionalities.
v3.2.51 fix1 featureThis release introduces new `allowWrite` and `allowExec` options for the API configuration and fixes an issue where the client CDP API was not disabled correctly when these options were set to false.
v4.1.82 fixesThis patch release for v4.1.x focuses on fixing critical bugs in the browser environment related to CDP API access and Playwright route handling.
v4.1.71 fixThis release primarily focuses on a bug fix related to concurrency limiting within the test runner.
v5.0.0-beta.3Breaking19 fixes6 featuresThis release introduces support for TypeScript build mode and enhances browser testing capabilities with better tracing and error reporting. It also enforces stricter requirements for Node.js and Vite versions.
v4.1.62 fixesThis release focuses on bug fixes, particularly around browser testing and test sequencing, while also deprecating the legacy `sequential` test API.
v5.0.0-beta.2Breaking9 fixes6 featuresThis release introduces significant breaking changes, including updating default attachment directories and replacing the `sequential` option with `concurrent`. New features focus on reporter enhancements and improved coverage tracking.
v5.0.0-beta.1Breaking1 fix3 featuresThis release introduces new reporting features and browser snapshot improvements, alongside several breaking changes related to inspection utilities and assertion behavior.
v4.1.511 fixes1 featureThis release introduces experimental support for the Istanbul instrumenter option and resolves several bugs related to reporters, assertions, snapshot output, and web worker messaging.
v4.1.44 fixes4 featuresThis release introduces several experimental features, including changes to coverage reporting and JSON reporter options, alongside fixes for terminal output contrast and import hoisting behavior.
v4.1.310 fixes4 featuresThis release introduces several experimental features, including a `preParse` flag and support for custom snapshot matchers. Numerous bug fixes address issues related to fake timers, snapshot reporting, and module resolution.
v4.1.26 fixesThis release updates the internal flatted dependency to address CVE issues and includes several bug fixes across setup, browser testing, coverage, and formatting.
v4.1.116 fixes3 featuresThis patch introduces experimental features like `matchesTags` and `experimental.vcsProvider`, alongside numerous bug fixes across mocking, coverage, assertions, and formatting.
v4.1.036 featuresVitest 4.1 introduces numerous features including chai style assertions, support for tags, new browser APIs, and updates to underlying dependencies like sinon/fake-timers v15. This version also stabilizes experimental features and improves compatibility with Vite 8 beta.
v4.1.0-beta.69 fixes2 featuresThis release introduces new tracing and reporting features, alongside numerous bug fixes addressing issues in jsdom, module loading, fixtures, and reporter behavior.
Common Errors
UserInputElementTypeError2 reportsThe "UserInputElementTypeError" in Vitest often arises from missing or improperly configured environment dependencies, especially when using DOM-specific matchers. To resolve this, install `jsdom` using `npm install -D jsdom` and configure Vitest to use it as the environment in your `vitest.config.ts` file by adding `environment: 'jsdom'`. If already present, ensure versions of jsdom and related dependencies like `@testing-library/jest-dom` are compatible and up-to-date.
GenericTypeError2 reportsGenericTypeError in Vitest often arises from missing or mismatched dependencies, particularly Chai matchers. Ensure all necessary dependencies, including `@testing-library/jest-dom` or similar Chai plugins, are correctly installed and configured in your `vitest.config.ts` file, using `setupFiles` to import the required matchers. Verify that package versions are compatible and that any custom matchers are correctly defined and registered.
SyntaxError1 reportA "SyntaxError" in vitest often arises from invalid JavaScript syntax within your test files or imported modules, such as an improperly formatted regular expression or incorrect use of ES modules features. To fix this, carefully examine the reported file and line number in the error message, correct the syntax error (e.g., escaping special characters in regex, ensuring correct import/export statements), and rerun vitest. Consider using a linter or IDE with syntax checking to catch these errors earlier.
TypeCheckError1 reportTypeCheckError in Vitest often stems from incorrect or missing TypeScript configurations, preventing Vitest from properly understanding and processing your code's types. Ensure your `tsconfig.json` is correctly configured, includes necessary files, and that all required type definitions are installed by running `npm install` or `yarn install` to resolve missing dependencies before running Vitest. Review your `vite.config.ts` or `vitest.config.ts` to confirm the tsconfig path is correctly specified.
VitestBrowserElementError1 reportThe "VitestBrowserElementError" usually arises when Vitest's browser environment struggles to locate a specific DOM element, often due to asynchronous rendering in components or elements being rendered outside the current test's scope (like modals). Wrap the code causing the rendering or element access with `await nextTick()` (or `await vi.advanceTimersByTime()`) to allow asynchronous updates to complete before querying the DOM. Alternatively, ensure elements rendered outside the tested component (e.g., modals within a portal) are correctly mocked or rendered within the test environment using tools like `@testing-library/react`'s `render` with a container option targeting a DOM element within the test.
Related Dev Tools Packages
Empowering everyone to build reliable and efficient software.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
Next generation frontend tooling. It's fast!
An extremely fast Python package and project manager, written in Rust.
A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.
Subscribe to Updates
Get notified when new versions are released