cucumberjs-qase-reporter 2.1.6 → 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,9 @@
1
+ # qase-cucumberjs@2.1.7
2
+
3
+ ## What's new
4
+
5
+ - Added support for QaseParameters and QaseGroupParameters tags.
6
+
1
7
  # qase-cucumberjs@2.1.6
2
8
 
3
9
  ## Bug fixes
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
  /**
@@ -213,6 +215,9 @@ 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 };
216
221
  const steps = this.convertSteps(pickle.steps, tc);
217
222
  return {
218
223
  attachments: this.attachments[testCase.testCaseStartedId] ?? [],
@@ -229,10 +234,10 @@ class Storage {
229
234
  message: error?.message ?? null,
230
235
  muted: false,
231
236
  params: params,
232
- group_params: {},
237
+ group_params: metadata.group_params,
233
238
  relations: relations,
234
239
  run_id: null,
235
- signature: this.getSignature(pickle, metadata.ids),
240
+ signature: this.getSignature(pickle, metadata.ids, params),
236
241
  steps: steps,
237
242
  testops_id: metadata.ids.length > 0 ? metadata.ids : null,
238
243
  id: tcs.id,
@@ -309,6 +314,8 @@ class Storage {
309
314
  fields: {},
310
315
  title: null,
311
316
  isIgnore: false,
317
+ parameters: {},
318
+ group_params: {},
312
319
  };
313
320
  for (const tag of tags) {
314
321
  if (qaseIdRegExp.test(tag.name)) {
@@ -334,6 +341,28 @@ class Storage {
334
341
  // do nothing
335
342
  }
336
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
+ }
337
366
  if (qaseIgnoreRegExp.test(tag.name)) {
338
367
  metadata.isIgnore = true;
339
368
  }
@@ -343,10 +372,11 @@ class Storage {
343
372
  /**
344
373
  * @param {Pickle} pickle
345
374
  * @param {number[]} ids
375
+ * @param {Record<string, string>} parameters
346
376
  * @private
347
377
  */
348
- getSignature(pickle, ids) {
349
- 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);
350
380
  }
351
381
  getError(testCaseId) {
352
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.6",
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.8"
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"]