testit-js-commons 2.1.1 → 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, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
45
+ var _a, _b, _c, _d, _e, _f;
46
46
  return {
47
- url: (_b = (_a = base === null || base === void 0 ? void 0 : base.url) !== null && _a !== void 0 ? _a : env === null || env === void 0 ? void 0 : env.TMS_URL) !== null && _b !== void 0 ? _b : file.url,
48
- projectId: (_d = (_c = base === null || base === void 0 ? void 0 : base.projectId) !== null && _c !== void 0 ? _c : env === null || env === void 0 ? void 0 : env.TMS_PROJECT_ID) !== null && _d !== void 0 ? _d : file.projectId,
49
- testRunId: (_f = (_e = base === null || base === void 0 ? void 0 : base.testRunId) !== null && _e !== void 0 ? _e : env === null || env === void 0 ? void 0 : env.TMS_TEST_RUN_ID) !== null && _f !== void 0 ? _f : file.testRunId,
50
- testRunName: (_h = (_g = base === null || base === void 0 ? void 0 : base.testRunName) !== null && _g !== void 0 ? _g : env === null || env === void 0 ? void 0 : env.TMS_TEST_RUN_NAME) !== null && _h !== void 0 ? _h : file.testRunName,
51
- privateToken: (_k = (_j = base === null || base === void 0 ? void 0 : base.privateToken) !== null && _j !== void 0 ? _j : env === null || env === void 0 ? void 0 : env.TMS_PRIVATE_TOKEN) !== null && _k !== void 0 ? _k : file.privateToken,
52
- adapterMode: (_o = (_m = (_l = base === null || base === void 0 ? void 0 : base.adapterMode) !== null && _l !== void 0 ? _l : env === null || env === void 0 ? void 0 : env.TMS_ADAPTER_MODE) !== null && _m !== void 0 ? _m : file.adapterMode) !== null && _o !== void 0 ? _o : 0,
53
- configurationId: (_q = (_p = base === null || base === void 0 ? void 0 : base.configurationId) !== null && _p !== void 0 ? _p : env === null || env === void 0 ? void 0 : env.TMS_CONFIGURATION_ID) !== null && _q !== void 0 ? _q : file.configurationId,
54
- automaticCreationTestCases: (_t = (_s = (_r = base === null || base === void 0 ? void 0 : base.automaticCreationTestCases) !== null && _r !== void 0 ? _r : env === null || env === void 0 ? void 0 : env.TMS_AUTOMATIC_CREATION_TEST_CASES) !== null && _s !== void 0 ? _s : file.automaticCreationTestCases) !== null && _t !== void 0 ? _t : false,
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() {
@@ -48,8 +48,8 @@ class AutotestsService extends base_service_1.BaseService {
48
48
  });
49
49
  }
50
50
  loadFailedAutotest(autotest) {
51
- var _a, _b;
52
51
  return __awaiter(this, void 0, void 0, function* () {
52
+ var _a, _b;
53
53
  const originAutotest = yield this.getAutotestByExternalId(autotest.externalId);
54
54
  !originAutotest
55
55
  ? yield this.createAutotest(autotest)
@@ -68,8 +68,8 @@ class TestRunsService extends base_service_1.BaseService {
68
68
  });
69
69
  }
70
70
  getAutotests(testRunId) {
71
- var _a;
72
71
  return __awaiter(this, void 0, void 0, function* () {
72
+ var _a;
73
73
  const testRun = yield this.getTestRun(testRunId);
74
74
  return (_a = testRun.testResults) === null || _a === void 0 ? void 0 : _a.filter((autotest) => autotest.configurationId === this.config.configurationId);
75
75
  });
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "testit-js-commons",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "JavaScript commons for Test IT",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "source": "src/index.ts",
8
8
  "scripts": {
9
+ "prebuild": "npm install",
9
10
  "build": "tsc",
10
11
  "watch": "tsc -w"
11
12
  },
@@ -24,7 +25,7 @@
24
25
  },
25
26
  "dependencies": {
26
27
  "dotenv": "^16.0.3",
27
- "testit-api-client": "^4.1.0"
28
+ "testit-api-client": "~4.1.0"
28
29
  },
29
30
  "files": [
30
31
  "lib"