jest-qase-reporter 2.2.1 → 2.3.0

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
+ # jest-qase-reporter@2.3.0
2
+
3
+ ## What's new
4
+
5
+ - Added `qase.tags()` method to assign tag titles to test cases.
6
+ - Updated `qase-javascript-commons` dependency to `~2.6.0`.
7
+
8
+ # jest-qase-reporter@2.2.2
9
+
10
+ ## Bug fixes
11
+
12
+ - Moved profiler import to separate sub-path (`qase-javascript-commons/profilers`) to avoid pulling `node:` modules into bundlers.
13
+ - Updated `qase-javascript-commons` dependency to `~2.5.7`.
14
+
1
15
  # jest-qase-reporter@2.2.1
2
16
 
3
17
  ## What's new
package/dist/global.d.ts CHANGED
@@ -17,6 +17,7 @@ export declare class Qase {
17
17
  fields(values: Record<string, string>): void;
18
18
  parameters(values: Record<string, string>): void;
19
19
  groupParams(values: Record<string, string>): void;
20
+ tags(values: string[]): void;
20
21
  step(step: TestStepType): void;
21
22
  attachment(attachment: Attachment): void;
22
23
  }
package/dist/global.js CHANGED
@@ -39,6 +39,9 @@ class Qase {
39
39
  }
40
40
  this.reporter.addGroupParams(stringRecord);
41
41
  }
42
+ tags(values) {
43
+ this.reporter.addTags(values);
44
+ }
42
45
  step(step) {
43
46
  this.reporter.addStep(step);
44
47
  }
