Skip to content

refactor-jasmine-vitest: add support for spy call arguments migration #33112

Closed

Description

@HarelM

Command

generate

Description

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.

Describe alternatives you've considered

search and replace using the IDE

Activity

  1. HarelM commented on Apr 30, 2026

    @HarelM
    Author

    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.

  2. HarelM commented on Apr 30, 2026

    @HarelM
    Author

    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.

  3. added a commit that references this issue on May 15, 2026
    cc5895e
  4. added 2 commits that reference this issue on May 15, 2026
    5dd4daf
    a7ac8e5
  5. angular-automatic-lock-bot commented on Jun 15, 2026

    @angular-automatic-lock-bot

    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.

  6. locked and limited conversation to collaborators on Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions