Repository navigation
fix(@schematics/angular): handle done callbacks in focused and skipped tests - #34732
Merged
alan-agius4 merged 2 commits intoNov 17, 2026
Merged
Conversation
…d tests Similar to `transformPending`, `transformDoneCallback` previously only matched calls whose expression was the bare `it` identifier (or lifecycle hooks). Because `transformFocusedAndSkippedTests` runs earlier in the pipeline and rewrites `fit` to `it.only` and `xit` to `it.skip`, focused and skipped specs using a `done` callback were skipped by `transformDoneCallback`, leaving the `done` parameter and `done()`/`done.fail()` calls unmigrated. Extract a shared `isItCallExpression` helper that matches `it`, `it.only`, and `it.skip`, and use it in both `transformPending` and `transformDoneCallback`. Added unit tests covering `fit` and `xit` specs with `done` callbacks and verified with `pnpm bazel test //packages/schematics/angular:test`.
clydin
marked this pull request as ready for review
November 16, 2026 16:48
There was a problem hiding this comment.
Code Review
This pull request refactors the Jasmine-to-Vitest lifecycle transformers to correctly handle focused (fit / it.only) and skipped (xit / it.skip) tests when transforming done callbacks. It introduces a helper function isItCallExpression to check for these variations and updates transformPending and transformDoneCallback accordingly. Additionally, test cases are added to verify these transformations. Feedback suggests optimizing the lifecycle hook check in transformDoneCallback by replacing the array lookup with direct equality checks to avoid unnecessary allocations in a hot path.
alan-agius4
approved these changes
Nov 17, 2026
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar to
transformPending,transformDoneCallbackpreviously only matched calls whose expression was the bareitidentifier (or lifecycle hooks). BecausetransformFocusedAndSkippedTestsruns earlier in the pipeline and rewritesfittoit.onlyandxittoit.skip, focused and skipped specs using adonecallback were skipped bytransformDoneCallback, leaving thedoneparameter anddone()/done.fail()calls unmigrated.Extract a shared
isItCallExpressionhelper that matchesit,it.only, andit.skip, and use it in bothtransformPendingandtransformDoneCallback.Added unit tests covering
fitandxitspecs withdonecallbacks and verified withpnpm bazel test //packages/schematics/angular:test.