monocart-coverage-reports 2.11.1 → 2.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.js +11 -0
- package/lib/converter/converter.js +4 -4
- package/lib/generate.js +5 -4
- package/lib/index.js +2 -2
- package/lib/istanbul/istanbul.js +2 -1
- package/lib/packages/monocart-coverage-vendor.js +18 -17
- package/lib/v8/v8.js +1 -1
- package/package.json +9 -8
package/lib/cli.js
CHANGED
|
@@ -118,10 +118,21 @@ const initNodeV8CoverageDir = (coverageOptions) => {
|
|
|
118
118
|
return nodeV8CoverageDir;
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
+
const mergeCoverage = async (cliOptions) => {
|
|
122
|
+
const coverageReport = MCR(cliOptions);
|
|
123
|
+
await coverageReport.loadConfig(cliOptions.config);
|
|
124
|
+
coverageReport.cleanCache();
|
|
125
|
+
await coverageReport.generate();
|
|
126
|
+
};
|
|
127
|
+
|
|
121
128
|
const executeCommand = async (command, cliOptions) => {
|
|
122
129
|
|
|
123
130
|
Util.logInfo(`Execute: ${EC.cyan(command)}`);
|
|
124
131
|
|
|
132
|
+
if (command === 'merge') {
|
|
133
|
+
return mergeCoverage(cliOptions);
|
|
134
|
+
}
|
|
135
|
+
|
|
125
136
|
// before load config
|
|
126
137
|
await initNodeOptions(cliOptions);
|
|
127
138
|
|
|
@@ -1348,7 +1348,7 @@ const convertCoverages = (list, options, untested) => {
|
|
|
1348
1348
|
}
|
|
1349
1349
|
}
|
|
1350
1350
|
|
|
1351
|
-
logConvertTime(
|
|
1351
|
+
logConvertTime(`${EC.magenta('│ ')}${EC.cyan('├')} [convert] parsed ast: ${sourcePath} (${EC.cyan(Util.BSF(maxContentLength))})`, time_start_ast, untested);
|
|
1352
1352
|
|
|
1353
1353
|
// console.log(sourcePath, astInfo.statements.length);
|
|
1354
1354
|
// ============================
|
|
@@ -1390,7 +1390,7 @@ const convertCoverages = (list, options, untested) => {
|
|
|
1390
1390
|
|
|
1391
1391
|
stateList.push(state);
|
|
1392
1392
|
|
|
1393
|
-
logConvertTime(
|
|
1393
|
+
logConvertTime(`${EC.magenta('│ ')}${EC.cyan('├')} [convert] unpacked sourcemap: ${sourcePath} (${unpackedFiles})`, time_start_unpack, untested);
|
|
1394
1394
|
|
|
1395
1395
|
}
|
|
1396
1396
|
|
|
@@ -1616,7 +1616,7 @@ const addUntestedFiles = async (stateList, options) => {
|
|
|
1616
1616
|
|
|
1617
1617
|
// console.log('untestedList', untestedList);
|
|
1618
1618
|
|
|
1619
|
-
Util.logTime(
|
|
1619
|
+
Util.logTime(`${EC.magenta('│ ')}${EC.cyan('├')} [convert] added untested files: ${EC.yellow(untestedList.length)}`, time_start_untested);
|
|
1620
1620
|
|
|
1621
1621
|
|
|
1622
1622
|
};
|
|
@@ -1708,7 +1708,7 @@ const convertV8List = async (v8list, options) => {
|
|
|
1708
1708
|
const time_start_convert = Date.now();
|
|
1709
1709
|
const dataList = generateV8DataList(stateList, options);
|
|
1710
1710
|
const dataFiles = EC.cyan(`${dataList.v8DataList.length} files`);
|
|
1711
|
-
Util.logTime(
|
|
1711
|
+
Util.logTime(`${EC.magenta('│ ')}${EC.cyan('├')} [convert] converted data list (${dataFiles})`, time_start_convert);
|
|
1712
1712
|
|
|
1713
1713
|
return dataList;
|
|
1714
1714
|
};
|
package/lib/generate.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { fileURLToPath } = require('url');
|
|
4
|
+
const EC = require('eight-colors');
|
|
4
5
|
|
|
5
6
|
const Util = require('./utils/util.js');
|
|
6
7
|
const { convertV8List } = require('./converter/converter.js');
|
|
@@ -172,12 +173,12 @@ const getCoverageResults = async (dataList, sourceCache, options) => {
|
|
|
172
173
|
// merge v8list first
|
|
173
174
|
const t1 = Date.now();
|
|
174
175
|
const v8list = await mergeV8Coverage(dataList, sourceCache, options);
|
|
175
|
-
Util.logTime('
|
|
176
|
+
Util.logTime(`${EC.magenta('├')} [generate] merged v8 coverage data`, t1);
|
|
176
177
|
// console.log('after merge', v8list.map((it) => it.url));
|
|
177
178
|
|
|
178
179
|
const t2 = Date.now();
|
|
179
180
|
const results = await convertV8List(v8list, options);
|
|
180
|
-
Util.logTime('
|
|
181
|
+
Util.logTime(`${EC.magenta('├')} [generate] converted coverage data`, t2);
|
|
181
182
|
|
|
182
183
|
const {
|
|
183
184
|
v8DataList, coverageData, fileSources
|
|
@@ -189,7 +190,7 @@ const getCoverageResults = async (dataList, sourceCache, options) => {
|
|
|
189
190
|
const t3 = Date.now();
|
|
190
191
|
const istanbulData = await mergeIstanbulCoverage(dataList, options);
|
|
191
192
|
const { coverageData, fileSources } = initIstanbulData(istanbulData, options);
|
|
192
|
-
Util.logTime('
|
|
193
|
+
Util.logTime(`${EC.magenta('├')} [generate] prepared istanbul coverage data`, t3);
|
|
193
194
|
const results = await saveIstanbulReports(coverageData, fileSources, options);
|
|
194
195
|
return results;
|
|
195
196
|
};
|
|
@@ -210,7 +211,7 @@ const generateCoverageReports = async (dataList, sourceCache, options) => {
|
|
|
210
211
|
} else {
|
|
211
212
|
await customReport(reportName, coverageResults, reportOptions, options);
|
|
212
213
|
}
|
|
213
|
-
Util.logTime(
|
|
214
|
+
Util.logTime(`${EC.magenta('├')} [generate] saved report: ${reportName}`, t1);
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
|
package/lib/index.js
CHANGED
|
@@ -168,7 +168,7 @@ class CoverageReport {
|
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
Util.logTime('
|
|
171
|
+
Util.logTime(`${EC.magenta('├')} [generate] prepared coverage data`, time_start);
|
|
172
172
|
|
|
173
173
|
const coverageResults = await generateCoverageReports(dataList, sourceCache, this.options);
|
|
174
174
|
|
|
@@ -252,7 +252,7 @@ class CoverageReport {
|
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
Util.logInfo(`Loaded: ${EC.cyan(configPath)}`);
|
|
255
|
+
Util.logInfo(`Loaded: ${EC.cyan(Util.relativePath(configPath))}`);
|
|
256
256
|
|
|
257
257
|
// init options again
|
|
258
258
|
this.options = {
|
package/lib/istanbul/istanbul.js
CHANGED
|
@@ -3,6 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const istanbulReports = require('istanbul-reports');
|
|
4
4
|
const istanbulLibCoverage = require('istanbul-lib-coverage');
|
|
5
5
|
const istanbulLibReport = require('istanbul-lib-report');
|
|
6
|
+
const EC = require('eight-colors');
|
|
6
7
|
|
|
7
8
|
const Util = require('../utils/util.js');
|
|
8
9
|
const IstanbulSummary = require('./istanbul-summary.js');
|
|
@@ -95,7 +96,7 @@ const saveIstanbulReports = (coverageData, fileSources, options) => {
|
|
|
95
96
|
const t1 = Date.now();
|
|
96
97
|
const report = istanbulReports.create(reportName, reportOptions);
|
|
97
98
|
report.execute(context);
|
|
98
|
-
Util.logTime(
|
|
99
|
+
Util.logTime(`${EC.magenta('├')} [generate] saved report: ${reportName}`, t1);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
|