Skip to content

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

@devversion

Description

@devversion

Investigation result of: #57668

TestBed.overrideComponent seems to not work well with signal inputs, queries, output, or other non-decorator APIs.

That is because the setClassMetadata calls (generated for JIT) are used to re-compile the component with the overrides — but there is no decorator for the e.g. input() calls, hence this metadata is lost.

Options I could see:

  • Smartly merging directly with the original component metadata in TestBed.
    • Will be hard to detect output as it's non-distinguishable from decorator outputs.
    • I guess, we could fully re-use inputs, queries etc. metadata instead of relying on prop decorators..?
  • Adding synthetic prop decorators to setClassMetadata.
    • Would be great to re-use the JIT transforms.. but those need an import manager; so needs a bit of refactoring!

Note: I do think this may not be a problem in Angular CLI applications because full tests are compiled with JIT transforms in place! Here it fails because we mix AOT targets with JIT targets; without any JIT transforms

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions