@testomatio/reporter 1.0.6 → 1.0.8

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.
@@ -73,6 +73,8 @@ function CodeceptReporter(config) {
73
73
  stepShift = 0;
74
74
  });
75
75
 
76
+ if (!global.testomatioDataStore) global.testomatioDataStore = {};
77
+ // reset steps
76
78
  global.testomatioDataStore.steps = [];
77
79
  });
78
80
 
@@ -162,7 +164,7 @@ function CodeceptReporter(config) {
162
164
  message: testObj.message,
163
165
  time: getDuration(test),
164
166
  files,
165
- steps: global.testomatioDataStore.steps.join('\n') || null,
167
+ steps: global.testomatioDataStore?.steps?.join('\n') || null,
166
168
  })
167
169
  .then(pipes => {
168
170
  testId = pipes.filter(p => p.pipe.includes('Testomatio'))[0]?.result?.data?.test_id;
@@ -219,12 +221,12 @@ function CodeceptReporter(config) {
219
221
  if (!metaSteps[i]) continue;
220
222
  if (metaSteps[i].isBDD()) {
221
223
  // output.push(repeat(stepShift) + chalk.bold(metaSteps[i].toString()) + metaSteps[i].comment);
222
- global.testomatioDataStore.steps.push(
224
+ global.testomatioDataStore?.steps?.push(
223
225
  repeat(stepShift) + chalk.bold(metaSteps[i].toString()) + metaSteps[i].comment,
224
226
  );
225
227
  } else {
226
228
  // output.push(repeat(stepShift) + chalk.green.bold(metaSteps[i].toString()));
227
- global.testomatioDataStore.steps.push(repeat(stepShift) + chalk.green.bold(metaSteps[i].toString()));
229
+ global.testomatioDataStore?.steps?.push(repeat(stepShift) + chalk.green.bold(metaSteps[i].toString()));
228
230
  }
229
231
  }
230
232
  }
@@ -239,16 +241,16 @@ function CodeceptReporter(config) {
239
241
 
240
242
  if (step.status === STATUS.FAILED) {
241
243
  // output.push(repeat(stepShift) + chalk.red(step.toString()) + duration);
242
- global.testomatioDataStore.steps.push(repeat(stepShift) + chalk.red(step.toString()) + duration);
244
+ global.testomatioDataStore?.steps?.push(repeat(stepShift) + chalk.red(step.toString()) + duration);
243
245
  } else {
244
246
  // output.push(repeat(stepShift) + step.toString() + duration);
245
- global.testomatioDataStore.steps.push(repeat(stepShift) + step.toString() + duration);
247
+ global.testomatioDataStore?.steps?.push(repeat(stepShift) + step.toString() + duration);
246
248
  }
247
249
  });
248
250
 
249
251
  event.dispatcher.on(event.step.comment, step => {
250
252
  // output.push(chalk.cyan.bold(step.toString()));
251
- global.testomatioDataStore.steps.push(chalk.cyan.bold(step.toString()));
253
+ global.testomatioDataStore?.steps?.push(chalk.cyan.bold(step.toString()));
252
254
  });
253
255
  }
254
256
 
@@ -69,7 +69,7 @@ class TestomatioPipe {
69
69
  buildUrl = `${collectionUri}/${project}/_build/results?buildId=${buildId}`;
70
70
  }
71
71
 
72
- if (!buildUrl.startsWith('http')) buildUrl = undefined;
72
+ if (buildUrl && !buildUrl.startsWith('http')) buildUrl = undefined;
73
73
 
74
74
  const runParams = Object.fromEntries(
75
75
  Object.entries({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",