Skip to content

fix(@schematics/angular): preserve blank lines in jasmine-to-vitest schematic#31560

Merged
clydin merged 1 commit intoangular:mainfrom
clydin:refactor/blank-line-vitest
Oct 22, 2025
Merged

fix(@schematics/angular): preserve blank lines in jasmine-to-vitest schematic#31560
clydin merged 1 commit intoangular:mainfrom
clydin:refactor/blank-line-vitest

Conversation

@clydin
Copy link
Member

@clydin clydin commented Oct 22, 2025

The TypeScript printer, by design, does not retain blank lines. This caused the jasmine-to-vitest refactoring schematic to produce code that lost the original file's vertical spacing, harming readability.

This commit introduces a pre- and post-processing step within the main transformation function. Before parsing, blank lines are converted into unique placeholder comments. After the TypeScript printer generates the new code, these placeholders are converted back into blank lines, ensuring that the vertical formatting of the original file is preserved in the transformed output.

…chematic

The TypeScript printer, by design, does not retain blank lines. This caused the jasmine-to-vitest refactoring schematic to produce code that lost the original file's vertical spacing, harming readability.

This commit introduces a pre- and post-processing step within the main transformation function. Before parsing, blank lines are converted into unique placeholder comments. After the TypeScript printer generates the new code, these placeholders are converted back into blank lines, ensuring that the vertical formatting of the original file is preserved in the transformed output.
@clydin clydin added the target: major This PR is targeted for the next major release label Oct 22, 2025
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 22, 2025
@clydin clydin 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 Oct 22, 2025
@clydin clydin merged commit 512ad28 into angular:main Oct 22, 2025
35 checks passed
@clydin clydin deleted the refactor/blank-line-vitest branch October 22, 2025 21:33
@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 22, 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