[Bug]: 12.2.2 breaks branch coverage
See original GitHub issueVersion
12.2.2
Steps to reproduce
- 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) {}
- Execute and wondering why there are four branches.
Expected behavior
Expect that there are still zero branches.
Actual behavior
Four branches are counted.
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:
- Created a year ago
- Comments:19
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.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. Thisdesign:paramtypes
was replaced in the workaround mentioned in https://github.com/istanbuljs/istanbuljs/issues/70#issuecomment-975654329