You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor-jasmine-vitest: add support for spy call arguments migration #33112
When running the ng g @schematics/angular:refactor-jasmine-vitest on a project which has the following line (for example, I have a few of those in my unit tests): expect(spy.calls.all()[2].args[0]).toBeInstanceOf(RemoveShareUrlAction);
The migration does not remove .args and the code that was generated does not compile
Describe the solution you'd like
In this specific case, the solution is simply to remove .args and the rest will work as expected.
This project is currently using Karma, and every once in a while I try to migrate off karma and into the latest suggestion by the angular team. The problem is that my angular services are using browser methods, so I need to run on a real browser as jsdom is not good enough.
The latest addition to try playwright has also failed as it seems vite is not able to solve some of the basic things that webpack is able to solve.
I can fight with it enough to do the migration, but unfortunately, I can't say that the karma alternative is better.
I don't mind doing some basic search and replace, and add the relevant needed configuration, but in general, this is not an easy migration and I keep getting stuck on hard problems with the infrastructure.
I'll be happy to provide feedback if you'd like me to, and I'll be happy to try out any new tool or fix you want to push out.
Also worth noting that the following guide: https://angular.dev/guide/testing/migrating-to-vitest
Does not explain how to fix the missing import {vi, it, describe} from 'vitest' which is needed for the migration, or adding something in the tsconfig.spec.ts to avoid the need to import vitest in all the tests files (like it was for jasmine).
I would suggest to add this part to the docs or the tool.
Activity
HarelM commentedon Apr 30, 2026
In case you want a real size project for testing migration you can take a look at my project here:
https://github.com/IsraelHikingMap/site
This project is currently using Karma, and every once in a while I try to migrate off karma and into the latest suggestion by the angular team. The problem is that my angular services are using browser methods, so I need to run on a real browser as jsdom is not good enough.
The latest addition to try playwright has also failed as it seems vite is not able to solve some of the basic things that webpack is able to solve.
I can fight with it enough to do the migration, but unfortunately, I can't say that the karma alternative is better.
I don't mind doing some basic search and replace, and add the relevant needed configuration, but in general, this is not an easy migration and I keep getting stuck on hard problems with the infrastructure.
I'll be happy to provide feedback if you'd like me to, and I'll be happy to try out any new tool or fix you want to push out.
HarelM commentedon Apr 30, 2026
Also worth noting that the following guide:
https://angular.dev/guide/testing/migrating-to-vitest
Does not explain how to fix the missing
import {vi, it, describe} from 'vitest'which is needed for the migration, or adding something in the tsconfig.spec.ts to avoid the need to import vitest in all the tests files (like it was for jasmine).I would suggest to add this part to the docs or the tool.
fix(@schematics/angular): support spy call arguments migration in ref…
fix(@schematics/angular): support spy call arguments migration in ref…
fix(@schematics/angular): support spy call arguments migration in ref…
angular-automatic-lock-bot commentedon Jun 15, 2026
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.