Repository navigation
fix(@schematics/angular): handle pending() in focused and skipped tests in refactor-jasmine-vitest - #34689
Open
MeAkib wants to merge 1 commit into
Open
fix(@schematics/angular): handle pending() in focused and skipped tests in refactor-jasmine-vitest#34689MeAkib wants to merge 1 commit into
MeAkib wants to merge 1 commit into
Conversation
…ts in refactor-jasmine-vitest `transformPending` only matches calls whose expression is the bare `it` identifier, but `transformFocusedAndSkippedTests` runs earlier in the pipeline and has already renamed `fit` to `it.only` and `xit` to `it.skip`. A focused test containing `pending()` is therefore migrated to `it.only` with the `pending()` call left in place, which throws a ReferenceError at runtime since Vitest has no `pending` global; a skipped test keeps a dangling `pending()` call that no longer compiles once the Jasmine types are removed. Also match the renamed `it.only` and `it.skip` forms and convert both to `it.skip` with the usual TODO comment. A pending spec never runs its body in Jasmine, even when focused, so `it.skip` preserves the observed behavior. Verified with two new `transformPending` cases that run the full transform pipeline on `fit` and `xit` inputs; both fail without this change and `//packages/schematics/angular:test` passes with it.
There was a problem hiding this comment.
Code Review
This pull request updates the transformPending function in the Jasmine-to-Vitest schematic to correctly handle focused (fit) and skipped (xit) tests that contain a pending() call. Since these tests are transformed to it.only and it.skip earlier in the pipeline, the transformer now recognizes these property access expressions and ensures they are both mapped to it.skip (as pending specs do not run their bodies in Jasmine). Corresponding unit tests have been added to verify this behavior. I have no additional feedback to provide.
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.
transformPendingonly matches calls whose expression is the bareitidentifier, buttransformFocusedAndSkippedTestsruns earlier in the pipeline and has already renamedfittoit.onlyandxittoit.skip. A focused test containingpending()is therefore migrated toit.onlywith thepending()call left in place, which throws a ReferenceError at runtime since Vitest has nopendingglobal; a skipped test keeps a danglingpending()call that no longer compiles once the Jasmine types are removed.Also match the renamed
it.onlyandit.skipforms and convert both toit.skipwith the usual TODO comment. A pending spec never runs its body in Jasmine, even when focused, soit.skippreserves the observed behavior.Verified with two new
transformPendingcases that run the full transform pipeline onfitandxitinputs; both fail without this change and//packages/schematics/angular:testpasses with it.