@testomatio/reporter 1.6.13 → 2.0.1-beta-esm
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.d.ts +2 -0
- package/lib/adapter/codecept.js +295 -335
- package/lib/adapter/cucumber/current.d.ts +14 -0
- package/lib/adapter/cucumber/current.js +195 -203
- package/lib/adapter/cucumber/legacy.d.ts +0 -0
- package/lib/adapter/cucumber/legacy.js +130 -155
- package/lib/adapter/cucumber.d.ts +2 -0
- package/lib/adapter/cucumber.js +5 -16
- package/lib/adapter/cypress-plugin/index.d.ts +2 -0
- package/lib/adapter/cypress-plugin/index.js +93 -105
- package/lib/adapter/jasmine.d.ts +11 -0
- package/lib/adapter/jasmine.js +54 -53
- package/lib/adapter/jest.d.ts +13 -0
- package/lib/adapter/jest.js +97 -99
- package/lib/adapter/mocha.d.ts +2 -0
- package/lib/adapter/mocha.js +112 -140
- package/lib/adapter/playwright.d.ts +14 -0
- package/lib/adapter/playwright.js +195 -231
- package/lib/adapter/vitest.d.ts +35 -0
- package/lib/adapter/vitest.js +150 -149
- package/lib/adapter/webdriver.d.ts +24 -0
- package/lib/adapter/webdriver.js +134 -119
- package/lib/bin/cli.d.ts +2 -0
- package/lib/bin/cli.js +164 -211
- package/lib/bin/reportXml.d.ts +2 -0
- package/lib/bin/reportXml.js +49 -52
- package/lib/bin/startTest.d.ts +2 -0
- package/lib/bin/startTest.js +82 -95
- package/lib/bin/uploadArtifacts.d.ts +2 -0
- package/lib/bin/uploadArtifacts.js +55 -61
- package/lib/client.d.ts +76 -0
- package/lib/client.js +411 -465
- package/lib/config.d.ts +1 -0
- package/lib/config.js +16 -21
- package/lib/constants.d.ts +25 -0
- package/lib/constants.js +50 -44
- package/lib/data-storage.d.ts +34 -0
- package/lib/data-storage.js +206 -188
- package/lib/junit-adapter/adapter.d.ts +9 -0
- package/lib/junit-adapter/adapter.js +17 -20
- package/lib/junit-adapter/csharp.d.ts +4 -0
- package/lib/junit-adapter/csharp.js +18 -14
- package/lib/junit-adapter/index.d.ts +3 -0
- package/lib/junit-adapter/index.js +27 -25
- package/lib/junit-adapter/java.d.ts +5 -0
- package/lib/junit-adapter/java.js +41 -53
- package/lib/junit-adapter/javascript.d.ts +4 -0
- package/lib/junit-adapter/javascript.js +30 -27
- package/lib/junit-adapter/python.d.ts +5 -0
- package/lib/junit-adapter/python.js +38 -37
- package/lib/junit-adapter/ruby.d.ts +4 -0
- package/lib/junit-adapter/ruby.js +11 -8
- package/lib/output.d.ts +11 -0
- package/lib/output.js +44 -52
- package/lib/package.json +3 -0
- package/lib/pipe/bitbucket.d.ts +23 -0
- package/lib/pipe/bitbucket.js +210 -229
- package/lib/pipe/csv.d.ts +47 -0
- package/lib/pipe/csv.js +113 -126
- package/lib/pipe/debug.d.ts +29 -0
- package/lib/pipe/debug.js +104 -99
- package/lib/pipe/github.d.ts +30 -0
- package/lib/pipe/github.js +186 -213
- package/lib/pipe/gitlab.d.ts +23 -0
- package/lib/pipe/gitlab.js +166 -207
- package/lib/pipe/html.d.ts +34 -0
- package/lib/pipe/html.js +260 -319
- package/lib/pipe/index.d.ts +1 -0
- package/lib/pipe/index.js +84 -66
- package/lib/pipe/testomatio.d.ts +70 -0
- package/lib/pipe/testomatio.js +413 -462
- package/lib/reporter-functions.d.ts +34 -0
- package/lib/reporter-functions.js +28 -26
- package/lib/reporter.d.ts +232 -0
- package/lib/reporter.js +34 -29
- package/lib/services/artifacts.d.ts +33 -0
- package/lib/services/artifacts.js +55 -51
- package/lib/services/index.d.ts +9 -0
- package/lib/services/index.js +14 -12
- package/lib/services/key-values.d.ts +27 -0
- package/lib/services/key-values.js +56 -53
- package/lib/services/logger.d.ts +64 -0
- package/lib/services/logger.js +227 -245
- package/lib/template/testomatio.hbs +651 -1366
- package/lib/uploader.d.ts +60 -0
- package/lib/uploader.js +291 -360
- package/lib/utils/pipe_utils.d.ts +41 -0
- package/lib/utils/pipe_utils.js +89 -85
- package/lib/utils/utils.d.ts +45 -0
- package/lib/utils/utils.js +347 -307
- package/lib/xmlReader.d.ts +92 -0
- package/lib/xmlReader.js +490 -529
- package/package.json +57 -15
- package/src/adapter/codecept.js +375 -0
- package/src/adapter/cucumber/current.js +228 -0
- package/src/adapter/cucumber/legacy.js +158 -0
- package/src/adapter/cucumber.js +4 -0
- package/src/adapter/cypress-plugin/index.js +112 -0
- package/src/adapter/jasmine.js +60 -0
- package/src/adapter/jest.js +107 -0
- package/src/adapter/mocha.cjs +2 -0
- package/src/adapter/mocha.js +157 -0
- package/src/adapter/playwright.js +250 -0
- package/src/adapter/vitest.js +183 -0
- package/src/adapter/webdriver.js +142 -0
- package/src/bin/cli.js +280 -0
- package/src/bin/reportXml.js +74 -0
- package/src/bin/startTest.js +123 -0
- package/src/bin/uploadArtifacts.js +90 -0
- package/src/client.js +504 -0
- package/src/config.js +30 -0
- package/src/constants.js +53 -0
- package/src/data-storage.js +204 -0
- package/src/junit-adapter/adapter.js +23 -0
- package/src/junit-adapter/csharp.js +16 -0
- package/src/junit-adapter/index.js +28 -0
- package/src/junit-adapter/java.js +58 -0
- package/src/junit-adapter/javascript.js +31 -0
- package/src/junit-adapter/python.js +42 -0
- package/src/junit-adapter/ruby.js +10 -0
- package/src/output.js +57 -0
- package/src/pipe/bitbucket.js +254 -0
- package/src/pipe/csv.js +140 -0
- package/src/pipe/debug.js +104 -0
- package/src/pipe/github.js +233 -0
- package/src/pipe/gitlab.js +229 -0
- package/src/pipe/html.js +374 -0
- package/src/pipe/index.js +71 -0
- package/src/pipe/testomatio.js +503 -0
- package/src/reporter-functions.js +55 -0
- package/src/reporter.cjs_decprecated +21 -0
- package/src/reporter.js +33 -0
- package/src/services/artifacts.js +59 -0
- package/src/services/index.js +13 -0
- package/src/services/key-values.js +59 -0
- package/src/services/logger.js +316 -0
- package/src/template/emptyData.svg +23 -0
- package/src/template/testomatio.hbs +706 -0
- package/src/uploader.js +371 -0
- package/src/utils/pipe_utils.js +119 -0
- package/src/utils/utils.js +383 -0
- package/src/xmlReader.js +562 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { saveArtifact as artifact };
|
|
3
|
+
export { logMessage as log };
|
|
4
|
+
export { addStep as step };
|
|
5
|
+
export { setKeyValue as keyValue };
|
|
6
|
+
}
|
|
7
|
+
export default _default;
|
|
8
|
+
/**
|
|
9
|
+
* Stores path to file as artifact and uploads it to the S3 storage
|
|
10
|
+
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
11
|
+
*/
|
|
12
|
+
declare function saveArtifact(data: string | {
|
|
13
|
+
path: string;
|
|
14
|
+
type: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}, context?: any): void;
|
|
17
|
+
/**
|
|
18
|
+
* Attach log message(s) to the test report
|
|
19
|
+
* @param string
|
|
20
|
+
*/
|
|
21
|
+
declare function logMessage(...args: any[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Similar to "log" function but marks message in report as a step
|
|
24
|
+
* @param {string} message
|
|
25
|
+
*/
|
|
26
|
+
declare function addStep(message: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Add key-value pair(s) to the test report
|
|
29
|
+
* @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
|
|
30
|
+
* @param {string?} value
|
|
31
|
+
*/
|
|
32
|
+
declare function setKeyValue(keyValue: {
|
|
33
|
+
[key: string]: string;
|
|
34
|
+
} | string, value?: string | null): void;
|
|
@@ -1,50 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (process.env.PLAYWRIGHT_TEST_BASE_URL) {
|
|
5
|
-
initPlaywrightForStorage();
|
|
6
|
-
}
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("./services/index.js");
|
|
8
4
|
/**
|
|
9
5
|
* Stores path to file as artifact and uploads it to the S3 storage
|
|
10
6
|
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
11
7
|
*/
|
|
12
8
|
function saveArtifact(data, context = null) {
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (process.env.IS_PLAYWRIGHT)
|
|
10
|
+
throw new Error(`This function is not available in Playwright framework.
|
|
11
|
+
/Playwright supports artifacts out of the box`);
|
|
12
|
+
if (!data)
|
|
13
|
+
return;
|
|
14
|
+
index_js_1.services.artifacts.put(data, context);
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
17
|
* Attach log message(s) to the test report
|
|
19
|
-
* @param
|
|
18
|
+
* @param string
|
|
20
19
|
*/
|
|
21
20
|
function logMessage(...args) {
|
|
22
|
-
|
|
21
|
+
if (process.env.IS_PLAYWRIGHT)
|
|
22
|
+
throw new Error('This function is not available in Playwright framework');
|
|
23
|
+
index_js_1.services.logger._templateLiteralLog(...args);
|
|
23
24
|
}
|
|
24
|
-
|
|
25
25
|
/**
|
|
26
26
|
* Similar to "log" function but marks message in report as a step
|
|
27
|
-
* @param {
|
|
27
|
+
* @param {string} message
|
|
28
28
|
*/
|
|
29
29
|
function addStep(message) {
|
|
30
|
-
|
|
30
|
+
if (process.env.IS_PLAYWRIGHT)
|
|
31
|
+
throw new Error('This function is not available in Playwright framework. Use playwright steps');
|
|
32
|
+
index_js_1.services.logger.step(message);
|
|
31
33
|
}
|
|
32
|
-
|
|
33
34
|
/**
|
|
34
35
|
* Add key-value pair(s) to the test report
|
|
35
|
-
* @param {
|
|
36
|
+
* @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
|
|
36
37
|
* @param {string?} value
|
|
37
38
|
*/
|
|
38
39
|
function setKeyValue(keyValue, value = null) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (process.env.IS_PLAYWRIGHT)
|
|
41
|
+
throw new Error('This function is not available in Playwright framework. Use test tag instead.');
|
|
42
|
+
if (typeof keyValue === 'string') {
|
|
43
|
+
keyValue = { [keyValue]: value };
|
|
44
|
+
}
|
|
45
|
+
index_js_1.services.keyValues.put(keyValue);
|
|
43
46
|
}
|
|
44
|
-
|
|
45
47
|
module.exports = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
artifact: saveArtifact,
|
|
49
|
+
log: logMessage,
|
|
50
|
+
step: addStep,
|
|
51
|
+
keyValue: setKeyValue,
|
|
50
52
|
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
export type artifact = typeof import("./reporter-functions.js");
|
|
2
|
+
export const artifact: (data: string | {
|
|
3
|
+
path: string;
|
|
4
|
+
type: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}, context?: any) => void;
|
|
7
|
+
export type log = typeof import("./reporter-functions.js");
|
|
8
|
+
export const log: (...args: any[]) => void;
|
|
9
|
+
export type logger = typeof import("./services/index.js");
|
|
10
|
+
export const logger: {
|
|
11
|
+
"__#12@#originalUserLogger": {
|
|
12
|
+
assert(condition?: boolean, ...data: any[]): void;
|
|
13
|
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
14
|
+
clear(): void;
|
|
15
|
+
clear(): void;
|
|
16
|
+
count(label?: string): void;
|
|
17
|
+
count(label?: string): void;
|
|
18
|
+
countReset(label?: string): void;
|
|
19
|
+
countReset(label?: string): void;
|
|
20
|
+
debug(...data: any[]): void;
|
|
21
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
22
|
+
dir(item?: any, options?: any): void;
|
|
23
|
+
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
24
|
+
dirxml(...data: any[]): void;
|
|
25
|
+
dirxml(...data: any[]): void;
|
|
26
|
+
error(...data: any[]): void;
|
|
27
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
28
|
+
group(...data: any[]): void;
|
|
29
|
+
group(...label: any[]): void;
|
|
30
|
+
groupCollapsed(...data: any[]): void;
|
|
31
|
+
groupCollapsed(...label: any[]): void;
|
|
32
|
+
groupEnd(): void;
|
|
33
|
+
groupEnd(): void;
|
|
34
|
+
info(...data: any[]): void;
|
|
35
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
36
|
+
log(...data: any[]): void;
|
|
37
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
38
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
39
|
+
table(tabularData: any, properties?: readonly string[]): void;
|
|
40
|
+
time(label?: string): void;
|
|
41
|
+
time(label?: string): void;
|
|
42
|
+
timeEnd(label?: string): void;
|
|
43
|
+
timeEnd(label?: string): void;
|
|
44
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
45
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
46
|
+
timeStamp(label?: string): void;
|
|
47
|
+
timeStamp(label?: string): void;
|
|
48
|
+
trace(...data: any[]): void;
|
|
49
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
50
|
+
warn(...data: any[]): void;
|
|
51
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
52
|
+
Console: console.ConsoleConstructor;
|
|
53
|
+
profile(label?: string): void;
|
|
54
|
+
profileEnd(label?: string): void;
|
|
55
|
+
};
|
|
56
|
+
"__#12@#userLoggerWithOverridenMethods": any;
|
|
57
|
+
logLevel: string;
|
|
58
|
+
step(strings: any, ...values: any[]): void;
|
|
59
|
+
getLogs(context: string): string[];
|
|
60
|
+
"__#12@#stringifyLogs"(...args: any[]): string;
|
|
61
|
+
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
62
|
+
"__#12@#logWrapper"(argsArray: any, level: any): void;
|
|
63
|
+
assert(...args: any[]): void;
|
|
64
|
+
debug(...args: any[]): void;
|
|
65
|
+
error(...args: any[]): void;
|
|
66
|
+
info(...args: any[]): void;
|
|
67
|
+
log(...args: any[]): void;
|
|
68
|
+
trace(...args: any[]): void;
|
|
69
|
+
warn(...args: any[]): void;
|
|
70
|
+
intercept(userLogger: any): void;
|
|
71
|
+
stopInterception(): void;
|
|
72
|
+
configure(config?: {
|
|
73
|
+
logLevel?: string;
|
|
74
|
+
prettyObjects?: boolean;
|
|
75
|
+
}): void;
|
|
76
|
+
prettyObjects: boolean;
|
|
77
|
+
};
|
|
78
|
+
export type meta = typeof import("./reporter-functions.js");
|
|
79
|
+
export const meta: (keyValue: {
|
|
80
|
+
[key: string]: string;
|
|
81
|
+
} | string, value?: string | null) => void;
|
|
82
|
+
export type step = typeof import("./reporter-functions.js");
|
|
83
|
+
export const step: (message: string) => void;
|
|
84
|
+
declare namespace _default {
|
|
85
|
+
let testomatioLogger: {
|
|
86
|
+
"__#12@#originalUserLogger": {
|
|
87
|
+
assert(condition?: boolean, ...data: any[]): void;
|
|
88
|
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
89
|
+
clear(): void;
|
|
90
|
+
clear(): void;
|
|
91
|
+
count(label?: string): void;
|
|
92
|
+
count(label?: string): void;
|
|
93
|
+
countReset(label?: string): void;
|
|
94
|
+
countReset(label?: string): void;
|
|
95
|
+
debug(...data: any[]): void;
|
|
96
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
97
|
+
dir(item?: any, options?: any): void;
|
|
98
|
+
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
99
|
+
dirxml(...data: any[]): void;
|
|
100
|
+
dirxml(...data: any[]): void;
|
|
101
|
+
error(...data: any[]): void;
|
|
102
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
103
|
+
group(...data: any[]): void;
|
|
104
|
+
group(...label: any[]): void;
|
|
105
|
+
groupCollapsed(...data: any[]): void;
|
|
106
|
+
groupCollapsed(...label: any[]): void;
|
|
107
|
+
groupEnd(): void;
|
|
108
|
+
groupEnd(): void;
|
|
109
|
+
info(...data: any[]): void;
|
|
110
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
111
|
+
log(...data: any[]): void;
|
|
112
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
113
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
114
|
+
table(tabularData: any, properties?: readonly string[]): void;
|
|
115
|
+
time(label?: string): void;
|
|
116
|
+
time(label?: string): void;
|
|
117
|
+
timeEnd(label?: string): void;
|
|
118
|
+
timeEnd(label?: string): void;
|
|
119
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
120
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
121
|
+
timeStamp(label?: string): void;
|
|
122
|
+
timeStamp(label?: string): void;
|
|
123
|
+
trace(...data: any[]): void;
|
|
124
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
125
|
+
warn(...data: any[]): void;
|
|
126
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
127
|
+
Console: console.ConsoleConstructor;
|
|
128
|
+
profile(label?: string): void;
|
|
129
|
+
profileEnd(label?: string): void;
|
|
130
|
+
};
|
|
131
|
+
"__#12@#userLoggerWithOverridenMethods": any;
|
|
132
|
+
logLevel: string;
|
|
133
|
+
step(strings: any, ...values: any[]): void;
|
|
134
|
+
getLogs(context: string): string[];
|
|
135
|
+
"__#12@#stringifyLogs"(...args: any[]): string;
|
|
136
|
+
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
137
|
+
"__#12@#logWrapper"(argsArray: any, level: any): void;
|
|
138
|
+
assert(...args: any[]): void;
|
|
139
|
+
debug(...args: any[]): void;
|
|
140
|
+
error(...args: any[]): void;
|
|
141
|
+
info(...args: any[]): void;
|
|
142
|
+
log(...args: any[]): void;
|
|
143
|
+
trace(...args: any[]): void;
|
|
144
|
+
warn(...args: any[]): void;
|
|
145
|
+
intercept(userLogger: any): void;
|
|
146
|
+
stopInterception(): void;
|
|
147
|
+
configure(config?: {
|
|
148
|
+
logLevel?: string;
|
|
149
|
+
prettyObjects?: boolean;
|
|
150
|
+
}): void;
|
|
151
|
+
prettyObjects: boolean;
|
|
152
|
+
};
|
|
153
|
+
let artifact: (data: string | {
|
|
154
|
+
path: string;
|
|
155
|
+
type: string;
|
|
156
|
+
name: string;
|
|
157
|
+
}, context?: any) => void;
|
|
158
|
+
let log: (...args: any[]) => void;
|
|
159
|
+
let logger: {
|
|
160
|
+
"__#12@#originalUserLogger": {
|
|
161
|
+
assert(condition?: boolean, ...data: any[]): void;
|
|
162
|
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
163
|
+
clear(): void;
|
|
164
|
+
clear(): void;
|
|
165
|
+
count(label?: string): void;
|
|
166
|
+
count(label?: string): void;
|
|
167
|
+
countReset(label?: string): void;
|
|
168
|
+
countReset(label?: string): void;
|
|
169
|
+
debug(...data: any[]): void;
|
|
170
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
171
|
+
dir(item?: any, options?: any): void;
|
|
172
|
+
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
173
|
+
dirxml(...data: any[]): void;
|
|
174
|
+
dirxml(...data: any[]): void;
|
|
175
|
+
error(...data: any[]): void;
|
|
176
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
177
|
+
group(...data: any[]): void;
|
|
178
|
+
group(...label: any[]): void;
|
|
179
|
+
groupCollapsed(...data: any[]): void;
|
|
180
|
+
groupCollapsed(...label: any[]): void;
|
|
181
|
+
groupEnd(): void;
|
|
182
|
+
groupEnd(): void;
|
|
183
|
+
info(...data: any[]): void;
|
|
184
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
185
|
+
log(...data: any[]): void;
|
|
186
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
187
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
188
|
+
table(tabularData: any, properties?: readonly string[]): void;
|
|
189
|
+
time(label?: string): void;
|
|
190
|
+
time(label?: string): void;
|
|
191
|
+
timeEnd(label?: string): void;
|
|
192
|
+
timeEnd(label?: string): void;
|
|
193
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
194
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
195
|
+
timeStamp(label?: string): void;
|
|
196
|
+
timeStamp(label?: string): void;
|
|
197
|
+
trace(...data: any[]): void;
|
|
198
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
199
|
+
warn(...data: any[]): void;
|
|
200
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
201
|
+
Console: console.ConsoleConstructor;
|
|
202
|
+
profile(label?: string): void;
|
|
203
|
+
profileEnd(label?: string): void;
|
|
204
|
+
};
|
|
205
|
+
"__#12@#userLoggerWithOverridenMethods": any;
|
|
206
|
+
logLevel: string;
|
|
207
|
+
step(strings: any, ...values: any[]): void;
|
|
208
|
+
getLogs(context: string): string[];
|
|
209
|
+
"__#12@#stringifyLogs"(...args: any[]): string;
|
|
210
|
+
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
211
|
+
"__#12@#logWrapper"(argsArray: any, level: any): void;
|
|
212
|
+
assert(...args: any[]): void;
|
|
213
|
+
debug(...args: any[]): void;
|
|
214
|
+
error(...args: any[]): void;
|
|
215
|
+
info(...args: any[]): void;
|
|
216
|
+
log(...args: any[]): void;
|
|
217
|
+
trace(...args: any[]): void;
|
|
218
|
+
warn(...args: any[]): void;
|
|
219
|
+
intercept(userLogger: any): void;
|
|
220
|
+
stopInterception(): void;
|
|
221
|
+
configure(config?: {
|
|
222
|
+
logLevel?: string;
|
|
223
|
+
prettyObjects?: boolean;
|
|
224
|
+
}): void;
|
|
225
|
+
prettyObjects: boolean;
|
|
226
|
+
};
|
|
227
|
+
let meta: (keyValue: {
|
|
228
|
+
[key: string]: string;
|
|
229
|
+
} | string, value?: string | null) => void;
|
|
230
|
+
let step: (message: string) => void;
|
|
231
|
+
}
|
|
232
|
+
export default _default;
|
package/lib/reporter.js
CHANGED
|
@@ -1,30 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.step = exports.meta = exports.logger = exports.log = exports.artifact = void 0;
|
|
7
|
+
// import TestomatClient from './client.js';
|
|
8
|
+
// import * as TRConstants from './constants.js';
|
|
9
|
+
const index_js_1 = require("./services/index.js");
|
|
10
|
+
const reporter_functions_js_1 = __importDefault(require("./reporter-functions.js"));
|
|
11
|
+
exports.artifact = reporter_functions_js_1.default.artifact;
|
|
12
|
+
exports.log = reporter_functions_js_1.default.log;
|
|
13
|
+
exports.logger = index_js_1.services.logger;
|
|
14
|
+
exports.meta = reporter_functions_js_1.default.keyValue;
|
|
15
|
+
exports.step = reporter_functions_js_1.default.step;
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {import('./reporter-functions.js')} artifact
|
|
18
|
+
* @typedef {import('./reporter-functions.js')} log
|
|
19
|
+
* @typedef {import('./services/index.js')} logger
|
|
20
|
+
* @typedef {import('./reporter-functions.js')} meta
|
|
21
|
+
* @typedef {import('./reporter-functions.js')} step
|
|
22
|
+
*/
|
|
23
|
+
module.exports = {
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use `log` or `testomat.log`
|
|
26
|
+
*/
|
|
27
|
+
testomatioLogger: index_js_1.services.logger,
|
|
28
|
+
artifact: reporter_functions_js_1.default.artifact,
|
|
29
|
+
log: reporter_functions_js_1.default.log,
|
|
30
|
+
logger: index_js_1.services.logger,
|
|
31
|
+
meta: reporter_functions_js_1.default.keyValue,
|
|
32
|
+
step: reporter_functions_js_1.default.step,
|
|
33
|
+
// TestomatClient,
|
|
34
|
+
// TRConstants,
|
|
19
35
|
};
|
|
20
|
-
|
|
21
|
-
module.exports = testomat;
|
|
22
|
-
|
|
23
|
-
module.exports.testomatioLogger = testomat;
|
|
24
|
-
module.exports.artifact = reporterFunctions.artifact;
|
|
25
|
-
module.exports.log = reporterFunctions.log;
|
|
26
|
-
module.exports.logger = services.logger;
|
|
27
|
-
module.exports.meta = reporterFunctions.keyValue;
|
|
28
|
-
module.exports.step = reporterFunctions.step;
|
|
29
|
-
module.exports.TestomatClient = TestomatClient;
|
|
30
|
-
module.exports.TRConstants = TRConstants;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const artifactStorage: ArtifactStorage;
|
|
2
|
+
/**
|
|
3
|
+
* Artifact storage is supposed to store file paths
|
|
4
|
+
*/
|
|
5
|
+
declare class ArtifactStorage {
|
|
6
|
+
static "__#13@#instance": any;
|
|
7
|
+
/**
|
|
8
|
+
* Singleton
|
|
9
|
+
* @returns {ArtifactStorage}
|
|
10
|
+
*/
|
|
11
|
+
static getInstance(): ArtifactStorage;
|
|
12
|
+
/**
|
|
13
|
+
* Stores path to file as artifact and uploads it to the S3 storage
|
|
14
|
+
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
15
|
+
* @param {*} context testId or test title
|
|
16
|
+
*/
|
|
17
|
+
put(data: string | {
|
|
18
|
+
path: string;
|
|
19
|
+
type: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}, context?: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* Returns list of artifacts to upload
|
|
24
|
+
* @param {*} context testId or test context from test runner
|
|
25
|
+
* @returns {(string | {path: string, type: string, name: string})[]}
|
|
26
|
+
*/
|
|
27
|
+
get(context: any): (string | {
|
|
28
|
+
path: string;
|
|
29
|
+
type: string;
|
|
30
|
+
name: string;
|
|
31
|
+
})[];
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.artifactStorage = void 0;
|
|
7
|
+
const debug_1 = __importDefault(require("debug"));
|
|
8
|
+
const data_storage_js_1 = require("../data-storage.js");
|
|
9
|
+
const debug = (0, debug_1.default)('@testomatio/reporter:services-artifacts');
|
|
4
10
|
/**
|
|
5
11
|
* Artifact storage is supposed to store file paths
|
|
6
12
|
*/
|
|
7
13
|
class ArtifactStorage {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
static #instance;
|
|
15
|
+
/**
|
|
16
|
+
* Singleton
|
|
17
|
+
* @returns {ArtifactStorage}
|
|
18
|
+
*/
|
|
19
|
+
static getInstance() {
|
|
20
|
+
if (!this.#instance) {
|
|
21
|
+
this.#instance = new ArtifactStorage();
|
|
22
|
+
}
|
|
23
|
+
return this.#instance;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Stores path to file as artifact and uploads it to the S3 storage
|
|
27
|
+
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
28
|
+
* @param {*} context testId or test title
|
|
29
|
+
*/
|
|
30
|
+
put(data, context = null) {
|
|
31
|
+
if (!data)
|
|
32
|
+
return;
|
|
33
|
+
debug('Save artifact:', data);
|
|
34
|
+
data_storage_js_1.dataStorage.putData('artifact', data, context);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns list of artifacts to upload
|
|
38
|
+
* @param {*} context testId or test context from test runner
|
|
39
|
+
* @returns {(string | {path: string, type: string, name: string})[]}
|
|
40
|
+
*/
|
|
41
|
+
get(context) {
|
|
42
|
+
let artifacts = data_storage_js_1.dataStorage.getData('artifact', context);
|
|
43
|
+
if (!artifacts || !artifacts.length)
|
|
44
|
+
return [];
|
|
45
|
+
artifacts = artifacts.map(artifactData => {
|
|
46
|
+
// artifact could be an object ({type, path, name} props) or string (just path)
|
|
47
|
+
let artifact;
|
|
48
|
+
try {
|
|
49
|
+
artifact = JSON.parse(artifactData);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
artifact = artifactData;
|
|
53
|
+
}
|
|
54
|
+
return artifact;
|
|
55
|
+
});
|
|
56
|
+
artifacts = artifacts.filter(artifact => !!artifact);
|
|
57
|
+
debug(`Artifacts for test ${context}:`, artifacts);
|
|
58
|
+
return artifacts.length ? artifacts : [];
|
|
17
59
|
}
|
|
18
|
-
return this.#instance;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Stores path to file as artifact and uploads it to the S3 storage
|
|
23
|
-
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
24
|
-
* @param {*} context testId or test title
|
|
25
|
-
*/
|
|
26
|
-
put(data, context = null) {
|
|
27
|
-
if (!data) return;
|
|
28
|
-
debug('Save artifact:', data);
|
|
29
|
-
dataStorage.putData('artifact', data, context);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Returns list of artifacts to upload
|
|
34
|
-
* @param {*} context testId or test context from test runner
|
|
35
|
-
* @returns {(string | {path: string, type: string, name: string})[]}
|
|
36
|
-
*/
|
|
37
|
-
get(context) {
|
|
38
|
-
let artifacts = dataStorage.getData('artifact', context);
|
|
39
|
-
if (!artifacts || !artifacts.length) return [];
|
|
40
|
-
|
|
41
|
-
artifacts = artifacts.map(artifactData => {
|
|
42
|
-
// artifact could be an object ({type, path, name} props) or string (just path)
|
|
43
|
-
let artifact;
|
|
44
|
-
try {
|
|
45
|
-
artifact = JSON.parse(artifactData);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
artifact = artifactData;
|
|
48
|
-
}
|
|
49
|
-
return artifact;
|
|
50
|
-
});
|
|
51
|
-
artifacts = artifacts.filter(artifact => !!artifact);
|
|
52
|
-
debug(`Artifacts for test ${context}:`, artifacts);
|
|
53
|
-
return artifacts.length ? artifacts : [];
|
|
54
|
-
}
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
module.exports.artifactStorage = ArtifactStorage.getInstance();
|
|
61
|
+
exports.artifactStorage = ArtifactStorage.getInstance();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export namespace services {
|
|
2
|
+
export { logger };
|
|
3
|
+
export { artifactStorage as artifacts };
|
|
4
|
+
export { keyValueStorage as keyValues };
|
|
5
|
+
export function setContext(context: any): void;
|
|
6
|
+
}
|
|
7
|
+
import { logger } from './logger.js';
|
|
8
|
+
import { artifactStorage } from './artifacts.js';
|
|
9
|
+
import { keyValueStorage } from './key-values.js';
|
package/lib/services/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.services = void 0;
|
|
4
|
+
const logger_js_1 = require("./logger.js");
|
|
5
|
+
const artifacts_js_1 = require("./artifacts.js");
|
|
6
|
+
const key_values_js_1 = require("./key-values.js");
|
|
7
|
+
const data_storage_js_1 = require("../data-storage.js");
|
|
8
|
+
exports.services = {
|
|
9
|
+
logger: logger_js_1.logger,
|
|
10
|
+
artifacts: artifacts_js_1.artifactStorage,
|
|
11
|
+
keyValues: key_values_js_1.keyValueStorage,
|
|
12
|
+
setContext: context => {
|
|
13
|
+
data_storage_js_1.dataStorage.setContext(context);
|
|
14
|
+
},
|
|
13
15
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const keyValueStorage: KeyValueStorage;
|
|
2
|
+
declare class KeyValueStorage {
|
|
3
|
+
static "__#14@#instance": any;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @returns {KeyValueStorage}
|
|
7
|
+
*/
|
|
8
|
+
static getInstance(): KeyValueStorage;
|
|
9
|
+
/**
|
|
10
|
+
* Stores key-value pair and passes it to reporter
|
|
11
|
+
* @param {{[key: string]: string}} keyValue - key-value pair(s) as object
|
|
12
|
+
* @param {*} context - full test title
|
|
13
|
+
*/
|
|
14
|
+
put(keyValue: {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
}, context?: any): void;
|
|
17
|
+
/**
|
|
18
|
+
* Returns key-values pairs for the test as object
|
|
19
|
+
* @param {*} context testId or test context from test runner
|
|
20
|
+
* @returns {{[key: string]: string} | {}} key-values pairs as object, e.g. {priority: 'high', browser: 'chrome'}
|
|
21
|
+
*/
|
|
22
|
+
get(context?: any): {
|
|
23
|
+
[key: string]: string;
|
|
24
|
+
} | {};
|
|
25
|
+
#private;
|
|
26
|
+
}
|
|
27
|
+
export {};
|