escover 6.2.2 → 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 +5 -0
- package/lib/cli/cli.js +2 -2
- package/lib/formatters/responsive.js +27 -23
- 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,34 +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
|
-
folderColor = makeGreen;
|
|
158
|
-
|
|
159
|
-
const folderName = folderColor(trimmedFolder);
|
|
160
|
-
|
|
161
|
-
const headerRow = [folderName];
|
|
162
|
-
|
|
163
|
-
if (showPercent) {
|
|
164
|
-
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;
|
|
165
158
|
|
|
166
159
|
if (coverage === 100)
|
|
167
|
-
|
|
160
|
+
folderColor = makeGreen;
|
|
161
|
+
|
|
162
|
+
const folderName = folderColor(trimmedFolder);
|
|
163
|
+
|
|
164
|
+
const headerRow = [folderName];
|
|
168
165
|
|
|
169
|
-
|
|
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);
|
|
170
177
|
}
|
|
171
178
|
|
|
172
|
-
headerRow.push('');
|
|
173
|
-
tableData.push(headerRow);
|
|
174
|
-
|
|
175
179
|
for (const f of group.files) {
|
|
176
180
|
const fileCell = ' ' + trim(f.shortName, 30);
|
|
177
181
|
|