@testomatio/reporter 0.8.0-beta.31 → 0.8.0-beta.32
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/lib/ArtifactStorage.js +87 -88
- package/lib/adapter/codecept.js +24 -18
- package/lib/adapter/cucumber/current.js +16 -12
- package/lib/adapter/cucumber/legacy.js +14 -10
- package/lib/adapter/cypress-plugin/index.js +7 -7
- package/lib/adapter/jasmine.js +5 -4
- package/lib/adapter/jest.js +7 -11
- package/lib/adapter/mocha.js +14 -13
- package/lib/adapter/playwright.js +7 -4
- package/lib/adapter/webdriver.js +2 -1
- package/lib/bin/reportXml.js +0 -1
- package/lib/bin/startTest.js +2 -2
- package/lib/client.js +40 -34
- package/lib/constants.js +7 -3
- package/lib/fileUploader.js +1 -1
- package/lib/junit-adapter/csharp.js +0 -1
- package/lib/junit-adapter/index.js +3 -2
- package/lib/pipe/csv.js +18 -6
- package/lib/pipe/github.js +11 -4
- package/lib/pipe/gitlab.js +8 -4
- package/lib/pipe/index.js +5 -3
- package/lib/pipe/testomatio.js +45 -11
- package/lib/util.js +18 -18
- package/lib/xmlReader.js +15 -14
- package/package.json +5 -2
package/lib/util.js
CHANGED
|
@@ -7,7 +7,7 @@ const isValid = require('is-valid-path');
|
|
|
7
7
|
/**
|
|
8
8
|
* @param {String} testTitle - Test title
|
|
9
9
|
*
|
|
10
|
-
* @returns {String} testId
|
|
10
|
+
* @returns {String|null} testId
|
|
11
11
|
*/
|
|
12
12
|
const parseTest = testTitle => {
|
|
13
13
|
const captures = testTitle.match(/@T([\w\d]+)/);
|
|
@@ -21,7 +21,7 @@ const parseTest = testTitle => {
|
|
|
21
21
|
/**
|
|
22
22
|
* @param {String} suiteTitle - suite title
|
|
23
23
|
*
|
|
24
|
-
* @returns {String} suiteId
|
|
24
|
+
* @returns {String|null} suiteId
|
|
25
25
|
*/
|
|
26
26
|
const parseSuite = suiteTitle => {
|
|
27
27
|
const captures = suiteTitle.match(/@S([\w\d]+)/);
|
|
@@ -63,12 +63,12 @@ const fetchSourceCodeFromStackTrace = (stack = '') => {
|
|
|
63
63
|
// .map(l => l.match(/\[(.*?)\]/)?.[1] || l) // minitest format
|
|
64
64
|
// .map(l => l.split(':')[0])
|
|
65
65
|
.map(l => l.trim())
|
|
66
|
-
.map(l => l.split(' ').find(p => p.includes(':')))
|
|
67
|
-
.filter(l => isValid(l
|
|
66
|
+
.map(l => l.split(' ').find(p => p.includes(':')) || '')
|
|
67
|
+
.filter(l => isValid(l?.split(':')[0]))
|
|
68
68
|
|
|
69
69
|
// // filter out 3rd party libs
|
|
70
|
-
.filter(l => !l
|
|
71
|
-
.filter(l => !l
|
|
70
|
+
.filter(l => !l?.includes(`vendor${ sep}`))
|
|
71
|
+
.filter(l => !l?.includes(`node_modules${ sep}`))
|
|
72
72
|
.filter(l => fs.existsSync(l.split(':')[0]))
|
|
73
73
|
.filter(l => fs.lstatSync(l.split(':')[0]).isFile())
|
|
74
74
|
|
|
@@ -154,31 +154,31 @@ const getCurrentDateTime = () => {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
|
-
* @param {
|
|
157
|
+
* @param {Object} test - Test adapter object
|
|
158
158
|
*
|
|
159
|
-
* @returns {String} testInfo as one string
|
|
159
|
+
* @returns {String|null} testInfo as one string
|
|
160
160
|
*/
|
|
161
161
|
const specificTestInfo = test => {
|
|
162
|
-
//TODO: afterEach has another context.... need to add specific handler, maybe...
|
|
162
|
+
// TODO: afterEach has another context.... need to add specific handler, maybe...
|
|
163
163
|
if (test?.title && test?.file) {
|
|
164
164
|
|
|
165
|
-
return basename(test.file).split(".").join("#")
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
return `${basename(test.file).split(".").join("#")
|
|
166
|
+
}#${
|
|
167
|
+
test.title.split(" ").join("#")}`;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
return null;
|
|
171
171
|
};
|
|
172
172
|
|
|
173
173
|
module.exports = {
|
|
174
|
-
parseTest,
|
|
175
|
-
parseSuite,
|
|
176
|
-
ansiRegExp,
|
|
177
174
|
isSameTest,
|
|
178
|
-
isValidUrl,
|
|
179
175
|
fetchSourceCode,
|
|
180
176
|
fetchSourceCodeFromStackTrace,
|
|
181
177
|
fetchFilesFromStackTrace,
|
|
182
178
|
getCurrentDateTime,
|
|
183
|
-
specificTestInfo
|
|
184
|
-
|
|
179
|
+
specificTestInfo,
|
|
180
|
+
isValidUrl,
|
|
181
|
+
ansiRegExp,
|
|
182
|
+
parseTest,
|
|
183
|
+
parseSuite
|
|
184
|
+
}
|
package/lib/xmlReader.js
CHANGED
|
@@ -2,15 +2,14 @@ const debug = require('debug')('@testomatio/reporter:xml');
|
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const chalk = require('chalk');
|
|
4
4
|
const fs = require("fs");
|
|
5
|
-
|
|
6
|
-
// const util = require("util"); // you can see a result
|
|
7
5
|
const { XMLParser } = require("fast-xml-parser");
|
|
8
|
-
const { APP_PREFIX,
|
|
6
|
+
const { APP_PREFIX, STATUS } = require('./constants');
|
|
9
7
|
const { fetchFilesFromStackTrace, fetchSourceCode, fetchSourceCodeFromStackTrace } = require('./util');
|
|
10
8
|
const upload = require('./fileUploader');
|
|
11
9
|
const pipesFactory = require('./pipe');
|
|
12
10
|
const adapterFactory = require('./junit-adapter');
|
|
13
11
|
|
|
12
|
+
|
|
14
13
|
const TESTOMATIO_URL = process.env.TESTOMATIO_URL || "https://app.testomat.io";
|
|
15
14
|
const TESTOMATIO = process.env.TESTOMATIO; // key?
|
|
16
15
|
const { TESTOMATIO_RUNGROUP_TITLE, TESTOMATIO_TITLE, TESTOMATIO_ENV, TESTOMATIO_RUN } = process.env;
|
|
@@ -37,7 +36,9 @@ class XmlReader {
|
|
|
37
36
|
};
|
|
38
37
|
this.runId = opts.runId || TESTOMATIO_RUN;
|
|
39
38
|
this.adapter = adapterFactory(null, opts)
|
|
40
|
-
this.
|
|
39
|
+
if (!this.adapter) throw new Error('XML adapter for this format not found');
|
|
40
|
+
|
|
41
|
+
this.opts = opts || {};
|
|
41
42
|
const store = {}
|
|
42
43
|
this.pipes = pipesFactory(opts, store);
|
|
43
44
|
|
|
@@ -93,7 +94,7 @@ class XmlReader {
|
|
|
93
94
|
create_tests: true,
|
|
94
95
|
name,
|
|
95
96
|
tests_count: parseInt(tests, 10),
|
|
96
|
-
passed_count: parseInt(tests - failures, 10),
|
|
97
|
+
passed_count: parseInt(tests, 10) - parseInt(failures, 10),
|
|
97
98
|
failed_count: parseInt(failures, 10),
|
|
98
99
|
skipped_count: 0,
|
|
99
100
|
tests: resultTests,
|
|
@@ -160,9 +161,9 @@ class XmlReader {
|
|
|
160
161
|
if (test.example) r.example = test.example;
|
|
161
162
|
if (test.file) r.file = test.file;
|
|
162
163
|
r.create = true;
|
|
163
|
-
if (r.status === 'Passed') r.status = PASSED;
|
|
164
|
-
if (r.status === 'Failed') r.status = FAILED;
|
|
165
|
-
if (r.status === 'Skipped') r.status = SKIPPED;
|
|
164
|
+
if (r.status === 'Passed') r.status = STATUS.PASSED;
|
|
165
|
+
if (r.status === 'Failed') r.status = STATUS.FAILED;
|
|
166
|
+
if (r.status === 'Skipped') r.status = STATUS.SKIPPED;
|
|
166
167
|
delete r.id;
|
|
167
168
|
});
|
|
168
169
|
|
|
@@ -172,8 +173,8 @@ class XmlReader {
|
|
|
172
173
|
|
|
173
174
|
const failed_count = parseInt(counters.failed, 10) + parseInt(counters.error, 10);
|
|
174
175
|
|
|
175
|
-
let status = PASSED;
|
|
176
|
-
if (failed_count > 0) status = FAILED;
|
|
176
|
+
let status = STATUS.PASSED.toString();
|
|
177
|
+
if (failed_count > 0) status = STATUS.FAILED;
|
|
177
178
|
|
|
178
179
|
this.tests = results.filter(t => !!t.title);
|
|
179
180
|
|
|
@@ -313,7 +314,7 @@ class XmlReader {
|
|
|
313
314
|
const dataString = {
|
|
314
315
|
...this.stats,
|
|
315
316
|
api_key: this.requestParams.apiKey,
|
|
316
|
-
|
|
317
|
+
status: 'finished',
|
|
317
318
|
tests: this.tests,
|
|
318
319
|
};
|
|
319
320
|
|
|
@@ -348,9 +349,9 @@ function reduceTestCases(prev, item) {
|
|
|
348
349
|
// prepend system output
|
|
349
350
|
stack = `${testCaseItem['system-out'] || testCaseItem.output || testCaseItem.log || ''}\n\n${stack}`.trim()
|
|
350
351
|
|
|
351
|
-
let status = PASSED;
|
|
352
|
-
if ('failure' in testCaseItem || 'error' in testCaseItem) status = FAILED;
|
|
353
|
-
if ('skipped' in testCaseItem) status = SKIPPED;
|
|
352
|
+
let status = STATUS.PASSED.toString();
|
|
353
|
+
if ('failure' in testCaseItem || 'error' in testCaseItem) status = STATUS.FAILED;
|
|
354
|
+
if ('skipped' in testCaseItem) status = STATUS.SKIPPED;
|
|
354
355
|
|
|
355
356
|
prev.push({
|
|
356
357
|
create: true,
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testomatio/reporter",
|
|
3
|
-
"version": "0.8.0-beta.
|
|
3
|
+
"version": "0.8.0-beta.32",
|
|
4
4
|
"description": "Testomatio Reporter Client",
|
|
5
5
|
"main": "./lib/reporter.js",
|
|
6
|
+
"typings": "typings/index.d.ts",
|
|
6
7
|
"repository": "git@github.com:testomatio/reporter.git",
|
|
7
8
|
"author": "Michael Bodnarchuk <davert@testomat.io>,Koushik Mohan <koushikmohan1996@gmail.com>",
|
|
8
9
|
"license": "MIT",
|
|
@@ -15,6 +16,8 @@
|
|
|
15
16
|
"callsite-record": "^4.1.4",
|
|
16
17
|
"chalk": "^4.1.0",
|
|
17
18
|
"commander": "^4.1.1",
|
|
19
|
+
"csv-writer": "^1.6.0",
|
|
20
|
+
"debug": "^4.3.4",
|
|
18
21
|
"dotenv": "^16.0.1",
|
|
19
22
|
"fast-xml-parser": "^4.0.8",
|
|
20
23
|
"glob": "^8.0.3",
|
|
@@ -24,7 +27,6 @@
|
|
|
24
27
|
"json-cycle": "^1.3.0",
|
|
25
28
|
"lodash.memoize": "^4.1.2",
|
|
26
29
|
"lodash.merge": "^4.6.2",
|
|
27
|
-
"csv-writer": "^1.6.0",
|
|
28
30
|
"uuid": "^9.0.0"
|
|
29
31
|
},
|
|
30
32
|
"files": [
|
|
@@ -50,6 +52,7 @@
|
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
52
54
|
"@cucumber/cucumber": "^8.6.0",
|
|
55
|
+
"@redocly/cli": "^1.0.0-beta.125",
|
|
53
56
|
"@wdio/reporter": "^7.16.13",
|
|
54
57
|
"chai": "^4.3.6",
|
|
55
58
|
"codeceptjs": "^3.2.3",
|