Skip to content

Commit 40a51f1

Browse files
committed
feat: added removeQaseIdsFromTitle method to remove IDs from test names
- The `removeQaseIdsFromTitle` method removes Qase IDs from test names when uploading results - Updated test name processing logic to exclude service identifiers
1 parent ffb2061 commit 40a51f1

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

qase-jest/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2+
3+
## What's new
4+
5+
Improved test name processing: Qase IDs are now automatically removed when uploading results
6+
17
28

39
## What's new

qase-jest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jest-qase-reporter",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "Qase TMS Jest Reporter",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

qase-jest/src/reporter.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export class JestQaseReporter implements Reporter {
331331
steps: [],
332332
testops_id: ids.length > 0 ? ids : null,
333333
id: uuidv4(),
334-
title: value.title,
334+
title: this.removeQaseIdsFromTitle(value.title),
335335
};
336336
}
337337

@@ -352,4 +352,17 @@ export class JestQaseReporter implements Reporter {
352352
attachments: [],
353353
};
354354
}
355+
356+
/**
357+
* @param {string} title
358+
* @returns {string}
359+
* @private
360+
*/
361+
private removeQaseIdsFromTitle(title: string): string {
362+
const matches = title.match(/\(Qase ID: ([0-9,]+)\)$/i);
363+
if (matches) {
364+
return title.replace(matches[0], '').trimEnd();
365+
}
366+
return title;
367+
}
355368
}

0 commit comments

Comments
 (0)