ci-slack-reporter 1.0.13 → 1.0.15

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 +7 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -29,7 +29,7 @@ function splitIfBlocksLimit(obj) {
29
29
  while (obj.attachments[0].blocks.length != 0) {
30
30
  const deepClone = JSON.parse(JSON.stringify(obj))
31
31
  deepClone.attachments[0].blocks = deepClone.attachments[0].blocks.slice(0, SLACK_BLOCKS_LIMIT);
32
- ob.attachments[0].blocks.splice(0, SLACK_BLOCKS_LIMIT);
32
+ obj.attachments[0].blocks.splice(0, SLACK_BLOCKS_LIMIT);
33
33
  res.push(deepClone);
34
34
  }
35
35
  return res;
@@ -89,7 +89,7 @@ class MyReporter {
89
89
  "type": "section",
90
90
  "text": {
91
91
  "type": "plain_text",
92
- "text": `${out[filename].attachments[0].blocks.length} - :white_check_mark: ${test.fullTitle()}`,
92
+ "text": `${out[filename].attachments[0].blocks.length - 1} - :white_check_mark: ${test.fullTitle()}`,
93
93
  "emoji": true
94
94
  }
95
95
  })
@@ -99,7 +99,7 @@ class MyReporter {
99
99
  "type": "section",
100
100
  "text": {
101
101
  "type": "plain_text",
102
- "text": `${out[filename].attachments[0].blocks.length} - :no_entry: ${test.fullTitle()} - error: \`${err.message}\``,
102
+ "text": `${out[filename].attachments[0].blocks.length - 1} - :no_entry: ${test.fullTitle()} - error: \`${err.message}\``,
103
103
  "emoji": true
104
104
  }
105
105
  })
@@ -121,8 +121,10 @@ class MyReporter {
121
121
 
122
122
  out[filename].attachments[0].blocks[0].text.text = `Tests finished ${stats.passes}/${stats.passes + stats.failures}`;
123
123
  out[filename].attachments[0].color = stats.failures ? "#a30200" : "#2eb886";
124
- splitIfBlocksLimit(out[filename]).forEach((part) => {
125
- webhook.send(part);
124
+ (async () => {
125
+ for (const part of splitIfBlocksLimit(out[filename])) {
126
+ await webhook.send(part);
127
+ };
126
128
  });
127
129
 
128
130
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ci-slack-reporter",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Mocha/Cypress reporter to post tests results directly to Slack",
5
5
  "main": "index.js",
6
6
  "scripts": {