File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
src/reports/cobertura/parser Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,17 @@ import {
8
8
import { Cobertura , Package } from '../types'
9
9
10
10
export default async function parse ( cobertura : Cobertura ) : Promise < Coverage > {
11
- const fileList = cobertura . coverage . packages . package . map (
12
- ( { '@_name' : name } ) => {
13
- return name
14
- }
15
- )
11
+ const packages = cobertura . coverage . packages . package
12
+ const packageArray = Array . isArray ( packages ) ? packages : [ packages ]
16
13
14
+ const fileList = packageArray . map ( ( { '@_name' : name } ) => {
15
+ return name
16
+ } )
17
17
const basePath = `${ determineCommonBasePath ( fileList ) } `
18
18
const r = new RegExp ( `^${ escapeRegExp ( `${ basePath } /` ) } ` )
19
19
20
20
return {
21
- files : cobertura . coverage . packages . package . reduce (
21
+ files : packageArray . reduce (
22
22
( previous , { '@_name' : name , '@_line-rate' : lineRate } : Package ) => ( {
23
23
...previous ,
24
24
[ createHash ( name . replace ( r , '' ) ) ] : {
You can’t perform that action at this time.
0 commit comments