@@ -163,8 +163,10 @@ class TestCoverage {
163
163
for ( let j = 0 ; j < functions . length ; ++ j ) {
164
164
const { isBlockCoverage, ranges } = functions [ j ] ;
165
165
166
+ let maxCountPerFunction = 0 ;
166
167
for ( let k = 0 ; k < ranges . length ; ++ k ) {
167
168
const range = ranges [ k ] ;
169
+ maxCountPerFunction = MathMax ( maxCountPerFunction , range . count ) ;
168
170
169
171
mapRangeToLines ( range , lines ) ;
170
172
@@ -190,7 +192,7 @@ class TestCoverage {
190
192
ArrayPrototypePush ( functionReports , {
191
193
__proto__ : null ,
192
194
name : functions [ j ] . functionName ,
193
- count : MathMax ( ... ArrayPrototypeMap ( ranges , ( r ) => r . count ) ) ,
195
+ count : maxCountPerFunction ,
194
196
line : range . lines [ 0 ] . line ,
195
197
} ) ;
196
198
@@ -207,23 +209,16 @@ class TestCoverage {
207
209
208
210
for ( let j = 0 ; j < lines . length ; ++ j ) {
209
211
const line = lines [ j ] ;
210
-
211
- if ( line . covered || line . ignore ) {
212
- coveredCnt ++ ;
213
- if ( ! line . ignore ) {
214
- ArrayPrototypePush ( lineReports , {
215
- __proto__ : null ,
216
- line : line . line ,
217
- count : line . count ,
218
- } ) ;
219
- }
220
- } else {
212
+ if ( ! line . ignore ) {
221
213
ArrayPrototypePush ( lineReports , {
222
214
__proto__ : null ,
223
215
line : line . line ,
224
- count : 0 ,
216
+ count : line . count
225
217
} ) ;
226
218
}
219
+ if ( line . covered || line . ignore ) {
220
+ coveredCnt ++ ;
221
+ }
227
222
}
228
223
229
224
ArrayPrototypePush ( coverageSummary . files , {
@@ -350,6 +345,7 @@ function mapRangeToLines(range, lines) {
350
345
if ( count === 0 && startOffset <= line . startOffset &&
351
346
endOffset >= line . endOffset ) {
352
347
line . covered = false ;
348
+ line . count = 0 ;
353
349
}
354
350
if ( count > 0 && startOffset <= line . startOffset &&
355
351
endOffset >= line . endOffset ) {
0 commit comments