@@ -460,7 +460,7 @@ async function getCoverage() {
460
460
* - Each object represents a file that has some untested lines.
461
461
* - If the `hasTests` attribute is `false`, then the file was not tested.
462
462
* - The `all` attribute has the line number of each untested lines.
463
- * - The `statements`, `functions`, `ifs` and `elses ` attributes have the line
463
+ * - The `statements`, `functions` and `branches ` attributes have the line
464
464
* numbers corresponding to that category of test missing.
465
465
*
466
466
* Returned array:
@@ -471,8 +471,7 @@ async function getCoverage() {
471
471
* all: number[],
472
472
* statements: number[],
473
473
* functions: number[],
474
- * ifs: number[],
475
- * elses: number[]
474
+ * branches: number[]
476
475
* }]
477
476
* ```
478
477
*
@@ -501,8 +500,7 @@ function getUntestedAddedLines(lines, coverage) {
501
500
all : [ ] ,
502
501
statements : [ ] ,
503
502
functions : [ ] ,
504
- ifs : [ ] ,
505
- elses : [ ]
503
+ branches : [ ]
506
504
}
507
505
const fileCoverage = coverage [ fullPath ]
508
506
if ( ! fileCoverage ) {
@@ -511,7 +509,7 @@ function getUntestedAddedLines(lines, coverage) {
511
509
} else {
512
510
const addedSet = new Set ( added )
513
511
const untestedAddedLinesSet = new Set ( )
514
- const { statements, functions, ifs , elses } = result
512
+ const { statements, functions, branches } = result
515
513
516
514
Object . entries ( fileCoverage . s ) . forEach ( ( [ k , v ] ) => {
517
515
if ( v === 0 ) {
@@ -541,27 +539,20 @@ function getUntestedAddedLines(lines, coverage) {
541
539
}
542
540
} )
543
541
544
- Object . entries ( fileCoverage . b ) . forEach ( ( [ k , v ] ) => {
545
- const [ ifBranchTests , elseBranchTests ] = v
542
+ Object . entries ( fileCoverage . b ) . forEach ( ( [ key , tests ] ) => {
543
+ tests . forEach ( ( timesTested , branchIndex ) => {
544
+ if ( timesTested === 0 ) {
545
+ const {
546
+ start : { line : start } ,
547
+ end : { line : end }
548
+ } = fileCoverage . branchMap [ key ] . locations [ branchIndex ]
546
549
547
- if ( ifBranchTests === 0 || elseBranchTests === 0 ) {
548
- const {
549
- start : { line : start } ,
550
- end : { line : end }
551
- } = fileCoverage . branchMap [ k ] . loc
552
-
553
- getIntegersInRangeInSet ( start , end , addedSet ) . forEach ( l => {
554
- if ( ifBranchTests === 0 || elseBranchTests === 0 ) {
555
- if ( ifBranchTests === 0 ) {
556
- ifs . push ( l )
557
- }
558
- if ( elseBranchTests === 0 ) {
559
- elses . push ( l )
560
- }
550
+ getIntegersInRangeInSet ( start , end , addedSet ) . forEach ( l => {
551
+ branches . push ( l )
561
552
untestedAddedLinesSet . add ( l )
562
- }
563
- } )
564
- }
553
+ } )
554
+ }
555
+ } )
565
556
} )
566
557
567
558
if ( untestedAddedLinesSet . size ) {
0 commit comments