@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
|
@@ -1,58 +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.keyValueStorage = 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-key-value');
|
|
4
10
|
class KeyValueStorage {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
static #instance;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @returns {KeyValueStorage}
|
|
15
|
+
*/
|
|
16
|
+
static getInstance() {
|
|
17
|
+
if (!this.#instance) {
|
|
18
|
+
this.#instance = new KeyValueStorage();
|
|
19
|
+
}
|
|
20
|
+
return this.#instance;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Stores key-value pair and passes it to reporter
|
|
24
|
+
* @param {{[key: string]: string}} keyValue - key-value pair(s) as object
|
|
25
|
+
* @param {*} context - full test title
|
|
26
|
+
*/
|
|
27
|
+
put(keyValue, context = null) {
|
|
28
|
+
if (!keyValue)
|
|
29
|
+
return;
|
|
30
|
+
data_storage_js_1.dataStorage.putData('keyvalue', keyValue, context);
|
|
31
|
+
}
|
|
32
|
+
#isKeyValueObject(smth) {
|
|
33
|
+
return smth && typeof smth === 'object' && !Array.isArray(smth) && smth !== null;
|
|
14
34
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
get(context = null) {
|
|
38
|
-
const keyValuesList = dataStorage.getData('keyvalue', context);
|
|
39
|
-
if (!keyValuesList || !keyValuesList?.length) return {};
|
|
40
|
-
|
|
41
|
-
const keyValues = {};
|
|
42
|
-
for (const keyValue of keyValuesList) {
|
|
43
|
-
if (this.#isKeyValueObject(keyValue)) {
|
|
44
|
-
Object.assign(keyValues, keyValue);
|
|
45
|
-
} else if (typeof keyValue === 'string') {
|
|
46
|
-
try {
|
|
47
|
-
Object.assign(keyValues, JSON.parse(keyValue));
|
|
48
|
-
} catch (e) {
|
|
49
|
-
debug(`Error parsing key-values for test ${context}`, keyValue);
|
|
35
|
+
/**
|
|
36
|
+
* Returns key-values pairs for the test as object
|
|
37
|
+
* @param {*} context testId or test context from test runner
|
|
38
|
+
* @returns {{[key: string]: string} | {}} key-values pairs as object, e.g. {priority: 'high', browser: 'chrome'}
|
|
39
|
+
*/
|
|
40
|
+
get(context = null) {
|
|
41
|
+
const keyValuesList = data_storage_js_1.dataStorage.getData('keyvalue', context);
|
|
42
|
+
if (!keyValuesList || !keyValuesList?.length)
|
|
43
|
+
return {};
|
|
44
|
+
const keyValues = {};
|
|
45
|
+
for (const keyValue of keyValuesList) {
|
|
46
|
+
if (this.#isKeyValueObject(keyValue)) {
|
|
47
|
+
Object.assign(keyValues, keyValue);
|
|
48
|
+
}
|
|
49
|
+
else if (typeof keyValue === 'string') {
|
|
50
|
+
try {
|
|
51
|
+
Object.assign(keyValues, JSON.parse(keyValue));
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
debug(`Error parsing key-values for test ${context}`, keyValue);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
50
57
|
}
|
|
51
|
-
|
|
58
|
+
return keyValues;
|
|
52
59
|
}
|
|
53
|
-
|
|
54
|
-
return keyValues;
|
|
55
|
-
}
|
|
56
60
|
}
|
|
57
|
-
|
|
58
|
-
module.exports.keyValueStorage = KeyValueStorage.getInstance();
|
|
61
|
+
exports.keyValueStorage = KeyValueStorage.getInstance();
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export const logger: Logger;
|
|
2
|
+
/**
|
|
3
|
+
* Logger allows to intercept logs from any logger (console.log, tracer, pino, etc)
|
|
4
|
+
* and save in the testomatio reporter.
|
|
5
|
+
* Supports different syntaxes to satisfy any user preferences.
|
|
6
|
+
*/
|
|
7
|
+
declare class Logger {
|
|
8
|
+
static "__#12@#instance": any;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @returns {Logger}
|
|
12
|
+
*/
|
|
13
|
+
static getInstance(): Logger;
|
|
14
|
+
logLevel: string;
|
|
15
|
+
/**
|
|
16
|
+
* Allows you to define a step inside a test. Step name is attached to the report and
|
|
17
|
+
* helps to understand the test flow.
|
|
18
|
+
* @param {*} strings
|
|
19
|
+
* @param {...any} values
|
|
20
|
+
*/
|
|
21
|
+
step(strings: any, ...values: any[]): void;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {string} context testId or test context from test runner
|
|
25
|
+
* @returns {string[]}
|
|
26
|
+
*/
|
|
27
|
+
getLogs(context: string): string[];
|
|
28
|
+
/**
|
|
29
|
+
* Tagget template literal. Allows to use different syntaxes:
|
|
30
|
+
* 1. Tagget template: log`text ${someVar}`
|
|
31
|
+
* 2. Standard: log(`text ${someVar}`)
|
|
32
|
+
* 3. Standard with multiple arguments: log('text', someVar)
|
|
33
|
+
*/
|
|
34
|
+
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
35
|
+
assert(...args: any[]): void;
|
|
36
|
+
debug(...args: any[]): void;
|
|
37
|
+
error(...args: any[]): void;
|
|
38
|
+
info(...args: any[]): void;
|
|
39
|
+
log(...args: any[]): void;
|
|
40
|
+
trace(...args: any[]): void;
|
|
41
|
+
warn(...args: any[]): void;
|
|
42
|
+
/**
|
|
43
|
+
* Intercepts user logger messages.
|
|
44
|
+
* When call this method, Logger start to control the user logger
|
|
45
|
+
* @param {*} userLogger
|
|
46
|
+
*/
|
|
47
|
+
intercept(userLogger: any): void;
|
|
48
|
+
stopInterception(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Allows to configure logger. Make sure you do it before the logger usage in your code.
|
|
51
|
+
*
|
|
52
|
+
* @param {Object} [config={}] - The configuration object.
|
|
53
|
+
* @param {string} [config.logLevel] - The desired log level. Valid values are 'DEBUG', 'INFO', 'WARN', and 'ERROR'.
|
|
54
|
+
* @param {boolean} [config.prettyObjects] - Specifies whether to enable pretty printing of objects.
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
57
|
+
configure(config?: {
|
|
58
|
+
logLevel?: string;
|
|
59
|
+
prettyObjects?: boolean;
|
|
60
|
+
}): void;
|
|
61
|
+
prettyObjects: boolean;
|
|
62
|
+
#private;
|
|
63
|
+
}
|
|
64
|
+
export {};
|