ci-slack-reporter 1.0.1 → 1.0.4
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 +17 -28
- package/package.json +1 -1
package/index.js
CHANGED
@@ -31,7 +31,7 @@ class MyReporter {
|
|
31
31
|
runner
|
32
32
|
.once(EVENT_RUN_BEGIN, () => {
|
33
33
|
out = {
|
34
|
-
|
34
|
+
attachments: [
|
35
35
|
{
|
36
36
|
"color": "#ff0000",
|
37
37
|
"blocks": [
|
@@ -61,7 +61,7 @@ class MyReporter {
|
|
61
61
|
.on(EVENT_TEST_PASS, test => {
|
62
62
|
// Test#fullTitle() returns the suite name(s)
|
63
63
|
// prepended to the test title
|
64
|
-
attachments[0].blocks.push({
|
64
|
+
out.attachments[0].blocks.push({
|
65
65
|
"type": "section",
|
66
66
|
"text": {
|
67
67
|
"type": "plain_text",
|
@@ -71,7 +71,7 @@ class MyReporter {
|
|
71
71
|
})
|
72
72
|
})
|
73
73
|
.on(EVENT_TEST_FAIL, (test, err) => {
|
74
|
-
attachments[0].blocks.push({
|
74
|
+
out.attachments[0].blocks.push({
|
75
75
|
"type": "section",
|
76
76
|
"text": {
|
77
77
|
"type": "plain_text",
|
@@ -82,33 +82,22 @@ class MyReporter {
|
|
82
82
|
})
|
83
83
|
.once(EVENT_RUN_END, () => {
|
84
84
|
if (process.env.CI_SLACK_REPORTER_VIDEO_URL) {
|
85
|
-
out.attachments[0].blocks.
|
86
|
-
|
87
|
-
|
88
|
-
"
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
"type": "plain_text",
|
97
|
-
"text": "Video recording",
|
98
|
-
"emoji": true
|
99
|
-
},
|
100
|
-
"value": "click_me_123",
|
101
|
-
"url": process.env.CI_SLACK_REPORTER_VIDEO_URL,
|
102
|
-
"action_id": "button-action"
|
103
|
-
}
|
104
|
-
}
|
105
|
-
)
|
85
|
+
out.attachments[0].blocks[0].accessory = {
|
86
|
+
"type": "button",
|
87
|
+
"text": {
|
88
|
+
"type": "plain_text",
|
89
|
+
"text": "Video recording",
|
90
|
+
"emoji": true
|
91
|
+
},
|
92
|
+
"value": "click_me_123",
|
93
|
+
"url": process.env.CI_SLACK_REPORTER_VIDEO_URL,
|
94
|
+
"action_id": "button-action"
|
95
|
+
}
|
106
96
|
}
|
107
97
|
|
108
|
-
out.attachments[0].blocks[0].text.text = `Tests finished ${stats.passes}/${stats.passes + stats.failures}
|
109
|
-
|
110
|
-
|
111
|
-
})
|
98
|
+
out.attachments[0].blocks[0].text.text = `Tests finished ${stats.passes}/${stats.passes + stats.failures}`;
|
99
|
+
out.attachments[0].color = stats.failures ? "#FF0000" : "#00FF00";
|
100
|
+
webhook.send(out)
|
112
101
|
});
|
113
102
|
}
|
114
103
|
|