@@ -460,7 +460,7 @@ async function getCoverage() {
460460 * - Each object represents a file that has some untested lines.
461461 * - If the `hasTests` attribute is `false`, then the file was not tested.
462462 * - 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
464464 * numbers corresponding to that category of test missing.
465465 *
466466 * Returned array:
@@ -471,8 +471,7 @@ async function getCoverage() {
471471 * all: number[],
472472 * statements: number[],
473473 * functions: number[],
474- * ifs: number[],
475- * elses: number[]
474+ * branches: number[]
476475 * }]
477476 * ```
478477 *
@@ -501,8 +500,7 @@ function getUntestedAddedLines(lines, coverage) {
501500 all : [ ] ,
502501 statements : [ ] ,
503502 functions : [ ] ,
504- ifs : [ ] ,
505- elses : [ ]
503+ branches : [ ]
506504 }
507505 const fileCoverage = coverage [ fullPath ]
508506 if ( ! fileCoverage ) {
@@ -511,7 +509,7 @@ function getUntestedAddedLines(lines, coverage) {
511509 } else {
512510 const addedSet = new Set ( added )
513511 const untestedAddedLinesSet = new Set ( )
514- const { statements, functions, ifs , elses } = result
512+ const { statements, functions, branches } = result
515513
516514 Object . entries ( fileCoverage . s ) . forEach ( ( [ k , v ] ) => {
517515 if ( v === 0 ) {
@@ -541,27 +539,20 @@ function getUntestedAddedLines(lines, coverage) {
541539 }
542540 } )
543541
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 ]
546549
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 )
561552 untestedAddedLinesSet . add ( l )
562- }
563- } )
564- }
553+ } )
554+ }
555+ } )
565556 } )
566557
567558 if ( untestedAddedLinesSet . size ) {
0 commit comments