monocart-coverage-reports 2.11.5 → 2.12.0
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 +1 -0
- package/lib/converter/converter.js +1 -1
- package/lib/generate.js +3 -5
- package/lib/index.d.ts +2 -0
- package/lib/istanbul/istanbul.js +4 -13
- package/lib/packages/monocart-coverage-vendor.js +5 -5
- package/lib/utils/gc.js +9 -9
- package/lib/utils/merge/merge.js +439 -439
- package/lib/utils/merge/range-tree.js +123 -123
- package/lib/utils/source-path.js +41 -20
- package/package.json +117 -119
package/lib/cli.js
CHANGED
|
@@ -206,6 +206,7 @@ program
|
|
|
206
206
|
.version(version, '-v, --version', 'output the current version')
|
|
207
207
|
.argument('[command]', 'command to execute')
|
|
208
208
|
.allowUnknownOption()
|
|
209
|
+
.allowExcessArguments()
|
|
209
210
|
.option('-c, --config <path>', 'custom config file path')
|
|
210
211
|
.option('-l, --logging <logging>', 'off, error, info, debug')
|
|
211
212
|
|
|
@@ -1441,7 +1441,7 @@ const mergeV8Data = (state, stateList) => {
|
|
|
1441
1441
|
// console.log(stateList);
|
|
1442
1442
|
|
|
1443
1443
|
// let debug = false;
|
|
1444
|
-
// if (state.sourcePath.endsWith('counter
|
|
1444
|
+
// if (state.sourcePath.endsWith('counter')) {
|
|
1445
1445
|
// debug = true;
|
|
1446
1446
|
// console.log('merge v8 data ===================================', state.sourcePath);
|
|
1447
1447
|
// console.log('bytes before ============', stateList.map((it) => it.bytes));
|
package/lib/generate.js
CHANGED
|
@@ -12,9 +12,7 @@ const { StreamZip } = require('./packages/monocart-coverage-vendor.js');
|
|
|
12
12
|
// built-in reports
|
|
13
13
|
|
|
14
14
|
// istanbul
|
|
15
|
-
const {
|
|
16
|
-
initIstanbulData, mergeIstanbulCoverage, saveIstanbulReports
|
|
17
|
-
} = require('./istanbul/istanbul.js');
|
|
15
|
+
const { mergeIstanbulCoverage, saveIstanbulReports } = require('./istanbul/istanbul.js');
|
|
18
16
|
|
|
19
17
|
// v8
|
|
20
18
|
const { mergeV8Coverage, saveV8Report } = require('./v8/v8.js');
|
|
@@ -189,9 +187,9 @@ const getCoverageResults = async (dataList, sourceCache, options) => {
|
|
|
189
187
|
// istanbul data
|
|
190
188
|
const t3 = Date.now();
|
|
191
189
|
const istanbulData = await mergeIstanbulCoverage(dataList, options);
|
|
192
|
-
const { coverageData, fileSources } = initIstanbulData(istanbulData, options);
|
|
193
190
|
Util.logTime(`${EC.magenta('├')} [generate] prepared istanbul coverage data`, t3);
|
|
194
|
-
const
|
|
191
|
+
const fileSources = options.fileSources || {};
|
|
192
|
+
const results = await saveIstanbulReports(istanbulData, fileSources, options);
|
|
195
193
|
return results;
|
|
196
194
|
};
|
|
197
195
|
|
package/lib/index.d.ts
CHANGED
|
@@ -544,6 +544,8 @@ declare namespace MCR {
|
|
|
544
544
|
* @param coverageKey defaults to `__coverage__`
|
|
545
545
|
*/
|
|
546
546
|
getIstanbulCoverage: (coverageKey?: string) => Promise<any>;
|
|
547
|
+
|
|
548
|
+
close: () => Promise<void>
|
|
547
549
|
}
|
|
548
550
|
|
|
549
551
|
/** Adapt to the CDPSession of Playwright or Puppeteer */
|
package/lib/istanbul/istanbul.js
CHANGED
|
@@ -37,6 +37,8 @@ const findHtmlPath = (outputDir) => {
|
|
|
37
37
|
|
|
38
38
|
const saveIstanbulReports = (coverageData, fileSources, options) => {
|
|
39
39
|
|
|
40
|
+
coverageData = initIstanbulSourcePath(coverageData, fileSources, options);
|
|
41
|
+
|
|
40
42
|
const coverageMap = istanbulLibCoverage.createCoverageMap(coverageData);
|
|
41
43
|
|
|
42
44
|
const defaultWatermarks = {
|
|
@@ -139,7 +141,7 @@ const addUntestedFiles = async (istanbulData, options) => {
|
|
|
139
141
|
// console.log('istanbul untestedList', untestedList);
|
|
140
142
|
untestedList.forEach((item) => {
|
|
141
143
|
if (!istanbulData[item.path]) {
|
|
142
|
-
istanbulData[item.path] = item;
|
|
144
|
+
istanbulData[item.path] = istanbulLibCoverage.createFileCoverage(item);
|
|
143
145
|
}
|
|
144
146
|
});
|
|
145
147
|
|
|
@@ -161,19 +163,8 @@ const mergeIstanbulCoverage = async (dataList, options) => {
|
|
|
161
163
|
return istanbulData;
|
|
162
164
|
};
|
|
163
165
|
|
|
164
|
-
const initIstanbulData = (istanbulData, options) => {
|
|
165
|
-
const fileSources = options.fileSources || {};
|
|
166
|
-
const coverageData = initIstanbulSourcePath(istanbulData, fileSources, options);
|
|
167
|
-
|
|
168
|
-
return {
|
|
169
|
-
fileSources,
|
|
170
|
-
coverageData
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
166
|
module.exports = {
|
|
175
167
|
saveIstanbulReports,
|
|
176
168
|
mergeIstanbulDataList,
|
|
177
|
-
mergeIstanbulCoverage
|
|
178
|
-
initIstanbulData
|
|
169
|
+
mergeIstanbulCoverage
|
|
179
170
|
};
|