Modern Angular
When to Move an Angular Test Suite to Vitest
Vitest is the default test runner since Angular v21 (November 2025), but existing Karma/Jasmine suites deserve a migration filter. The official migration docs are explicit: 'Migrating an existing project to Vitest is considered experimental.' Doug Parker had announced Karma deprecation back in April 2023; the path has been long.
Default is not the same as mandate
For new Angular CLI projects, Vitest is the current default. That is a strong signal about the direction of Angular testing. It is not the same thing as saying every existing Karma/Jasmine suite should be migrated in one branch.
A test runner migration is successful only if the team trusts the result afterward. If the migration makes CI faster but nobody believes the failures or the passes, the project lost signal.
The first slice matters
| Candidate | Good first slice? | Why |
|---|---|---|
| Pure pipes | Yes | Low DOM dependency and easy assertion parity. |
| Services without browser globals | Yes | Fast feedback with simple setup. |
| Validation helpers | Yes | Useful for forms without UI complexity. |
| Small components | Maybe | Good if they avoid overlays, animations, and complex timers. |
| Overlay, canvas, drag/drop, browser-heavy specs | Later | They test the hardest migration path first. |
What to run first
The first migration branch should prove configuration, CI behavior, and a small set of test patterns. Do not start by deleting Karma from a large application.
The official migration path includes manual configuration work, optional browser mode, and an experimental schematic for Jasmine-to-Vitest refactoring. That means every generated diff still needs review.
npm install --save-dev vitest jsdom
ng test --no-watch
ng g @schematics/angular:refactor-jasmine-vitest --include=src/app/ordersWhat would make me wait
Wait if the suite depends heavily on fakeAsync, flush, browser-only APIs, custom Karma launchers, or global test setup nobody currently understands. Those are not blockers forever, but they are a bad place to start.
The official Vitest migration guide is explicit that Zone.js based helpers such as fakeAsync, flush, and waitForAsync are not supported. New examples in this series should prefer native async, observable assertions, or Vitest timers unless they are clearly labeled as Karma/Jasmine code.
The right proposal is not 'move all tests to Vitest'. It is 'move this slice, compare CI time and failure quality, document unsupported patterns, then decide the next slice'.
Reusable artifact
Vitest pilot acceptance criteria
- One small slice migrated and reviewed.
- CI runtime compared before and after.
- Known unsupported patterns documented, especially Zone.js testing helpers.
- Browser-mode need decided explicitly.
- Karma kept until the team trusts the replacement path.
Sources checked
- https://angular.dev/guide/testing
- https://angular.dev/guide/testing/migrating-to-vitest
- https://angular.dev/api/schematics/refactor-jasmine-vitest
- https://vitest.dev/guide
- https://blog.angular.dev/moving-angular-cli-to-jest-and-web-test-runner-ef85ef69ceca
- https://blog.angular.dev/announcing-angular-v20-b5c9c06cf301
- https://blog.angular.dev/announcing-angular-v21-57946c34f14b
- https://angular.dev/roadmap
Angular Vitest Migration Kit
Migrating this suite to Vitest?
The Angular Vitest Migration Kit sizes your migration by risk, then packages the config, the fakeAsync cookbook, an AI-agent skill, and a runnable demo. The conversions in this article, done for you.
Verified on Angular 21.2.14 / Vitest 4.1.8. Includes the migration estimator, the PDF guide, copy-paste config, an AI-agent skill, and a runnable demo.
André Ramosavailable for remote roles, UTC−3Get in touch →