transit-core-taf 1.0.9 → 1.0.10
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.
|
@@ -17,5 +17,6 @@ declare class TestRailReporter implements Reporter {
|
|
|
17
17
|
constructor(options?: TestRailReporterOptions);
|
|
18
18
|
onBegin(config: FullConfig, suite: Suite): Promise<void>;
|
|
19
19
|
onTestEnd(test: TestCase, result: TestResult): Promise<void>;
|
|
20
|
+
private getCaseId;
|
|
20
21
|
}
|
|
21
22
|
export default TestRailReporter;
|
|
@@ -57,10 +57,8 @@ class TestRailReporter {
|
|
|
57
57
|
async onTestEnd(test, result) {
|
|
58
58
|
if (!this.enabled || !this.client || !this.runId)
|
|
59
59
|
return;
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
if (match) {
|
|
63
|
-
const caseId = parseInt(match[1], 10);
|
|
60
|
+
const caseId = this.getCaseId(test);
|
|
61
|
+
if (caseId) {
|
|
64
62
|
const comment = result.status === 'failed' || result.status === 'timedOut'
|
|
65
63
|
? `Test failed with error: ${result.error?.message}`
|
|
66
64
|
: `Test completed with status: ${result.status}`;
|
|
@@ -73,5 +71,21 @@ class TestRailReporter {
|
|
|
73
71
|
}
|
|
74
72
|
}
|
|
75
73
|
}
|
|
74
|
+
getCaseId(test) {
|
|
75
|
+
const caseIdRegex = /C(\d+)/;
|
|
76
|
+
// Check tags first
|
|
77
|
+
for (const tag of test.tags) {
|
|
78
|
+
const match = tag.match(caseIdRegex);
|
|
79
|
+
if (match) {
|
|
80
|
+
return parseInt(match[1], 10);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Fallback to title
|
|
84
|
+
const titleMatch = test.title.match(caseIdRegex);
|
|
85
|
+
if (titleMatch) {
|
|
86
|
+
return parseInt(titleMatch[1], 10);
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
76
90
|
}
|
|
77
91
|
exports.default = TestRailReporter;
|