@testomatio/reporter 1.5.1 → 1.5.3-beta1-duation

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.
@@ -216,10 +216,11 @@ class TestomatioPipe {
216
216
  process.env.runId = this.runId;
217
217
  debug('Run created', this.runId);
218
218
  } catch (err) {
219
+ const errorInfo = `${err?.response?.statusText} ${chalk.red(err?.status)} ${err.message}`;
219
220
  console.error(
220
221
  APP_PREFIX,
221
- 'Error creating Testomat.io report, please check if your API key is valid. Skipping report | ',
222
- err?.response?.statusText || err?.status || err.message,
222
+ 'Error creating Testomat.io report, please check if your API key is valid. Skipping report\n',
223
+ errorInfo || JSON.stringify(err),
223
224
  );
224
225
  printCreateIssue(err);
225
226
  }
@@ -398,6 +399,7 @@ class TestomatioPipe {
398
399
  await this.axios.put(`/api/reporter/${this.runId}`, {
399
400
  api_key: this.apiKey,
400
401
  status_event,
402
+ duration: params.duration,
401
403
  tests: params.tests,
402
404
  });
403
405
  if (this.runUrl) {
package/lib/xmlReader.js CHANGED
@@ -107,7 +107,7 @@ class XmlReader {
107
107
  }
108
108
 
109
109
  processJUnit(jsonSuite) {
110
- const { testsuite, name, tests, failures, errors } = jsonSuite;
110
+ const { testsuite, name, tests, failures, errors, time } = jsonSuite;
111
111
 
112
112
  reduceOptions.preferClassname = this.stats.language === 'python';
113
113
  const resultTests = processTestSuite(testsuite);
@@ -115,12 +115,18 @@ class XmlReader {
115
115
  const hasFailures = resultTests.filter(t => t.status === 'failed').length > 0;
116
116
  const status = failures > 0 || errors > 0 || hasFailures ? 'failed' : 'passed';
117
117
 
118
+ if (time) {
119
+ if (!this.stats.duration) this.stats.duration = 0;
120
+ this.stats.duration += parseFloat(time);
121
+ }
122
+
118
123
  this.tests = this.tests.concat(resultTests);
119
124
 
120
125
  return {
121
126
  status,
122
127
  create_tests: true,
123
128
  name,
129
+ duration: parseFloat(time),
124
130
  tests_count: parseInt(tests, 10),
125
131
  passed_count: parseInt(tests, 10) - parseInt(failures, 10),
126
132
  failed_count: parseInt(failures, 10),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.5.1",
3
+ "version": "1.5.3-beta1-duation",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",