ci-slack-reporter 1.0.3 → 1.0.6

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.
Files changed (2) hide show
  1. package/index.js +14 -23
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -31,6 +31,7 @@ class MyReporter {
31
31
  runner
32
32
  .once(EVENT_RUN_BEGIN, () => {
33
33
  out = {
34
+ // icon_emoji: ":robot_face:",
34
35
  attachments: [
35
36
  {
36
37
  "color": "#ff0000",
@@ -81,32 +82,22 @@ class MyReporter {
81
82
  })
82
83
  })
83
84
  .once(EVENT_RUN_END, () => {
84
- if (process.env.CI_SLACK_REPORTER_VIDEO_URL) {
85
- out.attachments[0].blocks.push(
86
- {
87
- "type": "section",
88
- "text": {
89
- "type": "plain_text",
90
- "text": " ",
91
- "emoji": true
92
- },
93
- "accessory": {
94
- "type": "button",
95
- "text": {
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
+ if (process.env.CI_SLACK_REPORTER_VIDEO_URL && stats.failures) {
86
+ out.attachments[0].blocks[0].accessory = {
87
+ "type": "button",
88
+ "text": {
89
+ "type": "plain_text",
90
+ "text": "Video recording",
91
+ "emoji": true
92
+ },
93
+ "value": "click_me_123",
94
+ "url": process.env.CI_SLACK_REPORTER_VIDEO_URL,
95
+ "action_id": "button-action"
96
+ }
106
97
  }
107
98
 
108
99
  out.attachments[0].blocks[0].text.text = `Tests finished ${stats.passes}/${stats.passes + stats.failures}`;
109
- out.attachments[0].color = stats.failures ? "#FF0000" : "#00FF00";
100
+ out.attachments[0].color = stats.failures ? "#a30200" : "#2eb886";
110
101
  webhook.send(out)
111
102
  });
112
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ci-slack-reporter",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {