Using overrideComponent breaks code coverage when testing with aot: true #30127
Labels
area: @angular/build
devkit/build-angular:karma
freq1: low
Only reported by a handful of users who observe it rarely
severity3: broken
type: bug/fix
Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When using
TestBed.overrideComponent
to stub a child component, the test code coverage is no longer accurateMinimal Reproduction
Generate a new app with latest CLI and add a component:
Use app-user in app.html:
Edit angular.json to add "aot": true in the test section and run:
Coverage is 100%
Now, in the app.spec.ts, add in
beforeEach
:(this happens with a proper stub of course but even removing the import and adding it back works to reproduce the issue)
Run the tests again:
Coverage is now inaccurate:
Exception or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: