@testomatio/reporter 1.5.2 → 1.5.3

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,11 +216,14 @@ 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
+ console.info('-'.repeat(33), 'error', '-'.repeat(33));
220
+ console.log(err);
221
+ console.info('-'.repeat(33), 'error', '-'.repeat(33));
222
+ if (!this.apiKey) console.error('Testomat.io API key is not set');
223
+ if (!this.apiKey?.startsWith('tstmt')) console.error('Testomat.io API key is invalid');
220
224
  console.error(
221
225
  APP_PREFIX,
222
- 'Error creating Testomat.io report, please check if your API key is valid. Skipping report\n',
223
- errorInfo || JSON.stringify(err),
226
+ 'Error creating Testomat.io report (see details above), please check if your API key is valid. Skipping report\n'
224
227
  );
225
228
  printCreateIssue(err);
226
229
  }
@@ -399,6 +402,7 @@ class TestomatioPipe {
399
402
  await this.axios.put(`/api/reporter/${this.runId}`, {
400
403
  api_key: this.apiKey,
401
404
  status_event,
405
+ duration: params.duration,
402
406
  tests: params.tests,
403
407
  });
404
408
  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.2",
3
+ "version": "1.5.3",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",