qase-javascript-commons 2.0.11 → 2.0.13

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 CHANGED
@@ -1,3 +1,17 @@
1
+ # qase-javascript-commons@2.0.13
2
+
3
+ ## What's new
4
+
5
+ - If a plan ID is specified then when creating a test run it also specifies the plan ID.
6
+ - If a test run ID is specified then the reporter won't check for the existence of a test run.
7
+
8
+ # qase-javascript-commons@2.0.12
9
+
10
+ ## What's new
11
+
12
+ Support qaseio package version 2.2.0
13
+
14
+
1
15
  # qase-javascript-commons@2.0.11
2
16
 
3
17
  ## What's new
@@ -62,10 +62,15 @@ export declare class TestOpsReporter extends AbstractReporter {
62
62
  */
63
63
  private run;
64
64
  /**
65
- * @type { number | undefined}
65
+ * @type { string | undefined}
66
66
  * @private
67
67
  */
68
68
  private readonly environment;
69
+ /**
70
+ * @type { number | undefined}
71
+ * @private
72
+ */
73
+ private readonly planId;
69
74
  /**
70
75
  * @type {TestResultType[]}
71
76
  * @private
@@ -167,12 +172,6 @@ export declare class TestOpsReporter extends AbstractReporter {
167
172
  */
168
173
  private transformStepsV1;
169
174
  private logEmptyStep;
170
- /**
171
- * @param {number} runId
172
- * @returns {Promise<void>}
173
- * @private
174
- */
175
- private checkRun;
176
175
  /**
177
176
  * @param {string} title
178
177
  * @param {string} description
@@ -26,7 +26,7 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
26
26
  * @param {string | undefined} baseUrl
27
27
  */
28
28
  constructor(logger, options, api, environment, rootSuite, baseUrl) {
29
- const { project, uploadAttachments, run, } = options;
29
+ const { project, uploadAttachments, run, plan } = options;
30
30
  super(logger);
31
31
  this.api = api;
32
32
  /**
@@ -44,6 +44,7 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
44
44
  this.isUploadAttachments = uploadAttachments;
45
45
  this.run = { complete: true, ...run };
46
46
  this.environment = environment;
47
+ this.planId = plan.id;
47
48
  this.batchSize = options.batch?.size ?? defaultChunkSize;
48
49
  this.useV2 = options.useV2 ?? false;
49
50
  this.defect = options.defect ?? false;
@@ -86,8 +87,6 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
86
87
  */
87
88
  async checkOrCreateTestRun() {
88
89
  if (this.run.id !== undefined) {
89
- this.logger.logDebug('Check test run');
90
- await this.checkRun(this.run.id);
91
90
  this.isTestRunReady = true;
92
91
  return;
93
92
  }
@@ -95,7 +94,7 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
95
94
  let environmentId;
96
95
  if (this.environment != undefined) {
97
96
  try {
98
- const { data } = await this.api.environment.getEnvironments(this.projectCode, 100);
97
+ const { data } = await this.api.environment.getEnvironments(this.projectCode, undefined, this.environment, 100);
99
98
  const env = data.result?.entities?.find((env) => env.slug === this.environment);
100
99
  if (env) {
101
100
  environmentId = env.id;
@@ -369,20 +368,6 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
369
368
  logEmptyStep(testTitle) {
370
369
  this.logger.log((0, chalk_1.default) `{magenta Test '${testTitle}' has empty action in step. The reporter will mark this step as unnamed step.}`);
371
370
  }
372
- /**
373
- * @param {number} runId
374
- * @returns {Promise<void>}
375
- * @private
376
- */
377
- async checkRun(runId) {
378
- try {
379
- const resp = await this.api.runs.getRun(this.projectCode, runId);
380
- this.logger.log(`Get run result on checking run "${String(resp.data.result?.id)}"`);
381
- }
382
- catch (error) {
383
- throw this.processError(error, 'Error on checking run');
384
- }
385
- }
386
371
  /**
387
372
  * @param {string} title
388
373
  * @param {string} description
@@ -402,6 +387,9 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
402
387
  if (environment !== undefined) {
403
388
  runObject.environment_id = environment;
404
389
  }
390
+ if (this.planId) {
391
+ runObject.plan_id = this.planId;
392
+ }
405
393
  const { data } = await this.api.runs.createRun(this.projectCode, runObject);
406
394
  return data;
407
395
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qase-javascript-commons",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "Qase JS Reporters",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "lodash.merge": "^4.6.2",
34
34
  "lodash.mergewith": "^4.6.2",
35
35
  "mime-types": "^2.1.33",
36
- "qaseio": "^2.1.3",
36
+ "qaseio": "~2.2.0",
37
37
  "strip-ansi": "^6.0.1",
38
38
  "uuid": "^9.0.0"
39
39
  },