ci-slack-reporter 1.0.7-a5 → 1.0.9
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/README.md +3 -3
- package/index.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -17,12 +17,12 @@ pipeline:
|
|
17
17
|
- npm install ci-slack-reporter
|
18
18
|
- export CI_SLACK_REPORTER_ICON_URL=https://raw.githubusercontent.com/devforth/ci-slack-reporter/master/assets/patron_autotester.png
|
19
19
|
- export CI_SLACK_REPORTER_USERNAME="Patron Autotester"
|
20
|
-
- export CI_SLACK_REPORTER_VIDEO_URL=https
|
21
|
-
- export CI_SLACK_REPORTER_WEBHOOK=https://hooks.slack.com/services
|
20
|
+
- export CI_SLACK_REPORTER_VIDEO_URL=https://<bucket name>.s3.eu-central-1.amazonaws.com/output${CI_BUILD_NUMBER}.mp4
|
21
|
+
- export CI_SLACK_REPORTER_WEBHOOK=https://hooks.slack.com/services<your slack webhook>
|
22
22
|
- cypress run --reporter ci-slack-reporter --spec "cypress/e2e/$${TEST_NAME}.cy.js"
|
23
23
|
|
24
24
|
```
|
25
25
|
|
26
26
|
Result:
|
27
27
|
|
28
|
-

|
28
|
+

|
package/index.js
CHANGED
@@ -17,6 +17,7 @@ const {
|
|
17
17
|
if (!process.env.CI_SLACK_REPORTER_WEBHOOK) {
|
18
18
|
console.error('CI_SLACK_REPORTER_WEBHOOK env variable is not set, reported will not work, please do export CI_SLACK_REPORTER_WEBHOOK=...')
|
19
19
|
}
|
20
|
+
const fails_only_webhook = process.env.CI_SLACK_REPORTER_FAILS_ONLY_WEBHOOK && new IncomingWebhook(process.env.CI_SLACK_REPORTER_FAILS_ONLY_WEBHOOK);
|
20
21
|
|
21
22
|
const webhook = new IncomingWebhook(process.env.CI_SLACK_REPORTER_WEBHOOK);
|
22
23
|
|
@@ -106,6 +107,13 @@ class MyReporter {
|
|
106
107
|
out.attachments[0].blocks[0].text.text = `Tests finished ${stats.passes}/${stats.passes + stats.failures}`;
|
107
108
|
out.attachments[0].color = stats.failures ? "#a30200" : "#2eb886";
|
108
109
|
webhook.send(out)
|
110
|
+
if (stats.failures) {
|
111
|
+
out.attachments[0].blocks = out.attachments[0].blocks.filter(el => {
|
112
|
+
return !el?.text?.text?.startsWith(":white")
|
113
|
+
|
114
|
+
})
|
115
|
+
fails_only_webhook?.send(out)
|
116
|
+
}
|
109
117
|
});
|
110
118
|
}
|
111
119
|
|
@@ -122,4 +130,4 @@ class MyReporter {
|
|
122
130
|
}
|
123
131
|
}
|
124
132
|
|
125
|
-
module.exports = MyReporter;
|
133
|
+
module.exports = MyReporter;
|