cucumberjs-qase-reporter 2.1.5 → 2.1.7

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,15 @@
1
+ # qase-cucumberjs@2.1.7
2
+
3
+ ## What's new
4
+
5
+ - Added support for QaseParameters and QaseGroupParameters tags.
6
+
7
+ # qase-cucumberjs@2.1.6
8
+
9
+ ## Bug fixes
10
+
11
+ Fixed issue where cucumber-specific statuses like `AMBIGUOUS` were incorrectly mapped using generic status mapping instead of cucumber-specific mapping. Now cucumber-specific statuses are properly mapped according to cucumberjs conventions.
12
+
1
13
  # qase-cucumberjs@2.1.5
2
14
 
3
15
  ## What's new
package/dist/models.d.ts CHANGED
@@ -3,6 +3,8 @@ export interface TestMetadata {
3
3
  fields: Record<string, string>;
4
4
  title: string | null;
5
5
  isIgnore: boolean;
6
+ parameters: Record<string, string>;
7
+ group_params: Record<string, string>;
6
8
  }
7
9
  export interface ScenarioData {
8
10
  name: string;
package/dist/storage.d.ts CHANGED
@@ -100,6 +100,7 @@ export declare class Storage {
100
100
  /**
101
101
  * @param {Pickle} pickle
102
102
  * @param {number[]} ids
103
+ * @param {Record<string, string>} parameters
103
104
  * @private
104
105
  */
105
106
  private getSignature;
package/dist/storage.js CHANGED
@@ -8,6 +8,8 @@ const qaseIdRegExp = /^@[Qq]-?(\d+)$/;
8
8
  const newQaseIdRegExp = /^@[Qq]ase[Ii][Dd]=(\d+(?:,\s*\d+)*)$/;
9
9
  const qaseTitleRegExp = /^@[Qq]ase[Tt]itle=(.+)$/;
10
10
  const qaseFieldsRegExp = /^@[Qq]ase[Ff]ields=(.+)$/;
11
+ const qaseParametersRegExp = /^@[Qq]ase[Pp]arameters=(.+)$/;
12
+ const qaseGroupParametersRegExp = /^@[Qq]ase[Gg]roup[Pp]arameters=(.+)$/;
11
13
  const qaseIgnoreRegExp = /^@[Qq]ase[Ii][Gg][Nn][Oo][Rr][Ee]$/;
12
14
  class Storage {
13
15
  /**
@@ -151,7 +153,7 @@ class Storage {
151
153
  error = new Error(testCaseStep.testStepResult.message);
152
154
  }
153
155
  // Determine status based on error type
154
- const newStatus = (0, qase_javascript_commons_1.determineTestStatus)(error, testCaseStep.testStepResult.status);
156
+ const newStatus = (0, qase_javascript_commons_1.determineTestStatus)(error, Storage.statusMap[testCaseStep.testStepResult.status]);
155
157
  this.testCaseSteps[testCaseStep.testStepId] = testCaseStep;
156
158
  if (newStatus !== qase_javascript_commons_1.TestStatusEnum.passed) {
157
159
  if (testCaseStep.testStepResult.message) {
@@ -161,7 +163,7 @@ class Storage {
161
163
  this.testCaseStartedErrors[testCaseStep.testCaseStartedId]?.push(testCaseStep.testStepResult.message);
162
164
  }
163
165
  if (oldStatus) {
164
- if (oldStatus !== qase_javascript_commons_1.TestStatusEnum.failed) {
166
+ if (oldStatus !== qase_javascript_commons_1.TestStatusEnum.failed && oldStatus !== qase_javascript_commons_1.TestStatusEnum.invalid) {
165
167
  this.testCaseStartedResult[testCaseStep.testCaseStartedId] = newStatus;
166
168
  }
167
169
  }
@@ -213,6 +215,10 @@ class Storage {
213
215
  }
214
216
  }
215
217
  }
218
+ // Merge parameters from tags with parameters from Gherkin examples
219
+ // Parameters from tags take precedence over Gherkin examples
220
+ params = { ...params, ...metadata.parameters };
221
+ const steps = this.convertSteps(pickle.steps, tc);
216
222
  return {
217
223
  attachments: this.attachments[testCase.testCaseStartedId] ?? [],
218
224
  author: null,
@@ -228,11 +234,11 @@ class Storage {
228
234
  message: error?.message ?? null,
229
235
  muted: false,
230
236
  params: params,
231
- group_params: {},
237
+ group_params: metadata.group_params,
232
238
  relations: relations,
233
239
  run_id: null,
234
- signature: this.getSignature(pickle, metadata.ids),
235
- steps: this.convertSteps(pickle.steps, tc),
240
+ signature: this.getSignature(pickle, metadata.ids, params),
241
+ steps: steps,
236
242
  testops_id: metadata.ids.length > 0 ? metadata.ids : null,
237
243
  id: tcs.id,
238
244
  title: metadata.title ?? pickle.name,
@@ -285,7 +291,7 @@ class Storage {
285
291
  [cucumber_1.Status.PASSED]: qase_javascript_commons_1.TestStatusEnum.passed,
286
292
  [cucumber_1.Status.FAILED]: qase_javascript_commons_1.TestStatusEnum.failed,
287
293
  [cucumber_1.Status.SKIPPED]: qase_javascript_commons_1.TestStatusEnum.skipped,
288
- [cucumber_1.Status.AMBIGUOUS]: qase_javascript_commons_1.TestStatusEnum.failed,
294
+ [cucumber_1.Status.AMBIGUOUS]: qase_javascript_commons_1.TestStatusEnum.invalid,
289
295
  [cucumber_1.Status.PENDING]: qase_javascript_commons_1.TestStatusEnum.skipped,
290
296
  [cucumber_1.Status.UNDEFINED]: qase_javascript_commons_1.TestStatusEnum.skipped,
291
297
  [cucumber_1.Status.UNKNOWN]: qase_javascript_commons_1.TestStatusEnum.skipped,
@@ -308,6 +314,8 @@ class Storage {
308
314
  fields: {},
309
315
  title: null,
310
316
  isIgnore: false,
317
+ parameters: {},
318
+ group_params: {},
311
319
  };
312
320
  for (const tag of tags) {
313
321
  if (qaseIdRegExp.test(tag.name)) {
@@ -333,6 +341,28 @@ class Storage {
333
341
  // do nothing
334
342
  }
335
343
  }
344
+ if (qaseParametersRegExp.test(tag.name)) {
345
+ const value = tag.name.replace(/^@[Qq]ase[Pp]arameters=/, '');
346
+ try {
347
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
348
+ const record = JSON.parse(value);
349
+ metadata.parameters = { ...metadata.parameters, ...record };
350
+ }
351
+ catch (e) {
352
+ // do nothing
353
+ }
354
+ }
355
+ if (qaseGroupParametersRegExp.test(tag.name)) {
356
+ const value = tag.name.replace(/^@[Qq]ase[Gg]roup[Pp]arameters=/, '');
357
+ try {
358
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
359
+ const record = JSON.parse(value);
360
+ metadata.group_params = { ...metadata.group_params, ...record };
361
+ }
362
+ catch (e) {
363
+ // do nothing
364
+ }
365
+ }
336
366
  if (qaseIgnoreRegExp.test(tag.name)) {
337
367
  metadata.isIgnore = true;
338
368
  }
@@ -342,10 +372,11 @@ class Storage {
342
372
  /**
343
373
  * @param {Pickle} pickle
344
374
  * @param {number[]} ids
375
+ * @param {Record<string, string>} parameters
345
376
  * @private
346
377
  */
347
- getSignature(pickle, ids) {
348
- return (0, qase_javascript_commons_1.generateSignature)(ids, [...pickle.uri.split('/'), pickle.name], {});
378
+ getSignature(pickle, ids, parameters = {}) {
379
+ return (0, qase_javascript_commons_1.generateSignature)(ids, [...pickle.uri.split('/'), pickle.name], parameters);
349
380
  }
350
381
  getError(testCaseId) {
351
382
  const testErrors = this.testCaseStartedErrors[testCaseId];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cucumberjs-qase-reporter",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "Qase TMS CucumberJS Reporter",
5
5
  "homepage": "https://github.com/qase-tms/qase-javascript",
6
6
  "main": "./dist/index.js",
@@ -40,16 +40,16 @@
40
40
  "license": "Apache-2.0",
41
41
  "dependencies": {
42
42
  "@cucumber/messages": "^22.0.0",
43
- "qase-javascript-commons": "~2.4.2"
43
+ "qase-javascript-commons": "~2.4.16"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@cucumber/cucumber": ">=7.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@jest/globals": "^29.5.0",
50
- "@types/jest": "^29.5.2",
51
- "jest": "^29.5.0",
52
- "ts-jest": "^29.1.0",
53
- "uuid": "^9.0.0"
49
+ "@jest/globals": "^29.7.0",
50
+ "@types/jest": "^29.5.14",
51
+ "jest": "^29.7.0",
52
+ "ts-jest": "^29.4.5",
53
+ "uuid": "^9.0.1"
54
54
  }
55
55
  }
@@ -2,7 +2,9 @@
2
2
  "extends": "./tsconfig.json",
3
3
 
4
4
  "compilerOptions": {
5
- "noEmit": false
5
+ "noEmit": false,
6
+ "skipLibCheck": true,
7
+ "types": []
6
8
  },
7
9
 
8
10
  "include": ["./src/**/*.ts"]