package/dist/jest.d.ts CHANGED
@@ -11,6 +11,7 @@ export declare const qase: {
11
11
  fields(values: Record<string, string>): void;
12
12
  parameters(values: Record<string, string>): void;
13
13
  groupParameters(values: Record<string, string>): void;
14
+ tags(...values: string[]): void;
14
15
  step(name: string, body: StepFunction, expectedResult?: string, data?: string): Promise<void>;
15
16
  attach(attach: {
16
17
  name?: string;
package/dist/jest.js CHANGED
@@ -118,6 +118,20 @@ exports.qase.groupParameters = (values) => {
118
118
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
119
119
  global.Qase.groupParams(values);
120
120
  };
121
+ /**
122
+ * Set tags for the test case
123
+ * @param {...string} values
124
+ * @example
125
+ * test('test', () => {
126
+ * qase.tags('smoke', 'regression');
127
+ * expect(true).toBe(true);
128
+ * });
129
+ */
130
+ exports.qase.tags = (...values) => {
131
+ // @ts-expect-error - global.Qase is dynamically added at runtime
132
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
133
+ global.Qase.tags(values);
134
+ };
121
135
  /**
122
136
  * Add a step to the test case
123
137
  * @param name
package/dist/models.d.ts CHANGED
@@ -7,6 +7,7 @@ export interface Metadata {
7
7
  fields: Record<string, string>;
8
8
  parameters: Record<string, string>;
9
9
  groupParams: Record<string, string>;
10
+ tags: string[];
10
11
  steps: TestStepType[];
11
12
  attachments: Attachment[];
12
13
  }
@@ -91,6 +91,7 @@ export declare class JestQaseReporter implements Reporter {
91
91
  addFields(fields: Record<string, string>): void;
92
92
  addParameters(parameters: Record<string, string>): void;
93
93
  addGroupParams(groupParams: Record<string, string>): void;
94
+ addTags(tags: string[]): void;
94
95
  addIgnore(): void;
95
96
  addStep(step: TestStepType): void;
96
97
  addAttachment(attachment: Attachment): void;
package/dist/reporter.js CHANGED
@@ -8,6 +8,7 @@ const lodash_has_1 = __importDefault(require("lodash.has"));
8
8
  const lodash_get_1 = __importDefault(require("lodash.get"));
9
9
  const uuid_1 = require("uuid");
10
10
  const qase_javascript_commons_1 = require("qase-javascript-commons");
11
+ const profilers_1 = require("qase-javascript-commons/profilers");
11
12
  const global_1 = require("./global");
12
13
  /**
13
14
  * @class JestQaseReporter
@@ -75,7 +76,7 @@ class JestQaseReporter {
75
76
  reporterName: 'jest-qase-reporter',
76
77
  });
77
78
  if (composedOptions.profilers?.includes('network')) {
78
- this.profiler = new qase_javascript_commons_1.NetworkProfiler({
79
+ this.profiler = new profilers_1.NetworkProfiler({
79
80
  skipDomains: composedOptions.networkProfiler?.skip_domains,
80
81
  trackOnFail: composedOptions.networkProfiler?.track_on_fail,
81
82
  });
@@ -125,6 +126,9 @@ class JestQaseReporter {
125
126
  if (Object.keys(this.metadata.groupParams).length > 0) {
126
127
  result.group_params = this.metadata.groupParams;
127
128
  }
129
+ if (this.metadata.tags.length > 0) {
130
+ result.tags = this.metadata.tags;
131
+ }
128
132
  if (this.metadata.steps.length > 0) {
129
133
  result.steps = this.metadata.steps;
130
134
  }
@@ -235,6 +239,9 @@ class JestQaseReporter {
235
239
  addGroupParams(groupParams) {
236
240
  this.metadata.groupParams = groupParams;
237
241
  }
242
+ addTags(tags) {
243
+ this.metadata.tags.push(...tags);
244
+ }
238
245
  addIgnore() {
239
246
  this.metadata.ignore = true;
240
247
  }
@@ -323,6 +330,7 @@ class JestQaseReporter {
323
330
  fields: {},
324
331
  parameters: {},
325
332
  groupParams: {},
333
+ tags: [],
326
334
  steps: [],
327
335
  attachments: [],
328
336
  };
package/docs/usage.md CHANGED
@@ -12,6 +12,7 @@ This guide provides comprehensive instructions for integrating Qase with Jest.
12
12
  - [Adding Title](#adding-title)
13
13
  - [Adding Fields](#adding-fields)
14
14
  - [Adding Suite](#adding-suite)
15
+ - [Tags](#tags)
15
16
  - [Ignoring Tests](#ignoring-tests)
16
17
  - [Muting Tests](#muting-tests)
17
18
  - [Working with Attachments](#working-with-attachments)
@@ -142,6 +143,35 @@ test('Login test', () => {
142
143
 
143
144
  ---
144
145
 
146
+ ## Tags
147
+
148
+ Assign tags to test cases. Tags help categorize and filter tests in Qase.
149
+
150
+ ```typescript
151
+ test(qase(1, 'Login test'), () => {
152
+ qase.tags('smoke', 'regression');
153
+ expect(true).toBe(true);
154
+ });
155
+ ```
156
+
157
+ Multiple `qase.tags()` calls accumulate:
158
+
159
+ ```typescript
160
+ test('test', () => {
161
+ qase.tags('smoke');
162
+ qase.tags('regression', 'e2e');
163
+ // Result: tags = ['smoke', 'regression', 'e2e']
164
+ });
165
+ ```
166
+
167
+ Alternative using fields:
168
+
169
+ ```typescript
170
+ qase.fields({ tags: 'smoke,regression' });
171
+ ```
172
+
173
+ ---
174
+
145
175
  ## Ignoring Tests
146
176
 
147
177
  Exclude a test from Qase reporting. The test still executes, but results are not sent to Qase:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-qase-reporter",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "Qase TMS Jest Reporter",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "lodash.get": "^4.4.2",
47
47
  "lodash.has": "^4.5.2",
48
- "qase-javascript-commons": "~2.5.6",
48
+ "qase-javascript-commons": "~2.6.0",
49
49
  "uuid": "^9.0.1"
50
50
  },
51
51
  "devDependencies": {