Skip to content

Code Coverage ignores functions like forwardRef in decorator #23776

Open
@CSchulz

Description

@CSchulz

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions