@@ -415,8 +415,6 @@ export class IstanbulCoverageProvider
415415}
416416
417417async function transformCoverage ( coverageMap : CoverageMap ) {
418- includeImplicitElseBranches ( coverageMap )
419-
420418 const sourceMapStore = libSourceMaps . createSourceMapStore ( )
421419 return await sourceMapStore . transformCoverage ( coverageMap )
422420}
@@ -429,44 +427,3 @@ async function transformCoverage(coverageMap: CoverageMap) {
429427function removeQueryParameters ( filename : string ) {
430428 return filename . split ( '?' ) [ 0 ]
431429}
432-
433- /**
434- * Work-around for #1887 and #2239 while waiting for https://github.com/istanbuljs/istanbuljs/pull/706
435- *
436- * Goes through all files in the coverage map and checks if branchMap's have
437- * if-statements with implicit else. When finds one, copies source location of
438- * the if-statement into the else statement.
439- */
440- function includeImplicitElseBranches ( coverageMap : CoverageMap ) {
441- for ( const file of coverageMap . files ( ) ) {
442- const fileCoverage = coverageMap . fileCoverageFor ( file )
443-
444- for ( const branchMap of Object . values ( fileCoverage . branchMap ) ) {
445- if ( branchMap . type === 'if' ) {
446- const lastIndex = branchMap . locations . length - 1
447-
448- if ( lastIndex > 0 ) {
449- const elseLocation = branchMap . locations [ lastIndex ]
450-
451- if ( elseLocation && isEmptyCoverageRange ( elseLocation ) ) {
452- const ifLocation = branchMap . locations [ 0 ]
453-
454- elseLocation . start = { ...ifLocation . start }
455- elseLocation . end = { ...ifLocation . end }
456- }
457- }
458- }
459- }
460- }
461- }
462-
463- function isEmptyCoverageRange ( range : libCoverage . Range ) {
464- return (
465- range . start === undefined
466- || range . start . line === undefined
467- || range . start . column === undefined
468- || range . end === undefined
469- || range . end . line === undefined
470- || range . end . column === undefined
471- )
472- }
0 commit comments