Skip to content

Commit

Permalink
feat: added removeQaseIdsFromTitle method to remove IDs from test names
Browse files Browse the repository at this point in the history
- The `removeQaseIdsFromTitle` method removes Qase IDs from test names when uploading results
- Updated test name processing logic to exclude service identifiers
  • Loading branch information
gibiw committed Feb 4, 2025
1 parent ffb2061 commit 2bb902d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions qase-jest/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# jest-qase-reporter@2.0.4

## What's new

Improved test name processing: Qase IDs are now automatically removed when uploading results

# jest-qase-reporter@2.0.3

## What's new
Expand Down
2 changes: 1 addition & 1 deletion qase-jest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-qase-reporter",
"version": "2.0.3",
"version": "2.0.4",
"description": "Qase TMS Jest Reporter",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
15 changes: 14 additions & 1 deletion qase-jest/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export class JestQaseReporter implements Reporter {
steps: [],
testops_id: ids.length > 0 ? ids : null,
id: uuidv4(),
title: value.title,
title: this.removeQaseIdsFromTitle(value.title),
};
}

Expand All @@ -352,4 +352,17 @@ export class JestQaseReporter implements Reporter {
attachments: [],
};
}

/**
* @param {string} title
* @returns {string}
* @private
*/
private removeQaseIdsFromTitle(title: string): string {
const matches = title.match(/\(Qase ID: ([0-9,]+)\)$/i);
if (matches) {
return title.replace(matches[0], '').trimEnd();
}
return title;
}
}

0 comments on commit 2bb902d

Please sign in to comment.