@testomatio/reporter 2.1.3-beta.2-xml-import → 2.1.3-beta.2-multi-links
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/adapter/codecept.js +3 -3
- package/lib/adapter/mocha.js +0 -14
- package/lib/adapter/webdriver.js +4 -6
- package/lib/bin/startTest.js +91 -38
- package/lib/client.js +3 -6
- package/lib/data-storage.d.ts +4 -4
- package/lib/data-storage.js +6 -6
- package/lib/pipe/testomatio.js +2 -1
- package/lib/reporter-functions.d.ts +7 -20
- package/lib/reporter-functions.js +35 -27
- package/lib/reporter.d.ts +20 -22
- package/lib/reporter.js +7 -9
- package/lib/services/artifacts.d.ts +1 -1
- package/lib/services/index.d.ts +2 -2
- package/lib/services/index.js +2 -2
- package/lib/services/key-values.d.ts +1 -1
- package/lib/services/labels.d.ts +1 -1
- package/lib/services/labels.js +2 -2
- package/lib/services/logger.d.ts +1 -1
- package/lib/utils/cli_utils.d.ts +1 -0
- package/lib/utils/cli_utils.js +262160 -0
- package/lib/utils/utils.js +1 -3
- package/lib/xmlReader.d.ts +0 -7
- package/lib/xmlReader.js +9 -231
- package/package.json +1 -1
- package/src/adapter/codecept.js +4 -3
- package/src/adapter/mocha.js +0 -15
- package/src/adapter/webdriver.js +4 -6
- package/src/bin/startTest.js +114 -43
- package/src/client.js +3 -5
- package/src/data-storage.js +6 -6
- package/src/pipe/testomatio.js +2 -1
- package/src/reporter-functions.js +37 -27
- package/src/reporter.js +6 -8
- package/src/services/index.js +2 -2
- package/src/services/labels.js +2 -2
- package/src/utils/utils.js +3 -5
- package/src/xmlReader.js +9 -267
- package/src/services/links.js +0 -69
package/src/services/links.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import createDebugMessages from 'debug';
|
|
2
|
-
import { dataStorage } from '../data-storage.js';
|
|
3
|
-
|
|
4
|
-
const debug = createDebugMessages('@testomatio/reporter:services-links');
|
|
5
|
-
|
|
6
|
-
class LinkStorage {
|
|
7
|
-
static #instance;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* @returns {LinkStorage}
|
|
12
|
-
*/
|
|
13
|
-
static getInstance() {
|
|
14
|
-
if (!this.#instance) {
|
|
15
|
-
this.#instance = new LinkStorage();
|
|
16
|
-
}
|
|
17
|
-
return this.#instance;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Stores links array and passes it to reporter
|
|
22
|
-
* @param {object[]} links - array of link objects
|
|
23
|
-
* @param {*} context - full test title
|
|
24
|
-
*/
|
|
25
|
-
put(links, context = null) {
|
|
26
|
-
if (!links || !Array.isArray(links)) return;
|
|
27
|
-
dataStorage.putData('links', links, context);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Returns links array for the test
|
|
32
|
-
* @param {*} context testId or test context from test runner
|
|
33
|
-
* @returns {object[]} links array, e.g. [{test: 'TEST-123'}, {jira: 'JIRA-456'}]
|
|
34
|
-
*/
|
|
35
|
-
get(context = null) {
|
|
36
|
-
const linksList = dataStorage.getData('links', context);
|
|
37
|
-
if (!linksList || !linksList?.length) return [];
|
|
38
|
-
|
|
39
|
-
const allLinks = [];
|
|
40
|
-
for (const links of linksList) {
|
|
41
|
-
if (Array.isArray(links)) {
|
|
42
|
-
allLinks.push(...links);
|
|
43
|
-
} else if (typeof links === 'string') {
|
|
44
|
-
try {
|
|
45
|
-
const parsedLinks = JSON.parse(links);
|
|
46
|
-
if (Array.isArray(parsedLinks)) {
|
|
47
|
-
allLinks.push(...parsedLinks);
|
|
48
|
-
}
|
|
49
|
-
} catch (e) {
|
|
50
|
-
debug(`Error parsing links for test ${context}`, links);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Remove duplicates based on JSON string comparison
|
|
56
|
-
const uniqueLinks = [];
|
|
57
|
-
const seen = new Set();
|
|
58
|
-
for (const link of allLinks) {
|
|
59
|
-
const key = JSON.stringify(link);
|
|
60
|
-
if (!seen.has(key)) {
|
|
61
|
-
seen.add(key);
|
|
62
|
-
uniqueLinks.push(link);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return uniqueLinks;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export const linkStorage = LinkStorage.getInstance();
|