Skip to content

fix(@schematics/angular): transform Jasmine type annotations in jasmine-to-vitest schematic#31567

Merged
clydin merged 1 commit intoangular:mainfrom
clydin:refactor/jasmine-type-transforms
Oct 23, 2025
Merged

fix(@schematics/angular): transform Jasmine type annotations in jasmine-to-vitest schematic#31567
clydin merged 1 commit intoangular:mainfrom
clydin:refactor/jasmine-type-transforms

Conversation

@clydin
Copy link
Member

@clydin clydin commented Oct 23, 2025

This commit enhances the jasmine-to-vitest refactoring schematic by adding support for transforming Jasmine's type annotations. Previously, the schematic only handled function calls, leaving type usages like jasmine.SpyObj<T> untouched and causing compilation errors in the transformed code.

A new transformer now identifies and converts the following Jasmine types to their Vitest/TypeScript equivalents, preserving generics where appropriate:

  • jasmine.Spy -> Mock
  • jasmine.SpyObj<T> -> MockedObject<T>
  • jasmine.ObjectContaining<T> -> Partial<T>
  • jasmine.ObjectContaining -> object
  • jasmine.Any -> any
  • jasmine.DoneFn -> () => void

…ne-to-vitest schematic

This commit enhances the jasmine-to-vitest refactoring schematic by adding support for transforming Jasmine's type annotations. Previously, the schematic only handled function calls, leaving type usages like `jasmine.SpyObj<T>` untouched and causing compilation errors in the transformed code.

A new transformer now identifies and converts the following Jasmine types to their Vitest/TypeScript equivalents, preserving generics where appropriate:
  - `jasmine.Spy` -> `Mock`
  - `jasmine.SpyObj<T>` -> `MockedObject<T>`
  - `jasmine.ObjectContaining<T>` -> `Partial<T>`
  - `jasmine.ObjectContaining` -> `object`
  - `jasmine.Any` -> `any`
  - `jasmine.DoneFn` -> `() => void`
@clydin clydin added the target: major This PR is targeted for the next major release label Oct 23, 2025
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 23, 2025
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker target: rc This PR is targeted for the next release-candidate and removed action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release labels Oct 23, 2025
@clydin clydin added target: major This PR is targeted for the next major release and removed target: rc This PR is targeted for the next release-candidate labels Oct 23, 2025
@clydin clydin merged commit 54c4eae into angular:main Oct 23, 2025
37 checks passed
@clydin clydin deleted the refactor/jasmine-type-transforms branch October 23, 2025 11:19
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants