escover 6.2.7 → 6.2.8

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/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ 2026.05.09, v6.2.8
2
+
3
+ feature:
4
+ - e796d5f formatters: responsive: trancuteLeft filename when no place on screen
5
+ - 6bcf251 formatters: responsive: build-grouped-table: pass object
6
+
1
7
  2026.05.09, v6.2.7
2
8
 
3
9
  feature:
@@ -7,7 +7,14 @@ const makeRed = chalk.hex('#f44336');
7
7
 
8
8
  export const getColor = (value) => value === 100 ? makeGreen : makeRed;
9
9
 
10
- export function buildGroupedTable(files, showPercent, linesColWidth) {
10
+ function truncateLeft(str, maxLength) {
11
+ if (str.length <= maxLength)
12
+ return str;
13
+
14
+ return `...${str.slice(str.length - maxLength + 5)}`;
15
+ }
16
+
17
+ export function buildGroupedTable({files, showPercent, linesColWidth, fileColWidth}) {
11
18
  const tableData = [];
12
19
 
13
20
  if (showPercent)
@@ -35,7 +42,9 @@ export function buildGroupedTable(files, showPercent, linesColWidth) {
35
42
 
36
43
  if (!hideFolders) {
37
44
  const row = [];
38
- row.push(getColor(coverage)(folder));
45
+
46
+ const shortFolder = truncateLeft(folder, fileColWidth);
47
+ row.push(getColor(coverage)(shortFolder));
39
48
 
40
49
  if (showPercent)
41
50
  row.push(getColor(coverage)(`${coverage}%`));
@@ -44,15 +53,20 @@ export function buildGroupedTable(files, showPercent, linesColWidth) {
44
53
  tableData.push(row);
45
54
  }
46
55
 
47
- for (const f of group.files) {
56
+ for (const {covered, lines, fileName, percentLines} of group.files) {
48
57
  const row = [];
49
- row.push(f.covered ? makeGreen(' ' + f.shortName) : makeRed(' ' + f.shortName));
58
+ const shortName = truncateLeft(fileName, fileColWidth);
59
+ const coloredShortName = covered ? makeGreen(shortName) : makeRed(shortName);
50
60
 
51
- if (showPercent)
52
- row.push(f.percentLines === 100 ? makeGreen(`${f.percentLines}%`) : makeRed(`${f.percentLines}%`));
61
+ row.push(coloredShortName);
62
+
63
+ if (showPercent) {
64
+ const percent = percentLines === 100 ? makeGreen(`${percentLines}%`) : makeRed(`${percentLines}%`);
65
+ row.push(percent);
66
+ }
53
67
 
54
- row.push(f.covered ? '' : makeRed(formatLines(
55
- f.lines,
68
+ row.push(covered ? '' : makeRed(formatLines(
69
+ lines,
56
70
  linesColWidth,
57
71
  )));
58
72
 
@@ -16,10 +16,14 @@ export function formatLines(nums, maxLen = 20) {
16
16
  }
17
17
 
18
18
  export function getShortenedRange(ranges, maxLen) {
19
- const last = ranges.at(-1).toString();
19
+ const last = ranges
20
+ .at(-1)
21
+ .toString();
20
22
 
21
23
  for (let i = 1; i < ranges.length - 1; i++) {
22
- const joined = `${ranges.slice(0, -i).join(', ')} ... ${last}`;
24
+ const joined = `${ranges
25
+ .slice(0, -i)
26
+ .join(', ')} ... ${last}`;
23
27
 
24
28
  if (joined.length <= maxLen)
25
29
  return joined;
@@ -20,7 +20,7 @@ export function groupByFolder(files) {
20
20
 
21
21
  group.files.push({
22
22
  ...f,
23
- shortName: fileName,
23
+ fileName,
24
24
  });
25
25
  }
26
26
 
@@ -21,7 +21,12 @@ export default (coverageFile, {skipFull = false} = {}) => {
21
21
  const percentColWidth = showPercent ? 7 : 0;
22
22
 
23
23
  const fileColWidth = Math.max(10, totalWidth - linesColWidth - percentColWidth - 6 - 4);
24
- const tableData = buildGroupedTable(files, showPercent, linesColWidth);
24
+ const tableData = buildGroupedTable({
25
+ files,
26
+ showPercent,
27
+ linesColWidth,
28
+ fileColWidth,
29
+ });
25
30
 
26
31
  const options = createTableOptions({
27
32
  showPercent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "6.2.7",
3
+ "version": "6.2.8",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
5
  "description": "Coverage for EcmaScript Modules",
6
6
  "main": "lib/escover.js",