escover 6.2.1 → 6.2.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/ChangeLog +10 -0
- package/lib/cli/cli.js +2 -2
- package/lib/formatters/responsive.js +27 -17
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/lib/cli/cli.js
CHANGED
|
@@ -56,7 +56,7 @@ export const cli = ({argv, exit, readCoverage}) => {
|
|
|
56
56
|
const cmd = argv.slice(2);
|
|
57
57
|
|
|
58
58
|
if (cmd.length)
|
|
59
|
-
execute(`"${cmd.join('" "')}"
|
|
59
|
+
execute(`"${cmd.join('" "')}"`);
|
|
60
60
|
|
|
61
61
|
const coverage = readCoverage();
|
|
62
62
|
|
|
@@ -76,7 +76,7 @@ export const cli = ({argv, exit, readCoverage}) => {
|
|
|
76
76
|
|
|
77
77
|
export const isSuccess = (error) => !error || error?.status === Number(process.env.ESCOVER_SUCCESS_EXIT_CODE);
|
|
78
78
|
|
|
79
|
-
function execute(cmd, exit) {
|
|
79
|
+
function execute(cmd, exit = noop) {
|
|
80
80
|
const [error] = tryCatch(execSync, cmd, {
|
|
81
81
|
stdio: [0, 1, 2],
|
|
82
82
|
env: {
|
|
@@ -132,6 +132,7 @@ function buildGroupedTable(files, showPercent) {
|
|
|
132
132
|
]);
|
|
133
133
|
|
|
134
134
|
const groups = groupByFolder(files);
|
|
135
|
+
const hideFolders = groups.size === 1;
|
|
135
136
|
|
|
136
137
|
for (const [folder, group] of groups) {
|
|
137
138
|
let sum = 0;
|
|
@@ -144,28 +145,37 @@ function buildGroupedTable(files, showPercent) {
|
|
|
144
145
|
if (group.files.length > 0)
|
|
145
146
|
coverage = Math.round(sum / group.files.length);
|
|
146
147
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
folderLabel
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if (showPercent) {
|
|
158
|
-
let color = makeRed;
|
|
148
|
+
if (!hideFolders) {
|
|
149
|
+
let folderLabel = folder;
|
|
150
|
+
|
|
151
|
+
if (!folderLabel)
|
|
152
|
+
folderLabel = '.';
|
|
153
|
+
|
|
154
|
+
// убрали завершающий slash
|
|
155
|
+
const trimmedFolder = trim(folderLabel, 25);
|
|
156
|
+
|
|
157
|
+
let folderColor = makeRed;
|
|
159
158
|
|
|
160
159
|
if (coverage === 100)
|
|
161
|
-
|
|
160
|
+
folderColor = makeGreen;
|
|
161
|
+
|
|
162
|
+
const folderName = folderColor(trimmedFolder);
|
|
162
163
|
|
|
163
|
-
headerRow
|
|
164
|
+
const headerRow = [folderName];
|
|
165
|
+
|
|
166
|
+
if (showPercent) {
|
|
167
|
+
let color = makeRed;
|
|
168
|
+
|
|
169
|
+
if (coverage === 100)
|
|
170
|
+
color = makeGreen;
|
|
171
|
+
|
|
172
|
+
headerRow.push(color(`${coverage}%`));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
headerRow.push('');
|
|
176
|
+
tableData.push(headerRow);
|
|
164
177
|
}
|
|
165
178
|
|
|
166
|
-
headerRow.push('');
|
|
167
|
-
tableData.push(headerRow);
|
|
168
|
-
|
|
169
179
|
for (const f of group.files) {
|
|
170
180
|
const fileCell = ' ' + trim(f.shortName, 30);
|
|
171
181
|
|