jest-qase-reporter 2.2.2 → 2.4.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 +14 -0
- package/dist/global.d.ts +1 -0
- package/dist/global.js +3 -0
- package/dist/jest.d.ts +1 -0
- package/dist/jest.js +14 -0
- package/dist/models.d.ts +1 -0
- package/dist/reporter.d.ts +1 -13
- package/dist/reporter.js +11 -41
- package/docs/usage.md +30 -0
- package/package.json +2 -2
package/changelog.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# jest-qase-reporter@2.4.0
|
|
2
|
+
|
|
3
|
+
## Changed
|
|
4
|
+
|
|
5
|
+
- Bumped `qase-javascript-commons` to `~2.7.0`.
|
|
6
|
+
- Internal: replaced local copies of `removeQaseIdsFromTitle`, `extractAndCleanStep`, and the suite-part normalizer with imports from `qase-javascript-commons/internal`. Note: `removeQaseIdsFromTitle` is now case-insensitive and also accepts `(Qase ID 1)` without colon (previously rejected).
|
|
7
|
+
|
|
8
|
+
# jest-qase-reporter@2.3.0
|
|
9
|
+
|
|
10
|
+
## What's new
|
|
11
|
+
|
|
12
|
+
- Added `qase.tags()` method to assign tag titles to test cases.
|
|
13
|
+
- Updated `qase-javascript-commons` dependency to `~2.6.0`.
|
|
14
|
+
|
|
1
15
|
# jest-qase-reporter@2.2.2
|
|
2
16
|
|
|
3
17
|
## Bug fixes
|
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
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
package/dist/reporter.d.ts
CHANGED
|
@@ -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;
|
|
@@ -107,18 +108,5 @@ export declare class JestQaseReporter implements Reporter {
|
|
|
107
108
|
* @private
|
|
108
109
|
*/
|
|
109
110
|
private createEmptyMetadata;
|
|
110
|
-
/**
|
|
111
|
-
* @param {string} title
|
|
112
|
-
* @returns {string}
|
|
113
|
-
* @private
|
|
114
|
-
*/
|
|
115
|
-
private removeQaseIdsFromTitle;
|
|
116
|
-
/**
|
|
117
|
-
* Extract expected result and data from step title and return cleaned string
|
|
118
|
-
* @param {string} input
|
|
119
|
-
* @returns {{expectedResult: string | null, data: string | null, cleanedString: string}}
|
|
120
|
-
* @private
|
|
121
|
-
*/
|
|
122
|
-
private extractAndCleanStep;
|
|
123
111
|
onRunnerEnd(): Promise<void>;
|
|
124
112
|
}
|
package/dist/reporter.js
CHANGED
|
@@ -9,6 +9,7 @@ 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
11
|
const profilers_1 = require("qase-javascript-commons/profilers");
|
|
12
|
+
const internal_1 = require("qase-javascript-commons/internal");
|
|
12
13
|
const global_1 = require("./global");
|
|
13
14
|
/**
|
|
14
15
|
* @class JestQaseReporter
|
|
@@ -126,6 +127,9 @@ class JestQaseReporter {
|
|
|
126
127
|
if (Object.keys(this.metadata.groupParams).length > 0) {
|
|
127
128
|
result.group_params = this.metadata.groupParams;
|
|
128
129
|
}
|
|
130
|
+
if (this.metadata.tags.length > 0) {
|
|
131
|
+
result.tags = this.metadata.tags;
|
|
132
|
+
}
|
|
129
133
|
if (this.metadata.steps.length > 0) {
|
|
130
134
|
result.steps = this.metadata.steps;
|
|
131
135
|
}
|
|
@@ -182,7 +186,7 @@ class JestQaseReporter {
|
|
|
182
186
|
*/
|
|
183
187
|
getSignature(filePath, fullName, ids, parameters = {}) {
|
|
184
188
|
const suites = filePath.split('/');
|
|
185
|
-
suites.push(
|
|
189
|
+
suites.push((0, internal_1.normalizeSuitePart)(fullName));
|
|
186
190
|
return (0, qase_javascript_commons_1.generateSignature)(ids, suites, parameters);
|
|
187
191
|
}
|
|
188
192
|
/**
|
|
@@ -236,6 +240,9 @@ class JestQaseReporter {
|
|
|
236
240
|
addGroupParams(groupParams) {
|
|
237
241
|
this.metadata.groupParams = groupParams;
|
|
238
242
|
}
|
|
243
|
+
addTags(tags) {
|
|
244
|
+
this.metadata.tags.push(...tags);
|
|
245
|
+
}
|
|
239
246
|
addIgnore() {
|
|
240
247
|
this.metadata.ignore = true;
|
|
241
248
|
}
|
|
@@ -246,7 +253,7 @@ class JestQaseReporter {
|
|
|
246
253
|
const isTextStep = (qase_javascript_commons_1.StepType && step.step_type === qase_javascript_commons_1.StepType.TEXT) || step.step_type === undefined || step.step_type === 'text';
|
|
247
254
|
if (isTextStep && step.data && 'action' in step.data) {
|
|
248
255
|
const stepTextData = step.data;
|
|
249
|
-
const stepData =
|
|
256
|
+
const stepData = (0, internal_1.extractAndCleanStep)(stepTextData.action);
|
|
250
257
|
stepTextData.action = stepData.cleanedString;
|
|
251
258
|
stepTextData.expected_result = stepData.expectedResult;
|
|
252
259
|
stepTextData.data = stepData.data;
|
|
@@ -307,7 +314,7 @@ class JestQaseReporter {
|
|
|
307
314
|
: null,
|
|
308
315
|
testops_project_mapping: hasProjectMapping ? parsed.projectMapping : null,
|
|
309
316
|
id: (0, uuid_1.v4)(),
|
|
310
|
-
title: parsed.cleanedTitle ||
|
|
317
|
+
title: parsed.cleanedTitle || (0, internal_1.removeQaseIdsFromTitle)(value.title),
|
|
311
318
|
};
|
|
312
319
|
return result;
|
|
313
320
|
}
|
|
@@ -324,48 +331,11 @@ class JestQaseReporter {
|
|
|
324
331
|
fields: {},
|
|
325
332
|
parameters: {},
|
|
326
333
|
groupParams: {},
|
|
334
|
+
tags: [],
|
|
327
335
|
steps: [],
|
|
328
336
|
attachments: [],
|
|
329
337
|
};
|
|
330
338
|
}
|
|
331
|
-
/**
|
|
332
|
-
* @param {string} title
|
|
333
|
-
* @returns {string}
|
|
334
|
-
* @private
|
|
335
|
-
*/
|
|
336
|
-
removeQaseIdsFromTitle(title) {
|
|
337
|
-
const matches = title.match(/\(Qase ID: ([0-9,]+)\)$/i);
|
|
338
|
-
if (matches) {
|
|
339
|
-
return title.replace(matches[0], '').trimEnd();
|
|
340
|
-
}
|
|
341
|
-
return title;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Extract expected result and data from step title and return cleaned string
|
|
345
|
-
* @param {string} input
|
|
346
|
-
* @returns {{expectedResult: string | null, data: string | null, cleanedString: string}}
|
|
347
|
-
* @private
|
|
348
|
-
*/
|
|
349
|
-
extractAndCleanStep(input) {
|
|
350
|
-
let expectedResult = null;
|
|
351
|
-
let data = null;
|
|
352
|
-
let cleanedString = input;
|
|
353
|
-
const hasExpectedResult = input.includes('QaseExpRes:');
|
|
354
|
-
const hasData = input.includes('QaseData:');
|
|
355
|
-
if (hasExpectedResult || hasData) {
|
|
356
|
-
const regex = /QaseExpRes:\s*:?\s*(.*?)\s*(?=QaseData:|$)QaseData:\s*:?\s*(.*)?/;
|
|
357
|
-
const match = input.match(regex);
|
|
358
|
-
if (match) {
|
|
359
|
-
expectedResult = match[1]?.trim() ?? null;
|
|
360
|
-
data = match[2]?.trim() ?? null;
|
|
361
|
-
cleanedString = input
|
|
362
|
-
.replace(/QaseExpRes:\s*:?\s*.*?(?=QaseData:|$)/, '')
|
|
363
|
-
.replace(/QaseData:\s*:?\s*.*/, '')
|
|
364
|
-
.trim();
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
return { expectedResult, data, cleanedString };
|
|
368
|
-
}
|
|
369
339
|
async onRunnerEnd() {
|
|
370
340
|
await this.reporter.publish();
|
|
371
341
|
}
|
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.
|
|
3
|
+
"version": "2.4.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.
|
|
48
|
+
"qase-javascript-commons": "~2.7.0",
|
|
49
49
|
"uuid": "^9.0.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|