question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: 12.2.2 breaks branch coverage

See original GitHub issue

Version

12.2.2

Steps to reproduce

  1. Create a sample class with decorator like this
    import { Pipe, PipeTransform } from '@angular/core';
    import { ConfigService } from './config.service';
     
    @Pipe({
      name: 'config',
    })
    export class ConfigPipe implements PipeTransform {
      constructor(private service: ConfigService) {}
    
  2. Execute and wondering why there are four branches.

Expected behavior

Expect that there are still zero branches.

Actual behavior

Four branches are counted.

image

Additional context

No response

Environment

System:
    OS: Windows 10 10.0.19043
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 16.14.2 - C:\nodejs\node.EXE
    npm: 8.5.0 - C:\nodejs\npm.CMD
  npmPackages:
    jest: ~28.1.0 => 28.1.3

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:19

github_iconTop GitHub Comments

3reactions
CSchulzcommented, Sep 21, 2022

I can confirm the issue is related to the forgotten emitDecoratorMetadata in our case. Fun fact the angular migration does not remove it automatically from the existing tsconfig.json files.

3reactions
ahnpnlcommented, Sep 19, 2022

Angular 12 removed the need of emitDecoratorMetadata so I think that was why the example app doesn’t have it. That option in general shouldn’t be needed anymore.

FYI with that option true, the emitted codes will be like in this example https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata, and notice that design:paramtypes is in emitted codes. This design:paramtypes was replaced in the workaround mentioned in https://github.com/istanbuljs/istanbuljs/issues/70#issuecomment-975654329

Read more comments on GitHub >

github_iconTop Results From Across the Web

constructor coverage for angular is not correct anymore
constructor params (dependency injection) are no longer marked as branches for coverage; Code coverage is not collected from all files (perhaps ...
Read more >
SMS:Bugfixes SMS
1 update breaks the Raster Difference tool. 13561 Trim Raster tool fails to create a new raster. 13562 Trim coverage tool fails the...
Read more >
Hiding Bugs from Branch Coverage
Let's talk now about branch coverage, which insists that every conditional branch executes both ways. This is very similar to statement coverage ...
Read more >
When unit testing code, is it possible to have 100% line ...
Branch coverage is making sure that yout tests cover all branches in the code; in other words, your testing should execute all of...
Read more >
Understanding Upgrade Impact and Changes
6/15. Understanding Upgrade Impact and Changes. This chapter covers the following topics: Understanding Technical Impact and Changes; Understanding Business ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found