Skip to content

Conversation

@crisbeto
Copy link
Member

This is another attempt at #63904.

Currently if TestBed.overrideComponent is used on a class that uses initializer APIs (e.g. input()), the initializer metadata will be wiped out, because overrideComponent re-compiles the class with the information set by setClassMetadata. setClassMetadata only captures decorated members at the moment.

These changes introduce some logic to capture the new initializer-based APIs in setClassMetadata as well.

Fixes #57944.

@crisbeto crisbeto added target: patch This PR is targeted for the next patch release action: global presubmit The PR is in need of a google3 global presubmit labels Sep 19, 2025
@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Sep 19, 2025
@ngbot ngbot bot added this to the Backlog milestone Sep 19, 2025
Reworks the logic that tracks the decorator metadata for members to do so using the output AST, rather than wrapping the TypeScript AST. This makes it easier to programmatically generate new members that weren't part of the TypeScript AST before.
Adds the member decorators to the map of exposed compiler symbols.
Currently if `TestBed.overrideComponent` is used on a class that uses initializer APIs (e.g. `input()`), the initializer metadata will be wiped out, because `overrideComponent` re-compiles the class with the information set by `setClassMetadata`. `setClassMetadata` only captures decorated members at the moment.

These changes introduce some logic to capture the new initializer-based APIs in `setClassMetadata` as well.

Fixes angular#57944.
@crisbeto crisbeto force-pushed the initializer-apis-meta-again branch from a04e6df to 3879d25 Compare September 29, 2025 17:07
@crisbeto crisbeto requested a review from devversion October 9, 2025 12:11
@crisbeto crisbeto added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 9, 2025
@crisbeto crisbeto marked this pull request as ready for review October 9, 2025 12:11
@crisbeto
Copy link
Member Author

crisbeto commented Oct 9, 2025

Passing TGP

@crisbeto crisbeto removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 9, 2025
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release and removed action: global presubmit The PR is in need of a google3 global presubmit target: patch This PR is targeted for the next patch release labels Oct 9, 2025
@crisbeto
Copy link
Member Author

crisbeto commented Oct 9, 2025

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

@crisbeto crisbeto closed this in 8ceac0b Oct 9, 2025
crisbeto added a commit that referenced this pull request Oct 9, 2025
Adds the member decorators to the map of exposed compiler symbols.

PR Close #63957
crisbeto added a commit that referenced this pull request Oct 9, 2025
Currently if `TestBed.overrideComponent` is used on a class that uses initializer APIs (e.g. `input()`), the initializer metadata will be wiped out, because `overrideComponent` re-compiles the class with the information set by `setClassMetadata`. `setClassMetadata` only captures decorated members at the moment.

These changes introduce some logic to capture the new initializer-based APIs in `setClassMetadata` as well.

Fixes #57944.

PR Close #63957
crisbeto added a commit to crisbeto/angular that referenced this pull request Oct 9, 2025
…ar#63957)

Reworks the logic that tracks the decorator metadata for members to do so using the output AST, rather than wrapping the TypeScript AST. This makes it easier to programmatically generate new members that weren't part of the TypeScript AST before.

PR Close angular#63957
crisbeto added a commit to crisbeto/angular that referenced this pull request Oct 9, 2025
Adds the member decorators to the map of exposed compiler symbols.

PR Close angular#63957
crisbeto added a commit to crisbeto/angular that referenced this pull request Oct 9, 2025
…3957)

Currently if `TestBed.overrideComponent` is used on a class that uses initializer APIs (e.g. `input()`), the initializer metadata will be wiped out, because `overrideComponent` re-compiles the class with the information set by `setClassMetadata`. `setClassMetadata` only captures decorated members at the moment.

These changes introduce some logic to capture the new initializer-based APIs in `setClassMetadata` as well.

Fixes angular#57944.

PR Close angular#63957
AndrewKushnir pushed a commit that referenced this pull request Oct 9, 2025
… (#64317)

Reworks the logic that tracks the decorator metadata for members to do so using the output AST, rather than wrapping the TypeScript AST. This makes it easier to programmatically generate new members that weren't part of the TypeScript AST before.

PR Close #63957

PR Close #64317
AndrewKushnir pushed a commit that referenced this pull request Oct 9, 2025
)

Adds the member decorators to the map of exposed compiler symbols.

PR Close #63957

PR Close #64317
AndrewKushnir pushed a commit that referenced this pull request Oct 9, 2025
…64317)

Currently if `TestBed.overrideComponent` is used on a class that uses initializer APIs (e.g. `input()`), the initializer metadata will be wiped out, because `overrideComponent` re-compiles the class with the information set by `setClassMetadata`. `setClassMetadata` only captures decorated members at the moment.

These changes introduce some logic to capture the new initializer-based APIs in `setClassMetadata` as well.

Fixes #57944.

PR Close #63957

PR Close #64317
@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 9, 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: compiler Issues related to `ngc`, Angular's template compiler target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Initializer APIs (input, output, queries) not integrating with TestBed.override in a jit & aot mix

2 participants