@testomatio/reporter 0.5.9 → 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,8 @@
1
+ # 0.5.10
2
+
3
+ * Fixed reporting Scenario Outline in Cypress-Cucumber
4
+ * Fixed error reports for Cypress when running in Chrome
5
+
1
6
  # 0.5.9
2
7
 
3
8
  * Added environment on Cypress report
@@ -3,6 +3,10 @@ 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
12
  on('before:run', async (run) => {
@@ -24,7 +28,12 @@ const testomatioReporter = on => {
24
28
  const time = latestAttempt.duration;
25
29
  const error = latestAttempt.error;
26
30
 
27
- 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
+
28
37
  const suiteTitle = test.title.pop();
29
38
 
30
39
  const testId = parseTest(title);
@@ -32,7 +41,10 @@ const testomatioReporter = on => {
32
41
 
33
42
  if (error) {
34
43
  error.inspect = function() {
35
- return this.codeFrame.frame;
44
+ if (this && this.codeFrame) {
45
+ return this.codeFrame.frame;
46
+ }
47
+ return '';
36
48
  }
37
49
  }
38
50
 
@@ -46,7 +58,7 @@ const testomatioReporter = on => {
46
58
  const state = test.state === 'passed' ? TRConstants.PASSED : TRConstants.FAILED;
47
59
 
48
60
  addSpecTestsPromises.push(client.addTestRun(testId, state, {
49
- title, time, error, files, suite_title: suiteTitle, suite_id: suiteId
61
+ title, time, example, error, files, suite_title: suiteTitle, suite_id: suiteId
50
62
  }));
51
63
  }
52
64
 
package/lib/client.js CHANGED
@@ -234,7 +234,7 @@ class TestomatClient {
234
234
 
235
235
  formatError(error, message) {
236
236
  if (!message) message = error.message;
237
- if (error.inspect) message = error.inspect();
237
+ if (error.inspect) message = error.inspect() || '';
238
238
 
239
239
  let stack = `\n${chalk.bold(message)}\n`;
240
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.5.9",
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",