mocha-qase-reporter 1.0.0-beta.2 → 1.0.0-beta.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.
package/changelog.md CHANGED
@@ -1,3 +1,16 @@
1
+ # qase-mocha@1.0.0-beta.3
2
+
3
+ ## What's new
4
+
5
+ Support group parameters for test cases. You can specify the group parameters in the test case using the following format:
6
+
7
+ ```ts
8
+ it('test', () => {
9
+ this.groupParameters({ param1: 'value1', param2: 'value2' });
10
+ expect(true).to.equal(true);
11
+ });
12
+ ```
13
+
1
14
  # qase-mocha@1.0.0-beta.2
2
15
 
3
16
  ## What's new
@@ -51,6 +51,7 @@ export declare class MochaQaseReporter extends reporters.Base {
51
51
  qaseId: (id: number | number[]) => void;
52
52
  title: (title: string) => void;
53
53
  parameters: (values: Record<string, string>) => void;
54
+ groupParameters: (values: Record<string, string>) => void;
54
55
  fields: (values: Record<string, string>) => void;
55
56
  suite: (name: string) => void;
56
57
  ignore: () => void;
package/dist/reporter.js CHANGED
@@ -9,6 +9,7 @@ const types_1 = require("./types");
9
9
  const qase_javascript_commons_1 = require("qase-javascript-commons");
10
10
  const deasync_promise_1 = __importDefault(require("deasync-promise"));
11
11
  const node_path_1 = require("node:path");
12
+ const uuid_1 = require("uuid");
12
13
  const Events = mocha_1.Runner.constants;
13
14
  class currentTest {
14
15
  constructor() {
@@ -50,6 +51,13 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
50
51
  }
51
52
  this.metadata.parameters = stringRecord;
52
53
  };
54
+ this.groupParameters = (values) => {
55
+ const stringRecord = {};
56
+ for (const [key, value] of Object.entries(values)) {
57
+ stringRecord[String(key)] = String(value);
58
+ }
59
+ this.metadata.groupParameters = stringRecord;
60
+ };
53
61
  this.fields = (values) => {
54
62
  const stringRecord = {};
55
63
  for (const [key, value] of Object.entries(values)) {
@@ -108,6 +116,7 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
108
116
  reporterName: 'mocha-qase-reporter',
109
117
  });
110
118
  if (options.parallel) {
119
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
111
120
  options.require = [...(options.require ?? []), resolveParallelModeSetupFile()];
112
121
  }
113
122
  else {
@@ -126,6 +135,7 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
126
135
  ctx.qaseId = this.qaseId;
127
136
  ctx.title = this.title;
128
137
  ctx.parameters = this.parameters;
138
+ ctx.groupParameters = this.groupParameters;
129
139
  ctx.fields = this.fields;
130
140
  ctx.suite = this.suite;
131
141
  ctx.ignore = this.ignore;
@@ -168,11 +178,12 @@ class MochaQaseReporter extends mocha_1.reporters.Base {
168
178
  message: message ?? null,
169
179
  muted: false,
170
180
  params: this.metadata.parameters ?? {},
181
+ group_params: this.metadata.groupParameters ?? {},
171
182
  relations: relations,
172
183
  run_id: null,
173
184
  signature: this.getSignature(test, ids),
174
185
  steps: this.currentTest.steps,
175
- id: test.id,
186
+ id: (0, uuid_1.v4)(),
176
187
  execution: {
177
188
  status: test.state
178
189
  ? MochaQaseReporter.statusMap[test.state]
package/dist/types.d.ts CHANGED
@@ -16,6 +16,7 @@ export interface Methods {
16
16
  qaseId(id: number | number[]): void;
17
17
  title(title: string): void;
18
18
  parameters(values: Record<string, string>): void;
19
+ groupParameters(values: Record<string, string>): void;
19
20
  fields(values: Record<string, string>): void;
20
21
  suite(name: string): void;
21
22
  ignore(): void;
@@ -33,6 +34,7 @@ export declare class Metadata {
33
34
  title?: string;
34
35
  fields?: Record<string, string>;
35
36
  parameters?: Record<string, string>;
37
+ groupParameters?: Record<string, string>;
36
38
  ignore?: boolean;
37
39
  suite?: string;
38
40
  comment?: string;
package/dist/types.js CHANGED
@@ -46,6 +46,7 @@ class Metadata {
46
46
  this.title = '';
47
47
  this.fields = {};
48
48
  this.parameters = {};
49
+ this.groupParameters = {};
49
50
  this.ignore = false;
50
51
  this.suite = '';
51
52
  this.comment = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocha-qase-reporter",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Mocha Cypress Reporter",
5
5
  "homepage": "https://github.com/qase-tms/qase-javascript",
6
6
  "sideEffects": false,
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "mocha": "^10.2.0",
44
44
  "deasync-promise": "^1.0.1",
45
- "qase-javascript-commons": "^2.0.0",
45
+ "qase-javascript-commons": "~2.2.0",
46
46
  "uuid": "^9.0.1"
47
47
  },
48
48
  "devDependencies": {