ci-slack-reporter 1.0.1 → 1.0.2

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 +5 -4
  2. 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
- "attachments": [
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",
@@ -105,7 +105,8 @@ class MyReporter {
105
105
  )
106
106
  }
107
107
 
108
- out.attachments[0].blocks[0].text.text = `Tests finished ${stats.passes}/${stats.passes + stats.failures}`
108
+ out.attachments[0].blocks[0].text.text = `Tests finished ${stats.passes}/${stats.passes + stats.failures}`;
109
+ out.attachments[0].color = stats.failures ? "#FF0000" : "#00FF00";
109
110
  webhook.send({
110
111
  text: out,
111
112
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ci-slack-reporter",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {