Skip to content

feat(@schematics/angular): stabilize refactor-jasmine-vitest schematic#32874

Open
hawkgs wants to merge 1 commit intoangular:mainfrom
hawkgs:refactor-jasmine-vitest-stable
Open

feat(@schematics/angular): stabilize refactor-jasmine-vitest schematic#32874
hawkgs wants to merge 1 commit intoangular:mainfrom
hawkgs:refactor-jasmine-vitest-stable

Conversation

@hawkgs
Copy link
Copy Markdown
Member

@hawkgs hawkgs commented Mar 27, 2026

Stabilize refactor-jasmine-vitest schematic by covering the known remaining test patterns and cases.

The current state of the schematic covers the most common and used test patterns. This PR adds rather peripheral API to the list of supported transformations. Most of these do not have a Vitest equivalent.

API State
jasmine.createSpy('withName') ✅ Added support
spy.calls.thisFor(index) ✅ Added support
spy.calls.saveArgumentsByValue() 🚧 Not supported; Comment added
spy.and.identity() ✅ Added support
.and.returnValue(Promise.resolve(x)) / .and.returnValue(Promise.reject(x)) ✅ Added support
fail(new Error()) ✅ Added support
jasmine.clock().withMock() 🚧 Not supported; Comment added
jasmine.clock().autoTick() 🚧 Not supported; Comment added
jasmine.addAsyncMatchers() 🚧 Not supported; Comment added
jasmine.addSpyStrategy() 🚧 Not supported; Comment added
jasmine.addCustomObjectFormatter() 🚧 Not supported; Comment added
toBeNullish() ✅ Added support
throwUnless() / throwUnlessAsync() 🚧 Not supported; Comment added
getSpecProperty() 🚧 Not supported; Comment added
jasmine.MAX_PRETTY_PRINT_DEPTH / MAX_PRETTY_PRINT_CHARS / MAX_PRETTY_PRINT_ARRAY_LENGTH 🚧 Not supported; Comment added

@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Mar 27, 2026
@hawkgs hawkgs force-pushed the refactor-jasmine-vitest-stable branch 2 times, most recently from 48214dd to fe6dcba Compare April 6, 2026 11:23
@hawkgs hawkgs marked this pull request as ready for review April 6, 2026 11:23
@hawkgs hawkgs requested review from alan-agius4 and clydin April 6, 2026 11:23
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 expands the Jasmine to Vitest migration schematics by adding support for several Jasmine APIs, including toBeNullish, createSpy, and various spy strategies. It also introduces TODO comments for unsupported Jasmine features and improves existing transformations for fail() and spy call inspections. Feedback was provided to improve the toBeNullish transformation by using loose equality to avoid double evaluation of expressions with side effects, and to use the TypeScript factory API for numeric literals in transformThisFor for better consistency.

Stabilize `refactor-jasmine-vitest` schematic by covering the known remaining test patterns and cases.
@hawkgs hawkgs force-pushed the refactor-jasmine-vitest-stable branch from fe6dcba to c742ac9 Compare April 6, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant