@testomatio/reporter 0.8.0-beta.12 → 0.8.0-beta.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.
package/lib/client.js CHANGED
@@ -44,7 +44,7 @@ class TestomatClient {
44
44
 
45
45
  global.testomatioArtifacts = [];
46
46
 
47
- this.queue = this.queue.then(() => Promise.all(this.pipes.map(p => p.createRun(runParams))));
47
+ this.queue = this.queue.then(() => Promise.all(this.pipes.map(p => p.createRun(runParams)))).catch(err => console.log(APP_PREFIX, err));;
48
48
 
49
49
  return this.queue;
50
50
  }
@@ -121,7 +121,7 @@ class TestomatClient {
121
121
  artifacts,
122
122
  };
123
123
 
124
- this.queue = this.queue.then(() => Promise.all(this.pipes.map(p => p.addTest(data))));
124
+ this.queue = this.queue.then(() => Promise.all(this.pipes.map(p => p.addTest(data)))).catch(err => console.log(APP_PREFIX, err));;
125
125
  return this.queue;
126
126
  }
127
127
 
@@ -141,7 +141,7 @@ class TestomatClient {
141
141
  if (isParallel) statusEvent += '_parallel';
142
142
  const runParams = { status, statusEvent }
143
143
 
144
- this.queue = this.queue.then(() => Promise.all(this.pipes.map(p => p.finishRun(runParams))));
144
+ this.queue = this.queue.then(() => Promise.all(this.pipes.map(p => p.finishRun(runParams)))).catch(err => console.log(APP_PREFIX, err));;
145
145
 
146
146
  if (upload.isArtifactsEnabled && this.totalUploaded > 0) {
147
147
  console.log(
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const chalk = require('chalk');
3
+ const humanizeDuration = require("humanize-duration");
3
4
  const merge = require('lodash.merge');
4
5
  const { Octokit } = require("@octokit/rest");
5
6
  const { APP_PREFIX } = require('../constants');
@@ -69,13 +70,12 @@ class GitHubPipe {
69
70
  const skippedCount = this.tests.filter(t => t.status === 'skipped').length;
70
71
 
71
72
  let summary = `
72
- ### Run Report
73
73
 
74
- | | ${statusEmoji(runParams.status)} ${runParams.status.toUpperCase()} ${statusEmoji(runParams.status)} |
74
+ | [![Testomat.io Report](https://avatars.githubusercontent.com/u/59105116?s=36&v=4)](https://testomat.io) | ${statusEmoji(runParams.status)} ${runParams.status.toUpperCase()} ${statusEmoji(runParams.status)} |
75
75
  | --- | --- |
76
76
  | Tests | ✔️ **${this.tests.length}** tests run |
77
77
  | Summary | ${statusEmoji('failed')} **${failedCount}** failed; ${statusEmoji('passed')} **${passedCount}** passed; **${statusEmoji('skipped')}** ${skippedCount} skipped |
78
- | Duration | 🕐 **${parseFloat(this.tests.reduce((a, t) => a + (t.run_time || 0), 0)).toFixed(2)}**ms |
78
+ | Duration | 🕐 **${humanizeDuration(parseFloat(this.tests.reduce((a, t) => a + (t.run_time || 0), 0)))}** |
79
79
  `
80
80
  if (this.store.runUrl) {
81
81
  summary += `| Testomat.io Report | 📊 [Run #${this.store.runId}](${this.store.runUrl}) | `;
@@ -128,7 +128,7 @@ class GitHubPipe {
128
128
  if (this.tests.length > 0) {
129
129
  body += "<details>\n<summary><h3>🐢 Slowest Tests</h3></summary>\n\n"
130
130
  body += this.tests.sort((a, b) => b?.run_time - a?.run_time).slice(0, 5).map(t => {
131
- return `* ${fullName(t)} (${parseFloat(t.run_time).toFixed(2)}ms)`
131
+ return `* ${fullName(t)} (${humanizeDuration(parseFloat(t.run_time))})`
132
132
  }).join('\n')
133
133
  body += "\n</details>"
134
134
  }
package/lib/util.js CHANGED
@@ -137,7 +137,14 @@ const fetchSourceCode = (contents, opts = {}) => {
137
137
  }
138
138
  }
139
139
 
140
- const isSameTest = (test, t) => t.title == test.title && t.suite_title == test.suite_title && Object.values(t.example) == Object.values(test.example) && t.test_id == test.test_id
140
+ const isSameTest = (test, t) => {
141
+ return (typeof t === 'object')
142
+ && (typeof test === 'object')
143
+ && t.title == test.title
144
+ && t.suite_title == test.suite_title
145
+ && Object.values(t.example || {}) == Object.values(test.example || {})
146
+ && t.test_id == test.test_id
147
+ };
141
148
 
142
149
  module.exports = {
143
150
  parseTest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.8.0-beta.12",
3
+ "version": "0.8.0-beta.15",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "repository": "git@github.com:testomatio/reporter.git",
@@ -17,6 +17,7 @@
17
17
  "fast-xml-parser": "^4.0.8",
18
18
  "glob": "^8.0.3",
19
19
  "has-flag": "^5.0.1",
20
+ "humanize-duration": "^3.27.3",
20
21
  "is-valid-path": "^0.1.1",
21
22
  "json-cycle": "^1.3.0",
22
23
  "lodash.memoize": "^4.1.2",
@@ -41,7 +42,6 @@
41
42
  "test:adapter:codecept:example": "codeceptjs run --config='./tests/adapter/examples/codecept/codecept.conf.js'",
42
43
  "test:adapter:cucumber:example": "cd ./tests/adapter/examples/cucumber && npx cucumber-js"
43
44
  },
44
- "peerDependencies": {},
45
45
  "devDependencies": {
46
46
  "@cucumber/cucumber": "^8.6.0",
47
47
  "@wdio/reporter": "^7.16.13",