Skip to content

fix(@schematics/angular): support spy call arguments migration in refactor-jasmine-vitest#33206

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:fix/issue-33112
May 15, 2026
Merged

fix(@schematics/angular): support spy call arguments migration in refactor-jasmine-vitest#33206
clydin merged 1 commit into
angular:mainfrom
clydin:fix/issue-33112

Conversation

@clydin
Copy link
Copy Markdown
Member

@clydin clydin commented May 14, 2026

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 #33112

@clydin clydin added the target: rc This PR is targeted for the next release-candidate label May 14, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@clydin clydin force-pushed the fix/issue-33112 branch from 584b086 to cc5895e Compare May 15, 2026 00:09
@clydin clydin requested a review from hawkgs May 15, 2026 11:36
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label May 15, 2026
@hawkgs hawkgs removed the action: review The PR is still awaiting reviews from at least one requested reviewer label May 15, 2026
@clydin clydin added the action: merge The PR is ready for merge by the caretaker label May 15, 2026
@clydin clydin merged commit 5dd4daf into angular:main May 15, 2026
36 checks passed
@clydin
Copy link
Copy Markdown
Member Author

clydin commented May 15, 2026

This PR was merged into the repository. The changes were merged into the following branches:

@clydin clydin deleted the fix/issue-33112 branch May 15, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @schematics/angular target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants