ci-slack-reporter 1.0.9-a6 → 1.0.9-a8
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/index.js +14 -14
- package/package.json +1 -1
package/index.js
CHANGED
@@ -31,9 +31,9 @@ class MyReporter {
|
|
31
31
|
|
32
32
|
runner
|
33
33
|
.once(EVENT_RUN_BEGIN, () => {
|
34
|
-
console.log(`⚡runner ${runner.file}`);
|
34
|
+
console.log(`⚡runner ${runner.suite?.file}`);
|
35
35
|
|
36
|
-
out[runner.file] = {
|
36
|
+
out[runner.suite?.file] = {
|
37
37
|
attachments: [
|
38
38
|
{
|
39
39
|
"color": "#ff0000",
|
@@ -55,12 +55,12 @@ class MyReporter {
|
|
55
55
|
]
|
56
56
|
};
|
57
57
|
if (process.env.CI_SLACK_REPORTER_ICON_URL) {
|
58
|
-
out[runner.file].icon_url = process.env.CI_SLACK_REPORTER_ICON_URL;
|
58
|
+
out[runner.suite?.file].icon_url = process.env.CI_SLACK_REPORTER_ICON_URL;
|
59
59
|
} else {
|
60
|
-
out[runner.file].icon_emoji = ":robot:"
|
60
|
+
out[runner.suite?.file].icon_emoji = ":robot:"
|
61
61
|
}
|
62
62
|
|
63
|
-
out[runner.file].username = process.env.CI_SLACK_REPORTER_USERNAME || 'Autotester'
|
63
|
+
out[runner.suite?.file].username = process.env.CI_SLACK_REPORTER_USERNAME || 'Autotester'
|
64
64
|
|
65
65
|
})
|
66
66
|
.on(EVENT_SUITE_BEGIN, () => {
|
@@ -72,7 +72,7 @@ class MyReporter {
|
|
72
72
|
.on(EVENT_TEST_PASS, test => {
|
73
73
|
// Test#fullTitle() returns the suite name(s)
|
74
74
|
// prepended to the test title
|
75
|
-
out[runner.file].attachments[0].blocks.push({
|
75
|
+
out[runner.suite?.file].attachments[0].blocks.push({
|
76
76
|
"type": "section",
|
77
77
|
"text": {
|
78
78
|
"type": "plain_text",
|
@@ -82,7 +82,7 @@ class MyReporter {
|
|
82
82
|
})
|
83
83
|
})
|
84
84
|
.on(EVENT_TEST_FAIL, (test, err) => {
|
85
|
-
out[runner.file].attachments[0].blocks.push({
|
85
|
+
out[runner.suite?.file].attachments[0].blocks.push({
|
86
86
|
"type": "section",
|
87
87
|
"text": {
|
88
88
|
"type": "plain_text",
|
@@ -93,7 +93,7 @@ class MyReporter {
|
|
93
93
|
})
|
94
94
|
.once(EVENT_RUN_END, () => {
|
95
95
|
if (process.env.CI_SLACK_REPORTER_VIDEO_URL && stats.failures) {
|
96
|
-
out[runner.file].attachments[0].blocks[2].accessory = {
|
96
|
+
out[runner.suite?.file].attachments[0].blocks[2].accessory = {
|
97
97
|
"type": "button",
|
98
98
|
"text": {
|
99
99
|
"type": "plain_text",
|
@@ -106,16 +106,16 @@ class MyReporter {
|
|
106
106
|
}
|
107
107
|
}
|
108
108
|
|
109
|
-
out[runner.file].attachments[0].blocks[0].text.text = `Tests finished ${stats.passes}/${stats.passes + stats.failures}`;
|
110
|
-
out[runner.file].attachments[0].color = stats.failures ? "#a30200" : "#2eb886";
|
111
|
-
console.log(`⚡ webhook send ${runner.file} / ${process.env.CI_SLACK_REPORTER_WEBHOOK}`, JSON.stringify(out[runner.file]));
|
112
|
-
webhook.send(out[runner.file]);
|
109
|
+
out[runner.suite?.file].attachments[0].blocks[0].text.text = `Tests finished ${stats.passes}/${stats.passes + stats.failures}`;
|
110
|
+
out[runner.suite?.file].attachments[0].color = stats.failures ? "#a30200" : "#2eb886";
|
111
|
+
console.log(`⚡ webhook send ${runner.suite?.file} / ${process.env.CI_SLACK_REPORTER_WEBHOOK}`, JSON.stringify(out[runner.suite?.file]));
|
112
|
+
webhook.send(out[runner.suite?.file]);
|
113
113
|
|
114
114
|
if (stats.failures) {
|
115
|
-
out[runner.file].attachments[0].blocks = out[runner.file].attachments[0].blocks.filter(el => {
|
115
|
+
out[runner.suite?.file].attachments[0].blocks = out[runner.suite?.file].attachments[0].blocks.filter(el => {
|
116
116
|
return !el?.text?.text?.startsWith(":white")
|
117
117
|
})
|
118
|
-
fails_only_webhook?.send(out[runner.file])
|
118
|
+
fails_only_webhook?.send(out[runner.suite?.file])
|
119
119
|
}
|
120
120
|
});
|
121
121
|
}
|