@@ -110,7 +110,7 @@ const getReportGroup = (reports, lcov, dataType) => {
110
110
}
111
111
112
112
// group v8 and istanbul
113
- const reportGroup = { } ;
113
+ const groupMap = new Map ( ) ;
114
114
Object . keys ( reportMap ) . forEach ( ( k ) => {
115
115
const options = reportMap [ k ] ;
116
116
@@ -120,24 +120,24 @@ const getReportGroup = (reports, lcov, dataType) => {
120
120
type = options . type || 'v8' ;
121
121
}
122
122
123
- let group = reportGroup [ type ] ;
123
+ let group = groupMap . get ( type ) ;
124
124
if ( ! group ) {
125
- group = { } ;
126
- reportGroup [ type ] = group ;
125
+ group = new Map ( ) ;
126
+ groupMap . set ( type , group ) ;
127
127
}
128
128
129
- group [ k ] = options ;
129
+ group . set ( k , options ) ;
130
130
131
131
} ) ;
132
132
133
133
// requires a default istanbul report if data is istanbul
134
- if ( dataType === 'istanbul' && ! reportGroup . istanbul ) {
135
- reportGroup . istanbul = {
136
- html : { }
137
- } ;
134
+ if ( dataType === 'istanbul' && ! groupMap . has ( ' istanbul' ) ) {
135
+ const istanbulGroup = new Map ( ) ;
136
+ istanbulGroup . set ( ' html' , { } ) ;
137
+ groupMap . set ( 'istanbul' , istanbulGroup ) ;
138
138
}
139
139
140
- return reportGroup ;
140
+ return groupMap ;
141
141
} ;
142
142
143
143
// ========================================================================================================
@@ -146,7 +146,7 @@ const getReportGroup = (reports, lcov, dataType) => {
146
146
const generateV8ListReports = async ( v8list , coverageData , fileSources , options ) => {
147
147
let istanbulReportPath ;
148
148
// v8 to istanbul reports
149
- if ( options . reportGroup . istanbul ) {
149
+ if ( options . reportGroup . has ( ' istanbul' ) ) {
150
150
const istanbulCoverageResults = await saveIstanbulReports ( coverageData , fileSources , options ) ;
151
151
istanbulReportPath = istanbulCoverageResults . reportPath ;
152
152
}
@@ -200,11 +200,9 @@ const generateCoverageReports = async (dataList, sourceCache, options) => {
200
200
// [ 'type', 'reportPath', 'name', 'watermarks', 'summary', 'files' ]
201
201
// console.log(Object.keys(coverageResults));
202
202
203
- const bothGroup = options . reportGroup . both ;
204
- if ( bothGroup ) {
205
- const bothReports = Object . keys ( bothGroup ) ;
206
- for ( const reportName of bothReports ) {
207
- const reportOptions = bothGroup [ reportName ] ;
203
+ if ( options . reportGroup . has ( 'both' ) ) {
204
+ const bothGroup = options . reportGroup . get ( 'both' ) ;
205
+ for ( const [ reportName , reportOptions ] of bothGroup ) {
208
206
const builtInHandler = bothBuiltInReports [ reportName ] ;
209
207
const t1 = Date . now ( ) ;
210
208
if ( builtInHandler ) {
0 commit comments