Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Coverage ignores functions like forwardRef in decorator #23776

Open
CSchulz opened this issue Aug 19, 2022 · 5 comments
Open

Code Coverage ignores functions like forwardRef in decorator #23776

CSchulz opened this issue Aug 19, 2022 · 5 comments
Labels
area: devkit/build-angular devkit/build-angular:karma freq1: low Only reported by a handful of users who observe it rarely needs: investigation Requires some digging to determine if action is needed severity3: broken type: bug/fix

Comments

@CSchulz
Copy link

CSchulz commented Aug 19, 2022

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

With Angular 13 we have encountered fat arrow functions like the forward ref in decorators aren't counted in coverage any longer.

@Component({
  changeDetection: ChangeDetectionStrategy.OnPush,
  templateUrl: './abschluss.component.html',
  providers: [
    {
      provide: DynamicDocumentLoader,
      useExisting: forwardRef(() => AbschlussComponent),
    },
  ],
})
export class AbschlussComponent implements DynamicDocumentLoader, OnInit {

Before Angular 13 we had 100 % code coverage and after updating to Angular 13 it looses the coverage in functions. lines and statements.
It seems to be related to the target version, we had to update it to ES2015 in the specific tsconfig.json files.

Angular 12 was still using ES5 because of the issue we found here angular/angular#44781

Angular 13:
image

Angular 12:
image

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 13.3.9
Node: 16.14.2
Package Manager: npm 8.5.0
OS: win32 x64

Angular: 13.3.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1303.9
@angular-devkit/build-angular   13.3.9
@angular-devkit/core            13.3.9
@angular-devkit/schematics      13.3.9
@angular/cli                    13.3.9
@schematics/angular             13.3.9
ng-packagr                      13.3.1
rxjs                            7.5.6
typescript                      4.6.4

Anything else?

No response

@alan-agius4 alan-agius4 transferred this issue from angular/angular Aug 22, 2022
@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity3: broken devkit/build-angular:karma area: devkit/build-angular needs: investigation Requires some digging to determine if action is needed labels Aug 22, 2022
@osaf96
Copy link

osaf96 commented Aug 31, 2022

Hi @alan-agius4 can you assign this to me? would love to take a look at it.

@alan-agius4
Copy link
Collaborator

@osaf96, feel free to look into this and post any finding here.

@osaf96
Copy link

osaf96 commented Aug 31, 2022

@alan-agius4 sure thing

@CSchulz
Copy link
Author

CSchulz commented Sep 1, 2022

It could be possible related to the @babel/core 7.8.9 and 7.8.10+ changes.

Perhaps related babel/babel#14899

@CSchulz
Copy link
Author

CSchulz commented Sep 21, 2022

It could be possible that this issue is related to a forgotten emitDecoratorMetadata in the tsconfig.spec.json and not related to angular or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: devkit/build-angular devkit/build-angular:karma freq1: low Only reported by a handful of users who observe it rarely needs: investigation Requires some digging to determine if action is needed severity3: broken type: bug/fix
Projects
None yet
Development

No branches or pull requests

4 participants