refactor(core): Don't throw when there are no async metadata#61230
refactor(core): Don't throw when there are no async metadata#61230amishne merged 1 commit intoangular:mainfrom
Conversation
dece655 to
5e5fc16
Compare
e5270b4 to
45ba049
Compare
9a0b704 to
6e57959
Compare
5c4bffd to
04251dc
Compare
04251dc to
3a7755e
Compare
b366d2a to
f62a0c4
Compare
b14aee8 to
83757d5
Compare
83757d5 to
da8f782
Compare
|
|
||
| compileComponents(): Promise<any>; | ||
|
|
||
| prepareAsyncComponents(): Promise<any>; |
There was a problem hiding this comment.
This should have documentation about when you need to call this.
da8f782 to
af18cdd
Compare
af18cdd to
bc4c043
Compare
|
I've revised that change to only alter the behavior of |
In the context of AOT tests, component with defer blocks no longer throw on instanciation if the component is not overridden (with `overrideComponent`) Prior to this change, all components with a `@defer` block would throw if `compileComponents` was not invoked. In none-JIT apps, this change makes `compileComponents()` uneccesary.
bc4c043 to
efac538
Compare
atscott
left a comment
There was a problem hiding this comment.
AGENT: I have reviewed the changes in test_bed_compiler and they appear correct and accurate in determining when compileComponents must be called. They allow AOT components with overrides to skip full compilation if they don't have unresolved async metadata.
atscott
left a comment
There was a problem hiding this comment.
AGENT: I have reviewed the changes in test_bed_compiler and they appear correct and accurate. I suggest improving the error messages to provide more context: 1. In test_bed_compiler.ts: 'Component has unresolved async metadata (from @defer blocks) and has been overridden. Please call await TestBed.compileComponents() to resolve the metadata before running this test.' 2. In test_bed.ts: 'Component has unresolved async metadata. Please call await TestBed.compileComponents() before running this test.'
atscott
left a comment
There was a problem hiding this comment.
LGTM with note that the error message could be slightly improved to indicate where the "missing" metadata is coming from. I do believe we know more and could provide some more context but not blocking on that.
|
I'll provide a follow-up to add info to the error message. |
|
Caretaker note: Presubmit failures are flakes. This is good to go. |
|
This PR was merged into the repository. The changes were merged into the following branches:
|
angular/angular/pull/61230 updated `TestBed`'s behavior of components with async metadata. `TestBed` will now only throw when `overrideComponent()` is used on a component with a `@defer` block
In the context of AOT tests, component with defer blocks no longer throw on instanciation if the component is not overridden (with
overrideComponent)Prior to this change, all components with a
@deferblock would throw ifcompileComponentswas not invoked.In none-JIT apps, this change makes
compileComponents()uneccesary.