Running Tests
Analog supports Vitest for running unit tests.
Vitest Features
Vitest supports many features:
- A Jest-compatible API.
- Supports Vite's config, transforms, resolvers, and plugins.
- Smart & instant watch mode.
- TypeScript support.
- Jest-compatible snapshots.
- jsdom for DOM mocking.
- In-source testing.
- And more ...
You can also add Vitest to your existing project.
Angular support for Vitest
In Angular v21, stable support for Vitest directly through the Angular CLI was introduced for new Angular projects. While both Analog and Angular support running tests with Vitest, there are some similarities and key differences.
The table below shows the features available across both choices.
| Vitest | Analog | Angular |
|---|---|---|
| Angular Versions | v17+ | v21+ |
| Support | Community | Angular Team |
| Builders | ✅ | ✅ |
| Schematics | ✅ | ✅ |
| Migrations | ✅ | ✅ |
| Browser Mode | ✅ | ✅ |
| Fully Configurable | ✅ | ⚠️ |
| Vitest CLI | ✅ | ❌ |
| Vitest Workpsaces | ✅ | ❌ |
| Custom Environments | ✅ | ❌ |
| Custom Providers | ✅ |