Skip to content

fix(@schematics/angular): safely comment out multiline statements in refactor-jasmine-vitest#33315

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:fix-jasmine-vitest-refactor-comments
Jun 8, 2026
Merged

fix(@schematics/angular): safely comment out multiline statements in refactor-jasmine-vitest#33315
clydin merged 1 commit into
angular:mainfrom
clydin:fix-jasmine-vitest-refactor-comments

Conversation

@clydin
Copy link
Copy Markdown
Member

@clydin clydin commented Jun 5, 2026

When refactoring unsupported or empty statements (such as pending(), expect().nothing(), and certain jasmine member assignments), the schematic previously commented out the code using a single-line comment prefix on the full text of the node. If the statement spanned multiple lines, only the first line was commented, leaving subsequent lines uncommented. This resulted in invalid syntax or unexpected compile errors.

@clydin clydin added the target: patch This PR is targeted for the next patch release label Jun 5, 2026
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 introduces a helper function addCommentedNodeText to safely comment out multi-line TypeScript AST nodes line-by-line, preventing syntax issues when converting them to single-line comments. This helper is integrated into several transformers (jasmine-lifecycle, jasmine-matcher, and jasmine-misc) and unit tests are added. The feedback suggests avoiding the inline require statement in the unit tests and instead using standard ES imports at the top of the file for consistency.

Comment thread packages/schematics/angular/refactor/jasmine-vitest/utils/comment-helpers_spec.ts Outdated
…refactor-jasmine-vitest

When refactoring unsupported or empty statements (such as `pending()`, `expect().nothing()`, and certain `jasmine` member assignments), the schematic previously commented out the code using a single-line comment prefix on the full text of the node. If the statement spanned multiple lines, only the first line was commented, leaving subsequent lines uncommented. This resulted in invalid syntax or unexpected compile errors.
@clydin clydin force-pushed the fix-jasmine-vitest-refactor-comments branch from 0fe72e1 to f0b8109 Compare June 5, 2026 13:43
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jun 5, 2026
@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 Jun 8, 2026
@clydin clydin merged commit 59e5e96 into angular:main Jun 8, 2026
66 of 68 checks passed
@clydin
Copy link
Copy Markdown
Member Author

clydin commented Jun 8, 2026

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

@clydin clydin deleted the fix-jasmine-vitest-refactor-comments branch June 8, 2026 13:24
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