testomatio-reporter-cli 2.19.0-beta → 2.19.0
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/package.json +1 -1
- package/src/pipe/bitbucket.js +7 -1
- package/src/pipe/github.js +7 -1
- package/src/pipe/gitlab.js +7 -1
- package/src/utils/pipe_utils.js +40 -0
package/package.json
CHANGED
package/src/pipe/bitbucket.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
markdownTable,
|
|
8
8
|
runSummary,
|
|
9
9
|
totalDuration,
|
|
10
|
+
smallRunSections,
|
|
10
11
|
} from '../utils/pipe_utils.js';
|
|
11
12
|
import { Gaxios } from 'gaxios';
|
|
12
13
|
import pc from 'picocolors';
|
|
@@ -174,7 +175,8 @@ export class BitbucketPipe {
|
|
|
174
175
|
let body = summary;
|
|
175
176
|
|
|
176
177
|
if (this.description) {
|
|
177
|
-
|
|
178
|
+
// Bitbucket strips HTML, so no <details> here
|
|
179
|
+
body += `\n\n**📝 Description**\n\n${truncate(this.description, 1024)}\n`;
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
if (failures.length) {
|
|
@@ -184,6 +186,10 @@ export class BitbucketPipe {
|
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
|
|
189
|
+
for (const { title, list } of smallRunSections(this.tests)) {
|
|
190
|
+
body += `\n\n**${title}**\n\n${list.join('\n')}`;
|
|
191
|
+
}
|
|
192
|
+
|
|
187
193
|
if (this.tests.length > 0 && !isPendingRun) {
|
|
188
194
|
body += `\n\n**🐢 Slowest Tests**\n\n`;
|
|
189
195
|
body += this.tests
|
package/src/pipe/github.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
markdownTable,
|
|
13
13
|
runSummary,
|
|
14
14
|
totalDuration,
|
|
15
|
+
smallRunSections,
|
|
15
16
|
} from '../utils/pipe_utils.js';
|
|
16
17
|
import { log } from '../utils/log.js';
|
|
17
18
|
|
|
@@ -147,7 +148,8 @@ class GitHubPipe {
|
|
|
147
148
|
|
|
148
149
|
let body = summary;
|
|
149
150
|
if (this.description) {
|
|
150
|
-
body +=
|
|
151
|
+
body += '\n\n<details>\n<summary><h3>📝 Description</h3></summary>\n\n';
|
|
152
|
+
body += `${truncate(this.description, 1024)}\n\n</details>`;
|
|
151
153
|
}
|
|
152
154
|
const coverageConfiguration = this.store?.coverageConfiguration;
|
|
153
155
|
const isManualRun = this.store?.runKind === 'manual';
|
|
@@ -172,6 +174,10 @@ class GitHubPipe {
|
|
|
172
174
|
body += '\n\n</details>';
|
|
173
175
|
}
|
|
174
176
|
|
|
177
|
+
for (const { title, list } of smallRunSections(this.tests)) {
|
|
178
|
+
body += `\n<details>\n<summary><h3>${title}</h3></summary>\n\n${list.join('\n')}\n</details>`;
|
|
179
|
+
}
|
|
180
|
+
|
|
175
181
|
if (this.tests.length > 0 && !isPendingRun) {
|
|
176
182
|
body += '\n<details>\n<summary><h3>🐢 Slowest Tests</h3></summary>\n\n';
|
|
177
183
|
body += this.tests
|
package/src/pipe/gitlab.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
markdownTable,
|
|
14
14
|
runSummary,
|
|
15
15
|
totalDuration,
|
|
16
|
+
smallRunSections,
|
|
16
17
|
} from '../utils/pipe_utils.js';
|
|
17
18
|
import { log } from '../utils/log.js';
|
|
18
19
|
|
|
@@ -148,7 +149,8 @@ class GitLabPipe {
|
|
|
148
149
|
let body = summary;
|
|
149
150
|
|
|
150
151
|
if (this.description) {
|
|
151
|
-
body +=
|
|
152
|
+
body += '\n\n<details>\n<summary><h3>📝 Description</h3></summary>\n\n';
|
|
153
|
+
body += `${truncate(this.description, 1024)}\n\n</details>`;
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
if (failures.length) {
|
|
@@ -159,6 +161,10 @@ class GitLabPipe {
|
|
|
159
161
|
body += '\n\n</details>';
|
|
160
162
|
}
|
|
161
163
|
|
|
164
|
+
for (const { title, list } of smallRunSections(this.tests)) {
|
|
165
|
+
body += `\n<details>\n<summary><h3>${title}</h3></summary>\n\n${list.join('\n')}\n</details>`;
|
|
166
|
+
}
|
|
167
|
+
|
|
162
168
|
if (this.tests.length > 0 && !isPendingRun) {
|
|
163
169
|
body += '\n<details>\n<summary><h3>🐢 Slowest Tests</h3></summary>\n\n';
|
|
164
170
|
body += this.tests
|
package/src/utils/pipe_utils.js
CHANGED
|
@@ -122,6 +122,14 @@ function statusEmoji(status) {
|
|
|
122
122
|
return '';
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
/**
|
|
126
|
+
* @param {string} str
|
|
127
|
+
* @returns {string} The string with its first letter in upper case, e.g. `passed` → `Passed`.
|
|
128
|
+
*/
|
|
129
|
+
function capitalize(str) {
|
|
130
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
131
|
+
}
|
|
132
|
+
|
|
125
133
|
/**
|
|
126
134
|
* Generate a full name string based on the provided test object.
|
|
127
135
|
* @param {object} t - The test object.
|
|
@@ -260,6 +268,37 @@ function totalDuration(tests) {
|
|
|
260
268
|
return humanizeDuration(Math.trunc(milliseconds), { maxDecimalPoints: 0 });
|
|
261
269
|
}
|
|
262
270
|
|
|
271
|
+
/**
|
|
272
|
+
* Runs with fewer tests than this list every test in the report, not only the failed ones.
|
|
273
|
+
*/
|
|
274
|
+
const SMALL_RUN_TESTS_LIMIT = 10;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Sections listing the passed, skipped and not yet run tests of a small run; failures have their own
|
|
278
|
+
* section. Not yet run tests (no status, or `pending`) are listed without any status label.
|
|
279
|
+
*
|
|
280
|
+
* @param {Array<{status?: string, title?: string, suite_title?: string, run_time?: number}>} tests
|
|
281
|
+
* @returns {Array<{title: string, list: string[]}>} Non-empty sections; none if the run is not small.
|
|
282
|
+
*/
|
|
283
|
+
function smallRunSections(tests) {
|
|
284
|
+
if (tests.length >= SMALL_RUN_TESTS_LIMIT) return [];
|
|
285
|
+
|
|
286
|
+
const sections = ['passed', 'skipped'].map(status => {
|
|
287
|
+
const list = tests
|
|
288
|
+
.filter(t => t.status === status)
|
|
289
|
+
.map(t => {
|
|
290
|
+
const runTime = t.run_time ? ` (${humanizeDuration(t.run_time)})` : '';
|
|
291
|
+
return `* ${statusEmoji(status)} ${fullName(t)}${runTime}`;
|
|
292
|
+
});
|
|
293
|
+
return { title: `${statusEmoji(status)} ${capitalize(status)} (${list.length})`, list };
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
const notRun = tests.filter(t => !t.status || t.status === 'pending').map(t => `* ${fullName(t)}`);
|
|
297
|
+
sections.push({ title: `📋 Tests (${notRun.length})`, list: notRun });
|
|
298
|
+
|
|
299
|
+
return sections.filter(section => section.list.length);
|
|
300
|
+
}
|
|
301
|
+
|
|
263
302
|
/**
|
|
264
303
|
* Render a two-column markdown table. Rows with an empty value are skipped, so optional rows
|
|
265
304
|
* need no surrounding `if`.
|
|
@@ -368,6 +407,7 @@ export {
|
|
|
368
407
|
markdownTable,
|
|
369
408
|
runSummary,
|
|
370
409
|
totalDuration,
|
|
410
|
+
smallRunSections,
|
|
371
411
|
plannedTestsLabel,
|
|
372
412
|
parsePipeOptions,
|
|
373
413
|
formatFilterListIds,
|