testit-js-commons 2.1.2 → 2.1.3
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.
|
@@ -4,4 +4,5 @@ export declare const DEFAULT_CONFIG_FILE = "tms.config.json";
|
|
|
4
4
|
export declare class ConfigComposer implements IConfigComposer {
|
|
5
5
|
compose(base?: Partial<AdapterConfig>): AdapterConfig;
|
|
6
6
|
merge(file: AdapterConfig, env?: Partial<EnvironmentOptions>, base?: Partial<AdapterConfig>): AdapterConfig;
|
|
7
|
+
private resolveProperty;
|
|
7
8
|
}
|
|
@@ -42,18 +42,34 @@ class ConfigComposer {
|
|
|
42
42
|
return this.merge(config, environment, base);
|
|
43
43
|
}
|
|
44
44
|
merge(file, env, base) {
|
|
45
|
-
var _a, _b, _c, _d, _e, _f
|
|
45
|
+
var _a, _b, _c, _d, _e, _f;
|
|
46
46
|
return {
|
|
47
|
-
url: (
|
|
48
|
-
projectId: (
|
|
49
|
-
testRunId: (
|
|
50
|
-
testRunName: (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
url: this.resolveProperty(file.url, env === null || env === void 0 ? void 0 : env.TMS_URL, base === null || base === void 0 ? void 0 : base.url),
|
|
48
|
+
projectId: this.resolveProperty(file.projectId, env === null || env === void 0 ? void 0 : env.TMS_PROJECT_ID, base === null || base === void 0 ? void 0 : base.projectId),
|
|
49
|
+
testRunId: this.resolveProperty(file.testRunId, env === null || env === void 0 ? void 0 : env.TMS_TEST_RUN_ID, base === null || base === void 0 ? void 0 : base.testRunId),
|
|
50
|
+
testRunName: this.resolveProperty(file.testRunName, env === null || env === void 0 ? void 0 : env.TMS_TEST_RUN_NAME, base === null || base === void 0 ? void 0 : base.testRunName) == ""
|
|
51
|
+
? undefined
|
|
52
|
+
: this.resolveProperty(file.testRunName, env === null || env === void 0 ? void 0 : env.TMS_TEST_RUN_NAME, base === null || base === void 0 ? void 0 : base.testRunName),
|
|
53
|
+
privateToken: this.resolveProperty(file.privateToken, env === null || env === void 0 ? void 0 : env.TMS_PRIVATE_TOKEN, base === null || base === void 0 ? void 0 : base.privateToken),
|
|
54
|
+
adapterMode: (_c = (_b = (_a = base === null || base === void 0 ? void 0 : base.adapterMode) !== null && _a !== void 0 ? _a : env === null || env === void 0 ? void 0 : env.TMS_ADAPTER_MODE) !== null && _b !== void 0 ? _b : file.adapterMode) !== null && _c !== void 0 ? _c : 0,
|
|
55
|
+
configurationId: this.resolveProperty(file.configurationId, env === null || env === void 0 ? void 0 : env.TMS_CONFIGURATION_ID, base === null || base === void 0 ? void 0 : base.configurationId),
|
|
56
|
+
automaticCreationTestCases: (_f = (_e = (_d = base === null || base === void 0 ? void 0 : base.automaticCreationTestCases) !== null && _d !== void 0 ? _d : env === null || env === void 0 ? void 0 : env.TMS_AUTOMATIC_CREATION_TEST_CASES) !== null && _e !== void 0 ? _e : file.automaticCreationTestCases) !== null && _f !== void 0 ? _f : false,
|
|
55
57
|
};
|
|
56
58
|
}
|
|
59
|
+
resolveProperty(file, env, base) {
|
|
60
|
+
if (base && base.trim()) {
|
|
61
|
+
return base;
|
|
62
|
+
}
|
|
63
|
+
else if (env && env.trim()) {
|
|
64
|
+
return env;
|
|
65
|
+
}
|
|
66
|
+
else if (file && file.trim()) {
|
|
67
|
+
return file;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
57
73
|
}
|
|
58
74
|
exports.ConfigComposer = ConfigComposer;
|
|
59
75
|
function parseEnvConfig() {
|