@testomatio/reporter 0.5.7 → 0.5.10

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/Changelog.md CHANGED
@@ -1,3 +1,16 @@
1
+ # 0.5.10
2
+
3
+ * Fixed reporting Scenario Outline in Cypress-Cucumber
4
+ * Fixed error reports for Cypress when running in Chrome
5
+
6
+ # 0.5.9
7
+
8
+ * Added environment on Cypress report
9
+
10
+ # 0.5.8
11
+
12
+ * Fixed Cypress.io reporting
13
+
1
14
  # 0.5.7
2
15
 
3
16
  * Fixed webdriverio artifacts
@@ -3,12 +3,15 @@ const { parseTest, parseSuite } = require('../../util');
3
3
  const TestomatClient = require('../../client');
4
4
 
5
5
  const testomatioReporter = on => {
6
+ if (!process.env.TESTOMATIO) {
7
+ console.log('TESTOMATIO key is empty, ignoring reports');
8
+ return
9
+ }
6
10
  const client = new TestomatClient({ apiKey: process.env.TESTOMATIO });
7
11
 
8
- on('before:run', async () => {
9
- if (!client.title) {
10
- client.title = `${run.config.projectName} tests @${run.browser.displayName} @${run.system.osName}`
11
- if (client.title.includes('undefined')) delete client.title;
12
+ on('before:run', async (run) => {
13
+ if (!client.env) {
14
+ client.env = `${run.browser.displayName},${run.system.osName}`
12
15
  }
13
16
  await client.createRun();
14
17
  });
@@ -25,7 +28,12 @@ const testomatioReporter = on => {
25
28
  const time = latestAttempt.duration;
26
29
  const error = latestAttempt.error;
27
30
 
28
- const title = test.title.pop();
31
+ let title = test.title.pop();
32
+ let examples = title.match(/\(example (#\d+)\)/);
33
+ let example = null;
34
+ if (examples && examples[1]) example = { example: examples[1] };
35
+ title = title.replace(/\(example #\d+\)/, '').trim();
36
+
29
37
  const suiteTitle = test.title.pop();
30
38
 
31
39
  const testId = parseTest(title);
@@ -33,7 +41,10 @@ const testomatioReporter = on => {
33
41
 
34
42
  if (error) {
35
43
  error.inspect = function() {
36
- return this.codeFrame.frame;
44
+ if (this && this.codeFrame) {
45
+ return this.codeFrame.frame;
46
+ }
47
+ return '';
37
48
  }
38
49
  }
39
50
 
@@ -47,7 +58,7 @@ const testomatioReporter = on => {
47
58
  const state = test.state === 'passed' ? TRConstants.PASSED : TRConstants.FAILED;
48
59
 
49
60
  addSpecTestsPromises.push(client.addTestRun(testId, state, {
50
- title, time, error, files, suite_title: suiteTitle, suite_id: suiteId
61
+ title, time, example, error, files, suite_title: suiteTitle, suite_id: suiteId
51
62
  }));
52
63
  }
53
64
 
package/lib/client.js CHANGED
@@ -25,6 +25,7 @@ class TestomatClient {
25
25
  this.apiKey = params.apiKey || process.env.TESTOMATIO;
26
26
  this.title = params.title || process.env.TESTOMATIO_TITLE;
27
27
  this.createNewTests = !!process.env.TESTOMATIO_CREATE
28
+ this.env = TESTOMATIO_ENV;
28
29
  this.parallel = params.parallel;
29
30
  this.runId = process.env.runId;
30
31
  this.queue = Promise.resolve();
@@ -45,8 +46,8 @@ class TestomatClient {
45
46
  api_key: this.apiKey.trim(),
46
47
  title: this.title,
47
48
  parallel: this.parallel,
49
+ env: this.env,
48
50
  group_title: TESTOMATIO_RUNGROUP_TITLE,
49
- env: TESTOMATIO_ENV,
50
51
  };
51
52
 
52
53
  global.testomatioArtifacts = [];
@@ -233,7 +234,7 @@ class TestomatClient {
233
234
 
234
235
  formatError(error, message) {
235
236
  if (!message) message = error.message;
236
- if (error.inspect) message = error.inspect();
237
+ if (error.inspect) message = error.inspect() || '';
237
238
 
238
239
  let stack = `\n${chalk.bold(message)}\n`;
239
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.5.7",
3
+ "version": "0.5.10",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "repository": "git@github.com:testomatio/reporter.git",