fix(@schematics/angular): support spy call arguments migration in refactor-jasmine-vitest - #33206
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new transformation function, transformAllCallsArgs, to the Jasmine-to-Vitest refactoring tool. This function handles the conversion of spy.calls.all()[i].args into the Vitest-compatible vi.mocked(spy).mock.calls[i] format, and a corresponding test case has been added. The review feedback suggests adding an explicit type check for allPae.expression to ensure it is a PropertyAccessExpression before passing it to getSpyIdentifierFromCalls, which improves type safety and maintains consistency with other transformation logic in the codebase.
…actor-jasmine-vitest The `refactor-jasmine-vitest` schematic fails to remove `.args` when migrating `spy.calls.all()[i].args`, resulting in uncompilable code in Vitest. Now, a specialized transformer detects `spy.calls.all()[i].args` and transforms it to `vi.mocked(spy).mock.calls[i]`, removing the unnecessary `.args` property access. Fixes angular#33112
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The
refactor-jasmine-vitestschematic fails to remove.argswhen migratingspy.calls.all()[i].args, resulting in uncompilable code in Vitest.Now, a specialized transformer detects
spy.calls.all()[i].argsand transforms it tovi.mocked(spy).mock.calls[i], removing the unnecessary.argsproperty access.Fixes #33112