@testomatio/reporter 1.2.0 → 1.2.1-beta.codecept-id
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/README.md +45 -51
- package/lib/adapter/codecept.js +1 -14
- package/lib/adapter/cucumber/legacy.js +1 -1
- package/lib/adapter/cucumber.js +2 -2
- package/lib/adapter/jest.js +1 -1
- package/lib/adapter/mocha.js +4 -6
- package/lib/adapter/playwright.js +1 -1
- package/lib/bin/reportXml.js +13 -13
- package/lib/bin/startTest.js +10 -11
- package/lib/constants.js +8 -5
- package/lib/fileUploader.js +29 -33
- package/lib/junit-adapter/adapter.js +0 -2
- package/lib/junit-adapter/csharp.js +3 -4
- package/lib/junit-adapter/index.js +2 -3
- package/lib/junit-adapter/java.js +11 -11
- package/lib/junit-adapter/javascript.js +1 -2
- package/lib/junit-adapter/python.js +12 -14
- package/lib/junit-adapter/ruby.js +1 -2
- package/lib/pipe/csv.js +2 -3
- package/lib/pipe/github.js +4 -3
- package/lib/pipe/gitlab.js +14 -7
- package/lib/pipe/html.js +0 -1
- package/lib/pipe/index.js +1 -1
- package/lib/template/testomatio.hbs +362 -724
- package/lib/utils/pipe_utils.js +70 -77
- package/lib/utils/utils.js +33 -32
- package/package.json +4 -2
|
@@ -2,14 +2,13 @@ const path = require('path');
|
|
|
2
2
|
const Adapter = require('./adapter');
|
|
3
3
|
|
|
4
4
|
class JavaAdapter extends Adapter {
|
|
5
|
-
|
|
6
5
|
getFilePath(t) {
|
|
7
|
-
const fileName = namespaceToFileName(t.suite_title)
|
|
6
|
+
const fileName = namespaceToFileName(t.suite_title);
|
|
8
7
|
return this.opts.javaTests + path.sep + fileName;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
formatTest(t) {
|
|
12
|
-
const fileParts = t.suite_title.split('.')
|
|
11
|
+
const fileParts = t.suite_title.split('.');
|
|
13
12
|
|
|
14
13
|
t.file = namespaceToFileName(t.suite_title);
|
|
15
14
|
t.title = t.title.split('(')[0];
|
|
@@ -21,19 +20,21 @@ class JavaAdapter extends Adapter {
|
|
|
21
20
|
const params = paramMatches.map((_match, index) => `param${index + 1}`);
|
|
22
21
|
if (params.length === 1) params[0] = 'param';
|
|
23
22
|
let paramIndex = 0;
|
|
24
|
-
|
|
23
|
+
|
|
25
24
|
t.title = t.title.replace(/: \[(.*?)\]/g, () => {
|
|
26
|
-
if (params.length < 2) return `\${param}
|
|
25
|
+
if (params.length < 2) return `\${param}`;
|
|
27
26
|
const paramName = params[paramIndex] || `param${paramIndex + 1}`;
|
|
28
27
|
paramIndex++;
|
|
29
28
|
return `\${${paramName}}`;
|
|
30
29
|
});
|
|
31
30
|
const example = {};
|
|
32
|
-
paramMatches.forEach((match, index) => {
|
|
31
|
+
paramMatches.forEach((match, index) => {
|
|
32
|
+
example[params[index]] = match.replace(/[[\]]/g, '');
|
|
33
|
+
});
|
|
33
34
|
t.example = example;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
t.suite_title = fileParts[fileParts.length - 1].replace(/\$/g, ' | ')
|
|
37
|
+
t.suite_title = fileParts[fileParts.length - 1].replace(/\$/g, ' | ');
|
|
37
38
|
return t;
|
|
38
39
|
}
|
|
39
40
|
|
|
@@ -49,10 +50,9 @@ class JavaAdapter extends Adapter {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
function namespaceToFileName(fileName) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const fileParts = fileName.split('.');
|
|
54
|
+
fileParts[fileParts.length - 1] = fileParts[fileParts.length - 1]?.replace(/\$.*/, '');
|
|
55
|
+
return `${fileParts.join(path.sep)}.java`;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
module.exports = JavaAdapter;
|
|
@@ -3,12 +3,11 @@ const path = require('path');
|
|
|
3
3
|
const Adapter = require('./adapter');
|
|
4
4
|
|
|
5
5
|
class JavaScriptAdapter extends Adapter {
|
|
6
|
-
|
|
7
6
|
formatStack(t) {
|
|
8
7
|
let stack = super.formatStack(t);
|
|
9
8
|
|
|
10
9
|
try {
|
|
11
|
-
const error = new Error(stack.split('\n')[0])
|
|
10
|
+
const error = new Error(stack.split('\n')[0]);
|
|
12
11
|
error.stack = stack;
|
|
13
12
|
const record = createCallsiteRecord({
|
|
14
13
|
forError: error,
|
|
@@ -3,7 +3,6 @@ const fs = require('fs');
|
|
|
3
3
|
const Adapter = require('./adapter');
|
|
4
4
|
|
|
5
5
|
class PythonAdapter extends Adapter {
|
|
6
|
-
|
|
7
6
|
getFilePath(t) {
|
|
8
7
|
let fileName = namespaceToFileName(t.suite_title, { checkFile: true });
|
|
9
8
|
if (!fileName) fileName = namespaceToFileName(t.suite_title, { checkFile: false });
|
|
@@ -11,34 +10,33 @@ class PythonAdapter extends Adapter {
|
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
formatTest(t) {
|
|
14
|
-
const fileParts = t.suite_title.split('.')
|
|
13
|
+
const fileParts = t.suite_title.split('.');
|
|
15
14
|
const example = t.title.match(/\[(.*)\]/)?.[1];
|
|
16
|
-
if (example) t.example = {
|
|
15
|
+
if (example) t.example = { '#': example };
|
|
17
16
|
|
|
18
17
|
t.file = namespaceToFileName(t.suite_title);
|
|
19
18
|
t.title = t.title.split('[')[0];
|
|
20
|
-
t.suite_title = fileParts[fileParts.length - 1].replace(/\$/g, ' | ')
|
|
19
|
+
t.suite_title = fileParts[fileParts.length - 1].replace(/\$/g, ' | ');
|
|
21
20
|
return t;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
formatMessage(t) {
|
|
25
24
|
return t.message.split(' ')[0];
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
function namespaceToFileName(fileName, opts = {}) {
|
|
31
|
-
|
|
29
|
+
const fileParts = fileName.split('.');
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
fileParts.pop();
|
|
31
|
+
while (fileParts.length > 0) {
|
|
32
|
+
const file = `${fileParts.join(path.sep)}.py`;
|
|
33
|
+
if (!opts.checkFile) return file;
|
|
34
|
+
if (fs.existsSync(`${fileParts.join(path.sep)}.py`)) {
|
|
35
|
+
return file;
|
|
40
36
|
}
|
|
41
|
-
|
|
37
|
+
fileParts.pop();
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
module.exports = PythonAdapter;
|
package/lib/pipe/csv.js
CHANGED
|
@@ -14,7 +14,6 @@ const { CSV_HEADERS } = require('../constants');
|
|
|
14
14
|
* @implements {Pipe}
|
|
15
15
|
*/
|
|
16
16
|
class CsvPipe {
|
|
17
|
-
|
|
18
17
|
constructor(params, store) {
|
|
19
18
|
this.store = store || {};
|
|
20
19
|
this.title = params.title || process.env.TESTOMATIO_TITLE;
|
|
@@ -22,7 +21,7 @@ class CsvPipe {
|
|
|
22
21
|
|
|
23
22
|
this.outputDir = 'export';
|
|
24
23
|
this.csvFilename = process.env.TESTOMATIO_CSV_FILENAME;
|
|
25
|
-
this.isEnabled = !!this.csvFilename
|
|
24
|
+
this.isEnabled = !!this.csvFilename;
|
|
26
25
|
this.isCsvSave = false;
|
|
27
26
|
|
|
28
27
|
if (this.csvFilename !== undefined && this.csvFilename.split('.').length > 0) {
|
|
@@ -42,7 +41,7 @@ class CsvPipe {
|
|
|
42
41
|
|
|
43
42
|
// TODO: to using SET opts as argument => prepareRun(opts)
|
|
44
43
|
async prepareRun() {}
|
|
45
|
-
|
|
44
|
+
|
|
46
45
|
async createRun() {
|
|
47
46
|
// empty
|
|
48
47
|
}
|
package/lib/pipe/github.js
CHANGED
|
@@ -4,7 +4,7 @@ const chalk = require('chalk');
|
|
|
4
4
|
const humanizeDuration = require('humanize-duration');
|
|
5
5
|
const merge = require('lodash.merge');
|
|
6
6
|
const { Octokit } = require('@octokit/rest');
|
|
7
|
-
const { APP_PREFIX } = require('../constants');
|
|
7
|
+
const { APP_PREFIX, testomatLogoURL } = require('../constants');
|
|
8
8
|
const { ansiRegExp, isSameTest } = require('../utils/utils');
|
|
9
9
|
const { statusEmoji, fullName } = require('../utils/pipe_utils');
|
|
10
10
|
|
|
@@ -77,8 +77,9 @@ class GitHubPipe {
|
|
|
77
77
|
|
|
78
78
|
let summary = `${this.hiddenCommentData}
|
|
79
79
|
|
|
80
|
-
| [](https://testomat.io) | ${statusEmoji(
|
|
81
|
+
runParams.status,
|
|
82
|
+
)} ${`${process.env.GITHUB_JOB} ${runParams.status}`.toUpperCase()} |
|
|
82
83
|
| --- | --- |
|
|
83
84
|
| Tests | ✔️ **${this.tests.length}** tests run |
|
|
84
85
|
| Summary | ${failedCount ? `${statusEmoji('failed')} **${failedCount}** failed; ` : ''} ${statusEmoji(
|
package/lib/pipe/gitlab.js
CHANGED
|
@@ -4,7 +4,7 @@ const chalk = require('chalk');
|
|
|
4
4
|
const humanizeDuration = require('humanize-duration');
|
|
5
5
|
const merge = require('lodash.merge');
|
|
6
6
|
const path = require('path');
|
|
7
|
-
const { APP_PREFIX } = require('../constants');
|
|
7
|
+
const { APP_PREFIX, testomatLogoURL } = require('../constants');
|
|
8
8
|
const { ansiRegExp, isSameTest } = require('../utils/utils');
|
|
9
9
|
const { statusEmoji, fullName } = require('../utils/pipe_utils');
|
|
10
10
|
|
|
@@ -77,17 +77,24 @@ class GitLabPipe {
|
|
|
77
77
|
|
|
78
78
|
// constructing the table
|
|
79
79
|
let summary = `${this.hiddenCommentData}
|
|
80
|
-
|
|
81
|
-
| [](https://testomat.io) | ${statusEmoji(
|
|
82
|
+
runParams.status,
|
|
83
|
+
)} ${runParams.status.toUpperCase()} ${statusEmoji(runParams.status)} |
|
|
83
84
|
| --- | --- |
|
|
84
85
|
| Tests | ✔️ **${this.tests.length}** tests run |
|
|
85
86
|
| Summary | ${statusEmoji('failed')} **${failedCount}** failed; ${statusEmoji(
|
|
86
87
|
'passed',
|
|
87
88
|
)} **${passedCount}** passed; **${statusEmoji('skipped')}** ${skippedCount} skipped |
|
|
88
|
-
| Duration | 🕐 **${humanizeDuration(
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
| Duration | 🕐 **${humanizeDuration(
|
|
90
|
+
parseInt(
|
|
91
|
+
this.tests.reduce((a, t) => a + (t.run_time || 0), 0),
|
|
92
|
+
10,
|
|
93
|
+
),
|
|
94
|
+
{
|
|
95
|
+
maxDecimalPoints: 0,
|
|
96
|
+
},
|
|
97
|
+
)}** |
|
|
91
98
|
`;
|
|
92
99
|
|
|
93
100
|
if (this.ENV.CI_JOB_NAME && this.ENV.CI_JOB_ID) {
|
package/lib/pipe/html.js
CHANGED
|
@@ -210,7 +210,6 @@ class HtmlPipe {
|
|
|
210
210
|
);
|
|
211
211
|
|
|
212
212
|
handlebars.registerHelper('json', tests => {
|
|
213
|
-
|
|
214
213
|
// TODO: please refactor the code below, add meaningful variable names, separate into functions
|
|
215
214
|
function replaceScriptTagsInArray(array) {
|
|
216
215
|
return array.map(obj => {
|
package/lib/pipe/index.js
CHANGED