GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — New AOT option for Karma doesn't play nicely with TestBed.overrideComponent · Issue #30017 · angular/angular-cli Closed Closed Copy link DescriptionCommandtest Is this a regression?
The previous version in which this bug was not present wasNo response DescriptionWhen running Karma in the new-to-19.2.x AOT mode, if you have any tests that use TestBed.overrideComponent() to specify different metadata to the component (an override to the providers property, for example), the test fails with an error about missing the @component decorator or having missing metadata. The error is thrown from invalidTypeError in test_bed_compiler.ts. As far as I could tell, the getAnnotation function in the resolver was returning null instead of Component, causing the error to be tripped. I assume the AOT build is stripping this metadata/the decorator before this check is made. I couldn't find any way to work around the issue other than rearchitecting my component so that I was no longer needing to make the overrideComponent call. As long as overrideComponent was in the stack at all, regardless of what parameters I passed to it, the tests failed due to missing metadata. I have not tested any of the other types of overrides, but given that most of the code in the TestBed compiler is in common between the decorated types, I would assume they all are impacted in AOT mode. Minimal ReproductionCreate a simple valid component, turn on AOT for Karma, and make a test where you use TestBed.overrideComponent to reset metadata. You don't even need to specify an actual override in the second parameter to trigger the issue: TestBed.overrideComponent(YourComponent, {}) triggers the failure. Exception or ErrorYour EnvironmentAnything else relevant?No response Activity
MetadataMetadataAssigneesTypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |