Skip to content

fix(@schematics/angular): handle done callbacks in focused and skipped tests - #34732

Merged
alan-agius4 merged 2 commits into
angular:mainfrom
clydin:fix/jasmine-vitest-done-in-focused-tests
Nov 17, 2026
Merged

alan-agius4 merged 2 commits into
angular:mainfrom
clydin:fix/jasmine-vitest-done-in-focused-tests

Conversation

@clydin

@clydin clydin commented Nov 16, 2026

Copy link
Copy Markdown
Member

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.

…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 clydin added the target: patch This PR is targeted for the next patch release label Nov 16, 2026
@clydin
clydin marked this pull request as ready for review November 16, 2026 16:48
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Nov 16, 2026

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

Copy link
Copy Markdown

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 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.

@clydin
clydin requested a review from alan-agius4 November 16, 2026 16:52
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 17, 2026
@alan-agius4
alan-agius4 merged commit 600c5d3 into angular:main Nov 17, 2026
40 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

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

@clydin
clydin deleted the fix/jasmine-vitest-done-in-focused-tests branch November 17, 2026 16:05
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: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants