playwright-slack-report 1.1.22 → 1.1.23
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.
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateFailures = exports.generateBlocks = void 0;
|
|
4
4
|
const generateBlocks = async (summaryResults, maxNumberOfFailures) => {
|
|
5
|
-
const maxNumberOfFailureLength = 650;
|
|
6
|
-
const fails = [];
|
|
7
5
|
const meta = [];
|
|
8
6
|
const header = {
|
|
9
7
|
type: 'section',
|
|
@@ -19,32 +17,7 @@ const generateBlocks = async (summaryResults, maxNumberOfFailures) => {
|
|
|
19
17
|
text: `✅ *${summaryResults.passed}* | ❌ *${summaryResults.failed}* | ⏩ *${summaryResults.skipped}*`,
|
|
20
18
|
},
|
|
21
19
|
};
|
|
22
|
-
|
|
23
|
-
const { failureReason, test } = summaryResults.failures[i];
|
|
24
|
-
const formattedFailure = failureReason
|
|
25
|
-
.substring(0, maxNumberOfFailureLength)
|
|
26
|
-
.split('\n')
|
|
27
|
-
.map((l) => `>${l}`)
|
|
28
|
-
.join('\n');
|
|
29
|
-
fails.push({
|
|
30
|
-
type: 'section',
|
|
31
|
-
text: {
|
|
32
|
-
type: 'mrkdwn',
|
|
33
|
-
text: `*${test}*
|
|
34
|
-
\n${formattedFailure}`,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
if (i > maxNumberOfFailures) {
|
|
38
|
-
fails.push({
|
|
39
|
-
type: 'section',
|
|
40
|
-
text: {
|
|
41
|
-
type: 'mrkdwn',
|
|
42
|
-
text: `*There are too many failures to display - ${fails.length} out of ${summaryResults.failures.length} failures shown*`,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
20
|
+
const fails = await generateFailures(summaryResults, maxNumberOfFailures);
|
|
48
21
|
if (summaryResults.meta) {
|
|
49
22
|
for (let i = 0; i < summaryResults.meta.length; i += 1) {
|
|
50
23
|
const { key, value } = summaryResults.meta[i];
|
|
@@ -61,9 +34,6 @@ const generateBlocks = async (summaryResults, maxNumberOfFailures) => {
|
|
|
61
34
|
header,
|
|
62
35
|
summary,
|
|
63
36
|
...meta,
|
|
64
|
-
{
|
|
65
|
-
type: 'divider',
|
|
66
|
-
},
|
|
67
37
|
...fails,
|
|
68
38
|
];
|
|
69
39
|
};
|
|
@@ -71,7 +41,8 @@ exports.generateBlocks = generateBlocks;
|
|
|
71
41
|
const generateFailures = async (summaryResults, maxNumberOfFailures) => {
|
|
72
42
|
const maxNumberOfFailureLength = 650;
|
|
73
43
|
const fails = [];
|
|
74
|
-
|
|
44
|
+
const numberOfFailuresToShow = Math.min(summaryResults.failures.length, maxNumberOfFailures);
|
|
45
|
+
for (let i = 0; i < numberOfFailuresToShow; i += 1) {
|
|
75
46
|
const { failureReason, test } = summaryResults.failures[i];
|
|
76
47
|
const formattedFailure = failureReason
|
|
77
48
|
.substring(0, maxNumberOfFailureLength)
|
|
@@ -86,16 +57,15 @@ const generateFailures = async (summaryResults, maxNumberOfFailures) => {
|
|
|
86
57
|
\n${formattedFailure}`,
|
|
87
58
|
},
|
|
88
59
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
}
|
|
60
|
+
}
|
|
61
|
+
if (summaryResults.failures.length > maxNumberOfFailures) {
|
|
62
|
+
fails.push({
|
|
63
|
+
type: 'section',
|
|
64
|
+
text: {
|
|
65
|
+
type: 'mrkdwn',
|
|
66
|
+
text: `*⚠️ There are too many failures to display - ${fails.length} out of ${summaryResults.failures.length} failures shown*`,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
99
69
|
}
|
|
100
70
|
return [
|
|
101
71
|
{
|
|
@@ -108,12 +108,15 @@ class SlackReporter {
|
|
|
108
108
|
// eslint-disable-next-line no-console
|
|
109
109
|
console.log(JSON.stringify(result, null, 2));
|
|
110
110
|
if (this.showInThread && resultSummary.failures.length > 0) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
for (let i = 0; i < result.length; i += 1) {
|
|
112
|
+
// eslint-disable-next-line no-await-in-loop
|
|
113
|
+
await slackClient.attachDetailsToThread({
|
|
114
|
+
channelIds: [result[i].channel],
|
|
115
|
+
ts: result[i].ts,
|
|
116
|
+
summaryResults: resultSummary,
|
|
117
|
+
maxNumberOfFailures: this.maxNumberOfFailuresToShow,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
117
120
|
}
|
|
118
121
|
}
|
|
119
122
|
}
|
|
@@ -25,7 +25,7 @@ const generateCustomLayout = (summaryResults) => {
|
|
|
25
25
|
type: 'section',
|
|
26
26
|
text: {
|
|
27
27
|
type: 'mrkdwn',
|
|
28
|
-
text: '
|
|
28
|
+
text: '*⚠️ There are too many failures to display, view the full results in BuildKite*',
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
break;
|
package/package.json
CHANGED