@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 +5 -0
- package/lib/adapter/cypress-plugin/index.js +15 -3
- package/lib/client.js +1 -1
- package/package.json +1 -1
package/Changelog.md
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|