@tiden/reporter-commons 0.1.0
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/CHANGELOG.md +25 -0
- package/LICENSE +201 -0
- package/README.md +34 -0
- package/dist/client/interface.d.ts +8 -0
- package/dist/client/interface.js +2 -0
- package/dist/client/reporter-api-models.d.ts +96 -0
- package/dist/client/reporter-api-models.js +2 -0
- package/dist/client/reporter-api.d.ts +14 -0
- package/dist/client/reporter-api.js +25 -0
- package/dist/client/services/api-error-handler.d.ts +10 -0
- package/dist/client/services/api-error-handler.js +44 -0
- package/dist/client/services/attachment-service.d.ts +29 -0
- package/dist/client/services/attachment-service.js +268 -0
- package/dist/client/services/result-transformer.d.ts +21 -0
- package/dist/client/services/result-transformer.js +180 -0
- package/dist/client/services/run-service.d.ts +20 -0
- package/dist/client/services/run-service.js +68 -0
- package/dist/client/tiden-client.d.ts +34 -0
- package/dist/client/tiden-client.js +99 -0
- package/dist/client/tiden-http.d.ts +11 -0
- package/dist/client/tiden-http.js +23 -0
- package/dist/config/config-loader-interface.d.ts +4 -0
- package/dist/config/config-loader-interface.js +2 -0
- package/dist/config/config-loader.d.ts +10 -0
- package/dist/config/config-loader.js +60 -0
- package/dist/config/config-type.d.ts +2 -0
- package/dist/config/config-type.js +2 -0
- package/dist/config/config-validation-schema.d.ts +212 -0
- package/dist/config/config-validation-schema.js +213 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.js +7 -0
- package/dist/core/options-resolver.d.ts +19 -0
- package/dist/core/options-resolver.js +47 -0
- package/dist/core/reporter-factory.d.ts +18 -0
- package/dist/core/reporter-factory.js +63 -0
- package/dist/core/status-processor.d.ts +17 -0
- package/dist/core/status-processor.js +48 -0
- package/dist/env/env-enum.d.ts +64 -0
- package/dist/env/env-enum.js +75 -0
- package/dist/env/env-to-config.d.ts +7 -0
- package/dist/env/env-to-config.js +60 -0
- package/dist/env/env-type.d.ts +29 -0
- package/dist/env/env-type.js +3 -0
- package/dist/env/env-validation-schema.d.ts +6 -0
- package/dist/env/env-validation-schema.js +113 -0
- package/dist/env/index.d.ts +4 -0
- package/dist/env/index.js +13 -0
- package/dist/formatter/formatter-interface.d.ts +3 -0
- package/dist/formatter/formatter-interface.js +2 -0
- package/dist/formatter/index.d.ts +4 -0
- package/dist/formatter/index.js +9 -0
- package/dist/formatter/json-formatter.d.ts +13 -0
- package/dist/formatter/json-formatter.js +28 -0
- package/dist/formatter/jsonp-formatter.d.ts +13 -0
- package/dist/formatter/jsonp-formatter.js +29 -0
- package/dist/formatter/report-serializer.d.ts +20 -0
- package/dist/formatter/report-serializer.js +92 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +30 -0
- package/dist/internal/filter-positive-ids.d.ts +17 -0
- package/dist/internal/filter-positive-ids.js +38 -0
- package/dist/internal/ids-parser.d.ts +9 -0
- package/dist/internal/ids-parser.js +21 -0
- package/dist/internal/index.d.ts +8 -0
- package/dist/internal/index.js +15 -0
- package/dist/internal/step-parser.d.ts +11 -0
- package/dist/internal/step-parser.js +28 -0
- package/dist/internal/suite-file.d.ts +13 -0
- package/dist/internal/suite-file.js +16 -0
- package/dist/internal/suite-normalizer.d.ts +6 -0
- package/dist/internal/suite-normalizer.js +11 -0
- package/dist/internal/title.d.ts +5 -0
- package/dist/internal/title.js +15 -0
- package/dist/models/attachment.d.ts +8 -0
- package/dist/models/attachment.js +2 -0
- package/dist/models/config/TidenOptionsType.d.ts +33 -0
- package/dist/models/config/TidenOptionsType.js +2 -0
- package/dist/models/configuration.d.ts +12 -0
- package/dist/models/configuration.js +2 -0
- package/dist/models/error.d.ts +7 -0
- package/dist/models/error.js +24 -0
- package/dist/models/execution-sum.d.ts +6 -0
- package/dist/models/execution-sum.js +2 -0
- package/dist/models/host-data.d.ts +12 -0
- package/dist/models/host-data.js +2 -0
- package/dist/models/index.d.ts +11 -0
- package/dist/models/index.js +15 -0
- package/dist/models/report.d.ts +14 -0
- package/dist/models/report.js +2 -0
- package/dist/models/short-result.d.ts +7 -0
- package/dist/models/short-result.js +2 -0
- package/dist/models/stats.d.ts +9 -0
- package/dist/models/stats.js +2 -0
- package/dist/models/step-data.d.ts +19 -0
- package/dist/models/step-data.js +2 -0
- package/dist/models/step-execution.d.ts +13 -0
- package/dist/models/step-execution.js +23 -0
- package/dist/models/test-execution.d.ts +20 -0
- package/dist/models/test-execution.js +32 -0
- package/dist/models/test-result.d.ts +44 -0
- package/dist/models/test-result.js +50 -0
- package/dist/models/test-step.d.ts +18 -0
- package/dist/models/test-step.js +53 -0
- package/dist/options/composeOptions.d.ts +8 -0
- package/dist/options/composeOptions.js +12 -0
- package/dist/options/index.d.ts +3 -0
- package/dist/options/index.js +7 -0
- package/dist/options/mode-enum.d.ts +8 -0
- package/dist/options/mode-enum.js +12 -0
- package/dist/options/options-type.d.ts +38 -0
- package/dist/options/options-type.js +3 -0
- package/dist/profilers/abstract-profiler.d.ts +5 -0
- package/dist/profilers/abstract-profiler.js +6 -0
- package/dist/profilers/fetch-interceptor.d.ts +60 -0
- package/dist/profilers/fetch-interceptor.js +277 -0
- package/dist/profilers/http-interceptor.d.ts +76 -0
- package/dist/profilers/http-interceptor.js +252 -0
- package/dist/profilers/index.d.ts +5 -0
- package/dist/profilers/index.js +11 -0
- package/dist/profilers/network-profiler.d.ts +61 -0
- package/dist/profilers/network-profiler.js +94 -0
- package/dist/reporters/abstract-reporter.d.ts +68 -0
- package/dist/reporters/abstract-reporter.js +78 -0
- package/dist/reporters/index.d.ts +3 -0
- package/dist/reporters/index.js +9 -0
- package/dist/reporters/report-reporter.d.ts +50 -0
- package/dist/reporters/report-reporter.js +167 -0
- package/dist/reporters/run-reporter.d.ts +65 -0
- package/dist/reporters/run-reporter.js +155 -0
- package/dist/reporters/shared/fallback-coordinator.d.ts +47 -0
- package/dist/reporters/shared/fallback-coordinator.js +119 -0
- package/dist/reporters/shared/run-constants.d.ts +11 -0
- package/dist/reporters/shared/run-constants.js +14 -0
- package/dist/state/state.d.ts +16 -0
- package/dist/state/state.js +70 -0
- package/dist/steps/step.d.ts +16 -0
- package/dist/steps/step.js +86 -0
- package/dist/tiden.d.ts +48 -0
- package/dist/tiden.js +223 -0
- package/dist/utils/disabled-exception.d.ts +6 -0
- package/dist/utils/disabled-exception.js +10 -0
- package/dist/utils/get-package-version.d.ts +5 -0
- package/dist/utils/get-package-version.js +25 -0
- package/dist/utils/hostData.d.ts +8 -0
- package/dist/utils/hostData.js +140 -0
- package/dist/utils/is-axios-error.d.ts +6 -0
- package/dist/utils/is-axios-error.js +11 -0
- package/dist/utils/logger.d.ts +33 -0
- package/dist/utils/logger.js +141 -0
- package/dist/utils/mimeTypes.d.ts +5 -0
- package/dist/utils/mimeTypes.js +50 -0
- package/dist/utils/project-mapping-utils.d.ts +17 -0
- package/dist/utils/project-mapping-utils.js +29 -0
- package/dist/utils/signature.d.ts +11 -0
- package/dist/utils/signature.js +34 -0
- package/dist/utils/status-mapping-utils.d.ts +14 -0
- package/dist/utils/status-mapping-utils.js +45 -0
- package/dist/utils/test-status-utils.d.ts +8 -0
- package/dist/utils/test-status-utils.js +152 -0
- package/dist/utils/tiden-error.d.ts +18 -0
- package/dist/utils/tiden-error.js +19 -0
- package/dist/utils/token-masker.d.ts +11 -0
- package/dist/utils/token-masker.js +26 -0
- package/dist/utils/validate-json.d.ts +20 -0
- package/dist/utils/validate-json.js +41 -0
- package/dist/writer/driver-enum.d.ts +13 -0
- package/dist/writer/driver-enum.js +18 -0
- package/dist/writer/fs-writer.d.ts +40 -0
- package/dist/writer/fs-writer.js +139 -0
- package/dist/writer/index.d.ts +3 -0
- package/dist/writer/index.js +8 -0
- package/dist/writer/writer-interface.d.ts +7 -0
- package/dist/writer/writer-interface.js +2 -0
- package/package.json +83 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TidenApiClient = void 0;
|
|
4
|
+
const axios_1 = require("axios");
|
|
5
|
+
const tiden_http_1 = require("./tiden-http");
|
|
6
|
+
const run_service_1 = require("./services/run-service");
|
|
7
|
+
const attachment_service_1 = require("./services/attachment-service");
|
|
8
|
+
const result_transformer_1 = require("./services/result-transformer");
|
|
9
|
+
const reporter_api_1 = require("./reporter-api");
|
|
10
|
+
const api_error_handler_1 = require("./services/api-error-handler");
|
|
11
|
+
/**
|
|
12
|
+
* Facade over the Tiden REST API.
|
|
13
|
+
*
|
|
14
|
+
* The JSON endpoints (create/report/complete) go through the narrow reporter
|
|
15
|
+
* API. Its types are checked against the generated OpenAPI snapshot at test
|
|
16
|
+
* time without making that full client a runtime dependency. Attachment
|
|
17
|
+
* upload stays hand-written because it is multipart. Both share one axios
|
|
18
|
+
* instance.
|
|
19
|
+
*/
|
|
20
|
+
class TidenApiClient {
|
|
21
|
+
logger;
|
|
22
|
+
config;
|
|
23
|
+
environment;
|
|
24
|
+
http;
|
|
25
|
+
api;
|
|
26
|
+
runService;
|
|
27
|
+
attachmentService;
|
|
28
|
+
resultTransformer;
|
|
29
|
+
constructor(logger, config, environment, rootSuite) {
|
|
30
|
+
this.logger = logger;
|
|
31
|
+
this.config = config;
|
|
32
|
+
this.environment = environment;
|
|
33
|
+
this.http = (0, tiden_http_1.createTidenClient)(config.api.baseUrl ?? '', config.api.token);
|
|
34
|
+
this.api = new reporter_api_1.ReporterApi(this.http);
|
|
35
|
+
this.runService = new run_service_1.RunService(logger, this.api);
|
|
36
|
+
this.attachmentService = new attachment_service_1.AttachmentService(logger, this.http);
|
|
37
|
+
this.resultTransformer = new result_transformer_1.ResultTransformer(logger, rootSuite);
|
|
38
|
+
}
|
|
39
|
+
async createRun() {
|
|
40
|
+
return this.runService.createRun(this.config, this.environment);
|
|
41
|
+
}
|
|
42
|
+
async completeRun(runId) {
|
|
43
|
+
return this.runService.completeRun(runId, this.config);
|
|
44
|
+
}
|
|
45
|
+
async uploadAttachment(attachment) {
|
|
46
|
+
return this.attachmentService.uploadAttachment(this.config.product, attachment);
|
|
47
|
+
}
|
|
48
|
+
/** Public run report links have no Tiden equivalent in v1. */
|
|
49
|
+
enablePublicReport(_runId) {
|
|
50
|
+
this.logger.logDebug('Public report links are not supported; skipping');
|
|
51
|
+
return Promise.resolve();
|
|
52
|
+
}
|
|
53
|
+
async uploadResults(runId, results) {
|
|
54
|
+
try {
|
|
55
|
+
const models = await Promise.all(results.map((result) => this.resultTransformer.transformWithDefect(result, (a) => this.attachmentService
|
|
56
|
+
.uploadAttachments(this.config.product, [a], this.config.uploadAttachments ?? true)
|
|
57
|
+
.then((hashes) => hashes[0] ?? ''), this.config.defect ?? false)));
|
|
58
|
+
await this.postResultsWithRetry(runId, models);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
throw (0, api_error_handler_1.processError)(error, 'Error on uploading results', results);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** 429-only retry (Retry-After honored, exp backoff, 30s cap); 400 is
|
|
65
|
+
* terminal — resending an identical batch fails identically, so log
|
|
66
|
+
* every per-entry ReportError from details[] and re-throw. */
|
|
67
|
+
async postResultsWithRetry(runId, models, maxRetries = 5) {
|
|
68
|
+
let delay = 1000;
|
|
69
|
+
for (let attempt = 0;; attempt++) {
|
|
70
|
+
try {
|
|
71
|
+
const { data } = await this.api.reportResults(this.config.product, runId, { results: models });
|
|
72
|
+
// `accepted`/`duplicates` are int64s (strings on the wire). Duplicates
|
|
73
|
+
// are the server's idempotency check recognising a result `id` it has
|
|
74
|
+
// already stored — a re-reported batch is dropped there, not here.
|
|
75
|
+
this.logger.logDebug(`Reported ${models.length} result(s): accepted=${data.accepted ?? '?'} duplicates=${data.duplicates ?? '?'}`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if ((0, axios_1.isAxiosError)(error) && error.response?.status === 429 && attempt < maxRetries) {
|
|
80
|
+
const retryAfter = Number(error.response.headers['retry-after']);
|
|
81
|
+
const wait = Number.isFinite(retryAfter) && retryAfter >= 0 ? retryAfter * 1000 : delay;
|
|
82
|
+
await new Promise((r) => setTimeout(r, Math.min(wait, 30_000)));
|
|
83
|
+
delay = Math.min(delay * 2, 30_000);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if ((0, axios_1.isAxiosError)(error) && error.response?.status === 400) {
|
|
87
|
+
const details = error.response.data?.details ?? [];
|
|
88
|
+
for (const d of details) {
|
|
89
|
+
if ((d['@type'] ?? '').endsWith('ReportError')) {
|
|
90
|
+
this.logger.logError(`Result #${d.index ?? '?'} (id=${d.resultId ?? '<none>'}) rejected: ${d.code ?? ''}: ${d.message ?? ''}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.TidenApiClient = TidenApiClient;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* Thin HTTP client for the Tiden REST API. Tiden authenticates with
|
|
4
|
+
* `Authorization: Bearer` (tokens are `tfy_...`) and takes the base URL
|
|
5
|
+
* verbatim — no self-host URL templating.
|
|
6
|
+
*
|
|
7
|
+
* This instance is the single transport for everything commons sends: the
|
|
8
|
+
* narrow reporter API and multipart attachment upload both use it. baseURL,
|
|
9
|
+
* auth and timeout therefore live here and nowhere else.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createTidenClient(baseUrl: string, token: string): AxiosInstance;
|
|
@@ -0,0 +1,23 @@
|
|
|
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.createTidenClient = createTidenClient;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
/**
|
|
9
|
+
* Thin HTTP client for the Tiden REST API. Tiden authenticates with
|
|
10
|
+
* `Authorization: Bearer` (tokens are `tfy_...`) and takes the base URL
|
|
11
|
+
* verbatim — no self-host URL templating.
|
|
12
|
+
*
|
|
13
|
+
* This instance is the single transport for everything commons sends: the
|
|
14
|
+
* narrow reporter API and multipart attachment upload both use it. baseURL,
|
|
15
|
+
* auth and timeout therefore live here and nowhere else.
|
|
16
|
+
*/
|
|
17
|
+
function createTidenClient(baseUrl, token) {
|
|
18
|
+
return axios_1.default.create({
|
|
19
|
+
baseURL: baseUrl.replace(/\/$/, ''),
|
|
20
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
21
|
+
timeout: 30_000,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { ConfigLoaderInterface } from './config-loader-interface';
|
|
3
|
+
import { ConfigType } from './config-type';
|
|
4
|
+
export declare class ConfigLoader<T extends Partial<ConfigType> & Record<string, unknown>> implements ConfigLoaderInterface<T> {
|
|
5
|
+
private paths;
|
|
6
|
+
private validationSchema;
|
|
7
|
+
constructor(validationSchema?: JSONSchemaType<T>, paths?: string[]);
|
|
8
|
+
private read;
|
|
9
|
+
load(): (T & ConfigType) | null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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.ConfigLoader = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
10
|
+
const tiden_error_1 = require("../utils/tiden-error");
|
|
11
|
+
const validate_json_1 = require("../utils/validate-json");
|
|
12
|
+
const config_validation_schema_1 = require("./config-validation-schema");
|
|
13
|
+
class ConfigLoader {
|
|
14
|
+
paths;
|
|
15
|
+
validationSchema;
|
|
16
|
+
constructor(validationSchema, paths = ['tiden.config.json']) {
|
|
17
|
+
this.paths = paths;
|
|
18
|
+
this.validationSchema = (0, lodash_merge_1.default)({}, config_validation_schema_1.configValidationSchema, validationSchema);
|
|
19
|
+
}
|
|
20
|
+
read() {
|
|
21
|
+
for (const path of this.paths) {
|
|
22
|
+
const filePath = (0, path_1.join)(process.cwd(), path);
|
|
23
|
+
try {
|
|
24
|
+
return (0, fs_1.readFileSync)(filePath, 'utf8');
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
const isNotFound = error instanceof Error &&
|
|
28
|
+
'code' in error &&
|
|
29
|
+
(error.code === 'ENOENT' || error.code === 'EISDIR');
|
|
30
|
+
if (!isNotFound) {
|
|
31
|
+
throw new tiden_error_1.TidenError('Cannot read config file', { cause: error });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
load() {
|
|
38
|
+
try {
|
|
39
|
+
const data = this.read();
|
|
40
|
+
if (data) {
|
|
41
|
+
const json = JSON.parse(data);
|
|
42
|
+
(0, validate_json_1.validateJson)(this.validationSchema, json);
|
|
43
|
+
return json;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (error instanceof validate_json_1.JsonValidationError) {
|
|
48
|
+
const [validationError] = error.validationErrors;
|
|
49
|
+
const { instancePath = '', message = '' } = validationError ?? {};
|
|
50
|
+
const configPath = instancePath
|
|
51
|
+
? `\`${instancePath.substring(1).replace('/', '.')}\``
|
|
52
|
+
: 'it';
|
|
53
|
+
throw new Error(`Invalid config: "${configPath}" ${message}`);
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.ConfigLoader = ConfigLoader;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { ModeEnum } from '../options';
|
|
2
|
+
import { DriverEnum, FormatEnum } from '../writer';
|
|
3
|
+
/**
|
|
4
|
+
* @type {JSONSchemaType<ConfigType>}
|
|
5
|
+
*/
|
|
6
|
+
export declare const configValidationSchema: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
mode: {
|
|
10
|
+
type: string;
|
|
11
|
+
enum: ModeEnum[];
|
|
12
|
+
nullable: boolean;
|
|
13
|
+
};
|
|
14
|
+
fallback: {
|
|
15
|
+
type: string;
|
|
16
|
+
enum: ModeEnum[];
|
|
17
|
+
nullable: boolean;
|
|
18
|
+
};
|
|
19
|
+
debug: {
|
|
20
|
+
type: string;
|
|
21
|
+
nullable: boolean;
|
|
22
|
+
};
|
|
23
|
+
environment: {
|
|
24
|
+
type: string;
|
|
25
|
+
nullable: boolean;
|
|
26
|
+
};
|
|
27
|
+
captureLogs: {
|
|
28
|
+
type: string;
|
|
29
|
+
nullable: boolean;
|
|
30
|
+
};
|
|
31
|
+
rootSuite: {
|
|
32
|
+
type: string;
|
|
33
|
+
nullable: boolean;
|
|
34
|
+
};
|
|
35
|
+
statusMapping: {
|
|
36
|
+
type: string;
|
|
37
|
+
nullable: boolean;
|
|
38
|
+
additionalProperties: {
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
logging: {
|
|
43
|
+
type: string;
|
|
44
|
+
nullable: boolean;
|
|
45
|
+
properties: {
|
|
46
|
+
console: {
|
|
47
|
+
type: string;
|
|
48
|
+
nullable: boolean;
|
|
49
|
+
};
|
|
50
|
+
file: {
|
|
51
|
+
type: string;
|
|
52
|
+
nullable: boolean;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
tiden: {
|
|
57
|
+
type: string;
|
|
58
|
+
nullable: boolean;
|
|
59
|
+
properties: {
|
|
60
|
+
api: {
|
|
61
|
+
type: string;
|
|
62
|
+
nullable: boolean;
|
|
63
|
+
properties: {
|
|
64
|
+
token: {
|
|
65
|
+
type: string;
|
|
66
|
+
nullable: boolean;
|
|
67
|
+
};
|
|
68
|
+
baseUrl: {
|
|
69
|
+
type: string;
|
|
70
|
+
nullable: boolean;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
product: {
|
|
75
|
+
type: string;
|
|
76
|
+
nullable: boolean;
|
|
77
|
+
};
|
|
78
|
+
uploadAttachments: {
|
|
79
|
+
type: string;
|
|
80
|
+
nullable: boolean;
|
|
81
|
+
};
|
|
82
|
+
run: {
|
|
83
|
+
type: string;
|
|
84
|
+
nullable: boolean;
|
|
85
|
+
properties: {
|
|
86
|
+
id: {
|
|
87
|
+
type: string;
|
|
88
|
+
nullable: boolean;
|
|
89
|
+
};
|
|
90
|
+
title: {
|
|
91
|
+
type: string;
|
|
92
|
+
nullable: boolean;
|
|
93
|
+
};
|
|
94
|
+
description: {
|
|
95
|
+
type: string;
|
|
96
|
+
nullable: boolean;
|
|
97
|
+
};
|
|
98
|
+
complete: {
|
|
99
|
+
type: string;
|
|
100
|
+
nullable: boolean;
|
|
101
|
+
};
|
|
102
|
+
branch: {
|
|
103
|
+
type: string;
|
|
104
|
+
nullable: boolean;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
batch: {
|
|
109
|
+
type: string;
|
|
110
|
+
nullable: boolean;
|
|
111
|
+
properties: {
|
|
112
|
+
size: {
|
|
113
|
+
type: string;
|
|
114
|
+
nullable: boolean;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
defect: {
|
|
119
|
+
type: string;
|
|
120
|
+
nullable: boolean;
|
|
121
|
+
};
|
|
122
|
+
configurations: {
|
|
123
|
+
type: string;
|
|
124
|
+
nullable: boolean;
|
|
125
|
+
properties: {
|
|
126
|
+
values: {
|
|
127
|
+
type: string;
|
|
128
|
+
items: {
|
|
129
|
+
type: string;
|
|
130
|
+
properties: {
|
|
131
|
+
name: {
|
|
132
|
+
type: string;
|
|
133
|
+
nullable: boolean;
|
|
134
|
+
};
|
|
135
|
+
value: {
|
|
136
|
+
type: string;
|
|
137
|
+
nullable: boolean;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
required: string[];
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
required: string[];
|
|
145
|
+
};
|
|
146
|
+
statusFilter: {
|
|
147
|
+
type: string;
|
|
148
|
+
items: {
|
|
149
|
+
type: string;
|
|
150
|
+
};
|
|
151
|
+
nullable: boolean;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
report: {
|
|
156
|
+
type: string;
|
|
157
|
+
nullable: boolean;
|
|
158
|
+
properties: {
|
|
159
|
+
driver: {
|
|
160
|
+
type: string;
|
|
161
|
+
enum: DriverEnum[];
|
|
162
|
+
nullable: boolean;
|
|
163
|
+
};
|
|
164
|
+
connections: {
|
|
165
|
+
type: string;
|
|
166
|
+
nullable: boolean;
|
|
167
|
+
properties: {
|
|
168
|
+
local: {
|
|
169
|
+
type: string;
|
|
170
|
+
nullable: boolean;
|
|
171
|
+
properties: {
|
|
172
|
+
path: {
|
|
173
|
+
type: string;
|
|
174
|
+
nullable: boolean;
|
|
175
|
+
};
|
|
176
|
+
format: {
|
|
177
|
+
type: string;
|
|
178
|
+
enum: FormatEnum[];
|
|
179
|
+
nullable: boolean;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
profilers: {
|
|
188
|
+
type: string;
|
|
189
|
+
items: {
|
|
190
|
+
type: string;
|
|
191
|
+
};
|
|
192
|
+
nullable: boolean;
|
|
193
|
+
};
|
|
194
|
+
networkProfiler: {
|
|
195
|
+
type: string;
|
|
196
|
+
nullable: boolean;
|
|
197
|
+
properties: {
|
|
198
|
+
skip_domains: {
|
|
199
|
+
type: string;
|
|
200
|
+
items: {
|
|
201
|
+
type: string;
|
|
202
|
+
};
|
|
203
|
+
nullable: boolean;
|
|
204
|
+
};
|
|
205
|
+
track_on_fail: {
|
|
206
|
+
type: string;
|
|
207
|
+
nullable: boolean;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configValidationSchema = void 0;
|
|
4
|
+
const options_1 = require("../options");
|
|
5
|
+
const writer_1 = require("../writer");
|
|
6
|
+
/**
|
|
7
|
+
* @type {JSONSchemaType<ConfigType>}
|
|
8
|
+
*/
|
|
9
|
+
exports.configValidationSchema = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
mode: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
enum: [options_1.ModeEnum.report, options_1.ModeEnum.tiden, options_1.ModeEnum.off],
|
|
15
|
+
nullable: true,
|
|
16
|
+
},
|
|
17
|
+
fallback: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
enum: [options_1.ModeEnum.report, options_1.ModeEnum.tiden, options_1.ModeEnum.off],
|
|
20
|
+
nullable: true,
|
|
21
|
+
},
|
|
22
|
+
debug: {
|
|
23
|
+
type: 'boolean',
|
|
24
|
+
nullable: true,
|
|
25
|
+
},
|
|
26
|
+
environment: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
nullable: true,
|
|
29
|
+
},
|
|
30
|
+
captureLogs: {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
nullable: true,
|
|
33
|
+
},
|
|
34
|
+
rootSuite: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
nullable: true,
|
|
37
|
+
},
|
|
38
|
+
statusMapping: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
nullable: true,
|
|
41
|
+
additionalProperties: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
logging: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
nullable: true,
|
|
48
|
+
properties: {
|
|
49
|
+
console: {
|
|
50
|
+
type: 'boolean',
|
|
51
|
+
nullable: true,
|
|
52
|
+
},
|
|
53
|
+
file: {
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
nullable: true,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
tiden: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
nullable: true,
|
|
62
|
+
properties: {
|
|
63
|
+
api: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
nullable: true,
|
|
66
|
+
properties: {
|
|
67
|
+
token: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
nullable: true,
|
|
70
|
+
},
|
|
71
|
+
baseUrl: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
nullable: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
product: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
nullable: true,
|
|
80
|
+
},
|
|
81
|
+
uploadAttachments: {
|
|
82
|
+
type: 'boolean',
|
|
83
|
+
nullable: true,
|
|
84
|
+
},
|
|
85
|
+
run: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
nullable: true,
|
|
88
|
+
properties: {
|
|
89
|
+
id: {
|
|
90
|
+
type: 'number',
|
|
91
|
+
nullable: true,
|
|
92
|
+
},
|
|
93
|
+
title: {
|
|
94
|
+
type: 'string',
|
|
95
|
+
nullable: true,
|
|
96
|
+
},
|
|
97
|
+
description: {
|
|
98
|
+
type: 'string',
|
|
99
|
+
nullable: true,
|
|
100
|
+
},
|
|
101
|
+
complete: {
|
|
102
|
+
type: 'boolean',
|
|
103
|
+
nullable: true,
|
|
104
|
+
},
|
|
105
|
+
branch: {
|
|
106
|
+
type: 'string',
|
|
107
|
+
nullable: true,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
batch: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
nullable: true,
|
|
114
|
+
properties: {
|
|
115
|
+
size: {
|
|
116
|
+
type: 'number',
|
|
117
|
+
nullable: true,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
defect: {
|
|
122
|
+
type: 'boolean',
|
|
123
|
+
nullable: true,
|
|
124
|
+
},
|
|
125
|
+
configurations: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
nullable: true,
|
|
128
|
+
properties: {
|
|
129
|
+
values: {
|
|
130
|
+
type: 'array',
|
|
131
|
+
items: {
|
|
132
|
+
type: 'object',
|
|
133
|
+
properties: {
|
|
134
|
+
name: {
|
|
135
|
+
type: 'string',
|
|
136
|
+
nullable: true,
|
|
137
|
+
},
|
|
138
|
+
value: {
|
|
139
|
+
type: 'string',
|
|
140
|
+
nullable: true,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
required: ['name', 'value'],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
required: ['values'],
|
|
148
|
+
},
|
|
149
|
+
statusFilter: {
|
|
150
|
+
type: 'array',
|
|
151
|
+
items: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
},
|
|
154
|
+
nullable: true,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
report: {
|
|
159
|
+
type: 'object',
|
|
160
|
+
nullable: true,
|
|
161
|
+
properties: {
|
|
162
|
+
driver: {
|
|
163
|
+
type: 'string',
|
|
164
|
+
enum: [writer_1.DriverEnum.local],
|
|
165
|
+
nullable: true,
|
|
166
|
+
},
|
|
167
|
+
connections: {
|
|
168
|
+
type: 'object',
|
|
169
|
+
nullable: true,
|
|
170
|
+
properties: {
|
|
171
|
+
[writer_1.DriverEnum.local]: {
|
|
172
|
+
type: 'object',
|
|
173
|
+
nullable: true,
|
|
174
|
+
properties: {
|
|
175
|
+
path: {
|
|
176
|
+
type: 'string',
|
|
177
|
+
nullable: true,
|
|
178
|
+
},
|
|
179
|
+
format: {
|
|
180
|
+
type: 'string',
|
|
181
|
+
enum: [writer_1.FormatEnum.json, writer_1.FormatEnum.jsonp],
|
|
182
|
+
nullable: true,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
profilers: {
|
|
191
|
+
type: 'array',
|
|
192
|
+
items: {
|
|
193
|
+
type: 'string',
|
|
194
|
+
},
|
|
195
|
+
nullable: true,
|
|
196
|
+
},
|
|
197
|
+
networkProfiler: {
|
|
198
|
+
type: 'object',
|
|
199
|
+
nullable: true,
|
|
200
|
+
properties: {
|
|
201
|
+
skip_domains: {
|
|
202
|
+
type: 'array',
|
|
203
|
+
items: { type: 'string' },
|
|
204
|
+
nullable: true,
|
|
205
|
+
},
|
|
206
|
+
track_on_fail: {
|
|
207
|
+
type: 'boolean',
|
|
208
|
+
nullable: true,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigLoader = exports.configValidationSchema = void 0;
|
|
4
|
+
var config_validation_schema_1 = require("./config-validation-schema");
|
|
5
|
+
Object.defineProperty(exports, "configValidationSchema", { enumerable: true, get: function () { return config_validation_schema_1.configValidationSchema; } });
|
|
6
|
+
var config_loader_1 = require("./config-loader");
|
|
7
|
+
Object.defineProperty(exports, "ConfigLoader", { enumerable: true, get: function () { return config_loader_1.ConfigLoader; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ModeEnum, OptionsType } from '../options';
|
|
2
|
+
import { ConfigType } from '../config';
|
|
3
|
+
export interface ResolvedOptions {
|
|
4
|
+
effectiveMode: ModeEnum;
|
|
5
|
+
effectiveFallback: ModeEnum;
|
|
6
|
+
composed: ConfigType & OptionsType;
|
|
7
|
+
withState: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Composes the final options used by TidenReporter:
|
|
11
|
+
* - restores mode / runId from state (when withState is active)
|
|
12
|
+
* - merges env-derived config with user options
|
|
13
|
+
* - determines effective mode / fallback values
|
|
14
|
+
*/
|
|
15
|
+
export declare class OptionsResolver {
|
|
16
|
+
resolve(options: OptionsType): ResolvedOptions;
|
|
17
|
+
private detectWithState;
|
|
18
|
+
private restoreFromState;
|
|
19
|
+
}
|