@testomatio/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.
package/lib/client.js CHANGED
@@ -7,7 +7,6 @@ const { randomUUID } = require('crypto');
7
7
  const upload = require('./fileUploader');
8
8
  const { APP_PREFIX } = require('./constants');
9
9
  const pipesFactory = require('./pipe');
10
- const logger = require('./logger');
11
10
 
12
11
  /**
13
12
  * @typedef {import('../types').TestData} TestData
@@ -39,7 +38,7 @@ class Client {
39
38
  */
40
39
  createRun() {
41
40
  // all pipes disabled, skipping
42
- if (!this.pipes || !this.pipes.filter(p => p.isEnabled).length) return Promise.resolve();
41
+ if (!this.pipes?.filter(p => p.isEnabled).length) return Promise.resolve();
43
42
 
44
43
  const runParams = {
45
44
  title: this.title,
@@ -68,7 +67,7 @@ class Client {
68
67
  */
69
68
  async addTestRun(status, testData, storeArtifacts = []) {
70
69
  // all pipes disabled, skipping
71
- if (!this.pipes?.filter(p => p.isEnabled).length) return;
70
+ if (!this.pipes?.filter(p => p.isEnabled).length) return [];
72
71
 
73
72
  if (!testData)
74
73
  testData = {
@@ -103,6 +102,7 @@ class Client {
103
102
  stack = this.formatSteps(stack, steps);
104
103
  }
105
104
 
105
+ const logger = require('./logger');
106
106
  const testLogs = logger.getLogs(test_id);
107
107
  debug(`Test logs for ${test_id}:\n`, testLogs);
108
108
  if (stack) stack += '\n\n';
@@ -150,17 +150,19 @@ class Client {
150
150
  artifacts,
151
151
  };
152
152
 
153
- this.queue = this.queue
154
- .then(() => Promise.all(this.pipes.map(async p => {
155
- try {
156
- const result = await p.addTest(data);
157
- return { pipe: p.toString(), result };
158
- } catch (err) {
159
- console.log(APP_PREFIX, p.toString(), err);
160
- }
161
- }
162
- )));
163
-
153
+ this.queue = this.queue.then(() =>
154
+ Promise.all(
155
+ this.pipes.map(async p => {
156
+ try {
157
+ const result = await p.addTest(data);
158
+ return { pipe: p.toString(), result };
159
+ } catch (err) {
160
+ console.log(APP_PREFIX, p.toString(), err);
161
+ }
162
+ }),
163
+ ),
164
+ );
165
+
164
166
  return this.queue;
165
167
  }
166
168
 
package/lib/util.js CHANGED
@@ -12,7 +12,9 @@ const debug = require('debug')('@testomatio/reporter:util');
12
12
  */
13
13
  const parseTest = testTitle => {
14
14
  if (!testTitle) return null;
15
+
15
16
  const captures = testTitle.match(/@T([\w\d]+)/);
17
+
16
18
  if (captures) {
17
19
  return captures[1];
18
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",