escover 6.2.5 → 6.2.6

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,8 @@
1
+ 2026.05.08, v6.2.6
2
+
3
+ feature:
4
+ - d3747a2 formatters: responsive: Lines
5
+
1
6
  2026.05.08, v6.2.5
2
7
 
3
8
  feature:
@@ -21,10 +21,11 @@ export default (coverageFile, {skipFull = false} = {}) => {
21
21
  const totalWidth = process.stdout.columns || 80;
22
22
  const showPercent = totalWidth >= 70;
23
23
 
24
- const percentColWidth = showPercent ? 6 : 0;
25
24
  const linesColWidth = 20;
26
- const borderPadding = 6;
27
- const fileColWidth = Math.max(10, totalWidth - percentColWidth - linesColWidth - borderPadding);
25
+ const percentColWidth = showPercent ? 7 : 0;
26
+
27
+ // резерв на бордеры и padding + дополнительный запас
28
+ const fileColWidth = Math.max(10, totalWidth - linesColWidth - percentColWidth - 6 - 4);
28
29
 
29
30
  const tableData = buildGroupedTable(files, showPercent, linesColWidth);
30
31
 
@@ -39,18 +40,11 @@ export default (coverageFile, {skipFull = false} = {}) => {
39
40
  return table(tableData, options);
40
41
  };
41
42
 
42
- export function createTableOptions({showPercent, tableData, fileColWidth, percentColWidth, linesColWidth, totalWidth}) {
43
- const width = totalWidth || process.stdout.columns || 80;
44
-
45
- // если fileColWidth/percentColWidth не переданы — считаем
46
- const fileWidth = fileColWidth || Math.max(10, width - (showPercent ? 6 : 0) - 20 - 6);
47
- const percentWidth = percentColWidth || (showPercent ? 8 : 0);
48
- const linesWidth = linesColWidth || 20;
49
-
43
+ export function createTableOptions({showPercent, tableData, fileColWidth, percentColWidth, linesColWidth}) {
50
44
  const columns = [{
51
45
  paddingLeft: 1,
52
46
  paddingRight: 1,
53
- width: fileWidth,
47
+ width: fileColWidth,
54
48
  wrapWord: false,
55
49
  }];
56
50
 
@@ -58,14 +52,14 @@ export function createTableOptions({showPercent, tableData, fileColWidth, percen
58
52
  columns.push({
59
53
  alignment: 'center',
60
54
  paddingLeft: 1,
61
- paddingRight: 0,
62
- width: percentWidth,
55
+ paddingRight: 1,
56
+ width: percentColWidth,
63
57
  });
64
58
 
65
59
  columns.push({
66
60
  paddingLeft: 1,
67
- paddingRight: 0,
68
- width: linesWidth,
61
+ paddingRight: 1,
62
+ width: linesColWidth,
69
63
  wrapWord: false,
70
64
  });
71
65
 
@@ -93,6 +87,7 @@ export function groupByFolder(files) {
93
87
  const folder = parts.length > 1 ? parts
94
88
  .slice(0, -1)
95
89
  .join('/') : '';
90
+
96
91
  const fileName = parts.at(-1);
97
92
 
98
93
  let group = groups.get(folder);
@@ -157,7 +152,6 @@ export function buildGroupedTable(files, showPercent, linesColWidth) {
157
152
  const groups = groupByFolder(files);
158
153
  const hideFolders = groups.size === 1;
159
154
 
160
-
161
155
  for (const [folder, group] of groups) {
162
156
  let sum = 0;
163
157
 
@@ -196,33 +190,43 @@ export function buildGroupedTable(files, showPercent, linesColWidth) {
196
190
  }
197
191
 
198
192
  export function formatLines(array, maxLen = 20) {
199
- const nums = array;
200
- const ranges = [];
201
- let [start] = nums;
202
- let [prev] = nums;
203
-
204
- for (let i = 1; i < nums.length; i++) {
205
- const n = nums[i];
193
+ if (array.every(isNumber)) {
194
+ const nums = array
195
+ .slice()
196
+ .sort((a, b) => a - b);
197
+ const ranges = [];
198
+ let [start] = nums;
199
+ let [prev] = nums;
206
200
 
207
- if (isNumber(prev) && typeof n === 'number' && n === prev + 1 || prev === n - 0) {
208
- prev = n;
209
- } else {
210
- ranges.push(String(start));
211
- start = n;
212
- prev = n;
201
+ for (let i = 1; i < nums.length; i++) {
202
+ const n = nums[i];
203
+
204
+ if (n === prev + 1) {
205
+ prev = n;
206
+ } else {
207
+ ranges.push(start === prev ? String(start) : `${start}..${prev}`);
208
+ start = n;
209
+ prev = n;
210
+ }
213
211
  }
212
+
213
+ ranges.push(start === prev ? String(start) : `${start}..${prev}`);
214
+
215
+ const joined = ranges.join(', ');
216
+
217
+ if (joined.length <= maxLen)
218
+ return joined;
219
+
220
+ return ranges[0];
214
221
  }
215
222
 
216
- ranges.push(start === prev ? String(start) : `${start}..${prev}`);
217
-
218
- const joined = ranges.join(', ');
223
+ // если элементы строки просто объединяем через ', ' и усечем
224
+ const joined = array.join(', ');
219
225
 
220
226
  if (joined.length <= maxLen)
221
227
  return joined;
222
228
 
223
- const [first] = ranges;
224
-
225
- return first;
229
+ return array[0];
226
230
  }
227
231
 
228
232
  export function parseUncoveredLines(lines) {
@@ -230,7 +234,7 @@ export function parseUncoveredLines(lines) {
230
234
 
231
235
  for (const [line, covered] of entries(lines))
232
236
  if (!covered)
233
- out.push(line);
237
+ out.push(Number(line));
234
238
 
235
239
  return out;
236
240
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "6.2.5",
3
+ "version": "6.2.6",
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",