Vitest
Test automation · Free
A test framework for Vite and TypeScript: it runs unit tests, mocks, component checks, and coverage reports.
Also known as: vitest-dev/vitest; vitest

What you can use for free
Code and local use under MIT.
Paid features and costs
Compute, your own hosting, and external services are paid for separately if selected.
Access and limitations
Code and local use under MIT. Compute, your own hosting, and external services are paid for separately if selected.
Use cases
- Test a module and measure test coverage
- Connect the required mocks and get a Vitest coverage report
Example workflow
A possible workflow; this is not a report of hands-on testing.
Test a function calculating a final total.
Before you start
- The function and rounding rules.
- Ordinary and boundary examples.
Steps
- Describe a successful calculation and an empty collection.
- Add invalid input checks.
- Run tests in CI and confirm that a broken formula is detected.
Check your result
- Assertions check a specific value.
- Tests do not depend on local time or the network.
Choosing Vitest
Test JavaScript/TypeScript functions and modules in a test environment connected to Vite.
Choose this when
- Fast business-logic checks are needed.
- You want to use Vite configuration and plugins in tests.
Consider alternatives when
- Consider Playwright for a user journey in a real browser.
Requirements
- A compatible runtime, installed Vitest, and the selected test environment.
Things to consider
- Passing unit tests does not prove the entire application works.
- Line coverage does not show completeness of scenarios.
Frequently asked questions
Is a Vite project required?
No. Vitest can be configured separately; when vite.config exists, it uses that configuration by default.
Related tasks and approaches
- Vite
Complement: shared build configuration and plugins.
- Playwright
Complement: browser user journey checks.
License
MIT: code; dependencies have separate licenses.
MIT — permissive license
You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.
License termsTechnologies and topics
- Vitest
- test
- Development