monocart-coverage-reports 2.4.1 → 2.4.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.
|
@@ -826,7 +826,6 @@ const getOriginalDecodedMappings = (originalDecodedMap, sourceIndex, locator) =>
|
|
|
826
826
|
|
|
827
827
|
// add offset and index
|
|
828
828
|
decodedMappings.forEach((item, i) => {
|
|
829
|
-
item.originalIndex = i;
|
|
830
829
|
item.originalOffset = locator.locationToOffset({
|
|
831
830
|
line: item.originalLine + 1,
|
|
832
831
|
column: item.originalColumn
|
|
@@ -266,13 +266,13 @@ const getOriginalEndOffset = (m, rangeInfo) => {
|
|
|
266
266
|
return m.originalEndOffset;
|
|
267
267
|
};
|
|
268
268
|
|
|
269
|
-
const getOriginalText = (m1, m2, rangeInfo) => {
|
|
269
|
+
const getOriginalText = (m1, m2, rangeInfo, direction) => {
|
|
270
270
|
const originalLocator = rangeInfo.originalState.locator;
|
|
271
271
|
|
|
272
272
|
const o1 = m1.originalOffset;
|
|
273
273
|
const o2 = m2.originalOffset;
|
|
274
274
|
|
|
275
|
-
// most of time
|
|
275
|
+
// o1 < o2: most of time
|
|
276
276
|
if (o1 < o2) {
|
|
277
277
|
// could be multiple lines for original text
|
|
278
278
|
return {
|
|
@@ -291,10 +291,28 @@ const getOriginalText = (m1, m2, rangeInfo) => {
|
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
// o1 > o2
|
|
294
|
+
// o1 > o2: should be wrong sourcemap
|
|
295
|
+
|
|
296
|
+
// just reverse offsets if few cross lines
|
|
297
|
+
const crossLines = m1.originalLine - m2.originalLine;
|
|
298
|
+
if (crossLines < 2) {
|
|
299
|
+
return {
|
|
300
|
+
originalOffset: o2,
|
|
301
|
+
originalText: originalLocator.getSlice(o2, o1)
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// if (direction === 'start') {
|
|
306
|
+
// should be m2 ?
|
|
307
|
+
// console.log(direction, rangeInfo.originalState.sourcePath);
|
|
308
|
+
// console.log(m1, m2);
|
|
309
|
+
// }
|
|
310
|
+
|
|
311
|
+
// should be wrong, ignore m2
|
|
312
|
+
const originalEndOffset = getOriginalEndOffset(m1, rangeInfo);
|
|
295
313
|
return {
|
|
296
|
-
originalOffset:
|
|
297
|
-
originalText: originalLocator.getSlice(
|
|
314
|
+
originalOffset: o1,
|
|
315
|
+
originalText: originalLocator.getSlice(o1, originalEndOffset)
|
|
298
316
|
};
|
|
299
317
|
|
|
300
318
|
};
|
|
@@ -350,29 +368,6 @@ const getGeneratedText = (m1, m2, state, offset) => {
|
|
|
350
368
|
|
|
351
369
|
};
|
|
352
370
|
|
|
353
|
-
const checkOriginalMappings = (m1, m2, direction) => {
|
|
354
|
-
// check original offset order
|
|
355
|
-
if (m1.originalOffset <= m2.originalOffset) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// just reverse offsets if few cross lines
|
|
360
|
-
const crossLines = m1.originalLine - m2.originalLine;
|
|
361
|
-
if (crossLines < 2) {
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// console.log('================================================');
|
|
366
|
-
// console.log(crossLines);
|
|
367
|
-
// console.log(m1, m2);
|
|
368
|
-
|
|
369
|
-
// should be mistake
|
|
370
|
-
return {
|
|
371
|
-
error: true,
|
|
372
|
-
errors: [`invalid original ${direction}: ${EC.yellow(m1.originalOffset)} > ${EC.yellow(m2.originalOffset)}`]
|
|
373
|
-
};
|
|
374
|
-
};
|
|
375
|
-
|
|
376
371
|
// ========================================================================================================
|
|
377
372
|
|
|
378
373
|
const getFixedOriginalStart = (start, mappings, state, rangeInfo) => {
|
|
@@ -387,12 +382,7 @@ const getFixedOriginalStart = (start, mappings, state, rangeInfo) => {
|
|
|
387
382
|
}
|
|
388
383
|
|
|
389
384
|
const direction = 'start';
|
|
390
|
-
const
|
|
391
|
-
if (errorInfo) {
|
|
392
|
-
return errorInfo;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
const { originalText, originalOffset } = getOriginalText(m1, m2, rangeInfo);
|
|
385
|
+
const { originalText, originalOffset } = getOriginalText(m1, m2, rangeInfo, direction);
|
|
396
386
|
const { generatedText, generatedPos } = getGeneratedText(m1, m2, state, start);
|
|
397
387
|
|
|
398
388
|
const originalPos = getFixedPosition({
|
|
@@ -402,6 +392,17 @@ const getFixedOriginalStart = (start, mappings, state, rangeInfo) => {
|
|
|
402
392
|
originalState
|
|
403
393
|
}, direction);
|
|
404
394
|
|
|
395
|
+
// if (start === 2660) {
|
|
396
|
+
// console.log('=====================================================');
|
|
397
|
+
// console.log('fixed start', originalState.sourcePath);
|
|
398
|
+
// console.log({
|
|
399
|
+
// generatedText,
|
|
400
|
+
// generatedPos,
|
|
401
|
+
// originalText,
|
|
402
|
+
// originalPos
|
|
403
|
+
// });
|
|
404
|
+
// }
|
|
405
|
+
|
|
405
406
|
return {
|
|
406
407
|
originalStart: originalOffset + originalPos
|
|
407
408
|
};
|
|
@@ -431,12 +432,7 @@ const getFixedOriginalEnd = (end, mappings, state, rangeInfo) => {
|
|
|
431
432
|
}
|
|
432
433
|
|
|
433
434
|
const direction = 'end';
|
|
434
|
-
const
|
|
435
|
-
if (errorInfo) {
|
|
436
|
-
return errorInfo;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
const { originalText, originalOffset } = getOriginalText(m1, m2, rangeInfo);
|
|
435
|
+
const { originalText, originalOffset } = getOriginalText(m1, m2, rangeInfo, direction);
|
|
440
436
|
const { generatedText, generatedPos } = getGeneratedText(m1, m2, state, end);
|
|
441
437
|
|
|
442
438
|
const originalPos = getFixedPosition({
|
|
@@ -446,6 +442,17 @@ const getFixedOriginalEnd = (end, mappings, state, rangeInfo) => {
|
|
|
446
442
|
originalState
|
|
447
443
|
}, direction);
|
|
448
444
|
|
|
445
|
+
// if (end === 2858) {
|
|
446
|
+
// console.log('=====================================================');
|
|
447
|
+
// console.log('fixed end', originalState.sourcePath);
|
|
448
|
+
// console.log({
|
|
449
|
+
// generatedText,
|
|
450
|
+
// generatedPos,
|
|
451
|
+
// originalText,
|
|
452
|
+
// originalPos
|
|
453
|
+
// });
|
|
454
|
+
// }
|
|
455
|
+
|
|
449
456
|
return {
|
|
450
457
|
originalEnd: originalOffset + originalPos
|
|
451
458
|
};
|
package/lib/generate.js
CHANGED
|
@@ -39,11 +39,6 @@ const getReportGroup = (reports, lcov, dataType) => {
|
|
|
39
39
|
|
|
40
40
|
const reportMap = {};
|
|
41
41
|
|
|
42
|
-
// add lcovonly report
|
|
43
|
-
if (lcov) {
|
|
44
|
-
reportMap.lcovonly = {};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
42
|
const reportList = Util.toList(reports, ',');
|
|
48
43
|
reportList.forEach((it) => {
|
|
49
44
|
if (Util.isList(it)) {
|
|
@@ -67,6 +62,11 @@ const getReportGroup = (reports, lcov, dataType) => {
|
|
|
67
62
|
reportMap[defaultReport] = {};
|
|
68
63
|
}
|
|
69
64
|
|
|
65
|
+
// add lcovonly report after default report
|
|
66
|
+
if (lcov && !reportMap.lcovonly) {
|
|
67
|
+
reportMap.lcovonly = {};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
70
|
const allBuildInReports = {
|
|
71
71
|
// v8
|
|
72
72
|
'v8': 'v8',
|