Skip to content

Commit 6039405

Browse files
authored
[patch] fixed tmsWithId/issueWithId parsing from test title (#257)
1 parent dbcedd1 commit 6039405

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

src/setup/process-tags.ts

+2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ export const processTagsOnTestStart = (test: Mocha.Test) => {
1111
const tagNoAt = t.tag.slice(1);
1212

1313
switch (tagNoAt) {
14+
case 'tmsWithId':
1415
case 'tms':
16+
case 'issueWithId':
1517

1618
case 'issue': {
1719
const [urlOrId, name] = t.info ?? [];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import { createResTest2, fixResult } from '@test-utils';
2+
import { AllureTest, parseAllure } from 'allure-js-parser';
3+
4+
describe('should have links by using tags meta info from test title', () => {
5+
const res = createResTest2(
6+
[
7+
`
8+
describe('set tms from test title', () => {
9+
it('link tms test @tms("ABC-123")', () => {
10+
// ignore
11+
});
12+
13+
it('link tms test with description @tms("ABC-123","descrpt")', () => {
14+
// ignore
15+
});
16+
17+
it('link tmsWithId test @tmsWithId("ABC-123","descrpt")', () => {
18+
// ignore
19+
});
20+
21+
it('link issueWithId test @issueWithId("ABC-123","descrpt")', () => {
22+
// ignore
23+
});
24+
});
25+
`,
26+
],
27+
{ tmsPrefix: undefined, issuePrefix: 'http://my.jira.com/' },
28+
);
29+
describe('check results', () => {
30+
let resFixed: AllureTest[];
31+
32+
beforeAll(() => {
33+
const results = parseAllure(res.watch);
34+
resFixed = fixResult(results);
35+
});
36+
37+
it('should have tms issue', () => {
38+
const tests = resFixed.filter(t => t.name === 'link tms test');
39+
expect(tests.length).toEqual(1);
40+
41+
const labels = tests.map(t => t.links).sort();
42+
expect(labels).toEqual([
43+
[{ name: 'ABC-123', type: 'tms', url: 'http://jira/ABC-123' }],
44+
]);
45+
});
46+
47+
it('should have tms issue with descrp', () => {
48+
const tests = resFixed.filter(
49+
t => t.name === 'link tms test with description',
50+
);
51+
expect(tests.length).toEqual(1);
52+
53+
const labels = tests.map(t => t.links).sort();
54+
expect(labels).toEqual([
55+
[{ name: 'descrpt', type: 'tms', url: 'http://jira/ABC-123' }],
56+
]);
57+
});
58+
59+
it('should have tmsWithId issue', () => {
60+
const tests = resFixed.filter(t => t.name === 'link tmsWithId test');
61+
expect(tests.length).toEqual(1);
62+
63+
const labels = tests.map(t => t.links).sort();
64+
expect(labels).toEqual([
65+
[{ name: 'ABC-123: descrpt', type: 'tms', url: 'http://jira/ABC-123' }],
66+
]);
67+
});
68+
69+
it('should have issueWithId issue', () => {
70+
const tests = resFixed.filter(t => t.name === 'link issueWithId test');
71+
expect(tests.length).toEqual(1);
72+
73+
const labels = tests.map(t => t.links).sort();
74+
expect(labels).toEqual([
75+
[
76+
{
77+
name: 'ABC-123: descrpt',
78+
type: 'issue',
79+
url: 'http://my.jira.com/ABC-123',
80+
},
81+
],
82+
]);
83+
});
84+
});
85+
});

0 commit comments

Comments
 (0)