@qanalyzer/forge-commons 1.1.2 → 1.2.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.
@@ -25,6 +25,11 @@ export type QaMetaWire = {
25
25
  suite?: Array<{
26
26
  title: string;
27
27
  }>;
28
+ /**
29
+ * Explicit Jira issue keys for FR43 (preferred over embedding keys in titles).
30
+ * Roles (test_case / requirement / …) are classified server-side via TMS type map.
31
+ */
32
+ issueKeys?: string[];
28
33
  steps?: QaMetaStepWire[];
29
34
  attachments?: QaMetaAttachmentWire[];
30
35
  ignore?: boolean;
@@ -44,6 +49,7 @@ export type QaMetaAccumulator = {
44
49
  suite?: string;
45
50
  fields?: Record<string, string>;
46
51
  parameters?: Record<string, string>;
52
+ issueKeys: string[];
47
53
  steps: Array<{
48
54
  name: string;
49
55
  status: QaMetaStepWire['status'];
@@ -10,7 +10,32 @@ exports.applyQaAnnotations = applyQaAnnotations;
10
10
  exports.toQaMetaWire = toQaMetaWire;
11
11
  exports.qaMetaFromEntries = qaMetaFromEntries;
12
12
  function createQaMetaAccumulator() {
13
- return { steps: [], attachments: [] };
13
+ return { issueKeys: [], steps: [], attachments: [] };
14
+ }
15
+ const ISSUE_KEY_BODY_RE = /^[A-Z][A-Z0-9]+-\d+$/i;
16
+ /** Normalize and append unique issue keys (preserve first-seen order). */
17
+ function appendIssueKeys(acc, raw) {
18
+ const parts = [];
19
+ if (typeof raw === 'string') {
20
+ parts.push(...raw
21
+ .split(/[\s,]+/)
22
+ .map((s) => s.trim())
23
+ .filter(Boolean));
24
+ }
25
+ else if (Array.isArray(raw)) {
26
+ for (const item of raw) {
27
+ if (typeof item === 'string' && item.trim())
28
+ parts.push(item.trim());
29
+ }
30
+ }
31
+ for (const part of parts) {
32
+ const key = part.toUpperCase();
33
+ if (!ISSUE_KEY_BODY_RE.test(key))
34
+ continue;
35
+ if (acc.issueKeys.includes(key))
36
+ continue;
37
+ acc.issueKeys.push(key);
38
+ }
14
39
  }
15
40
  function isRecord(value) {
16
41
  return typeof value === 'object' && value !== null && !Array.isArray(value);
@@ -40,6 +65,10 @@ function resolveType(ann) {
40
65
  return 'qa-fields';
41
66
  if (message.startsWith('QA Parameters:'))
42
67
  return 'qa-parameters';
68
+ if (message.startsWith('QA IssueKeys:'))
69
+ return 'qa-issue-keys';
70
+ if (message.startsWith('QA IssueKey:'))
71
+ return 'qa-issue-key';
43
72
  if (message.startsWith('QA Step Failed:'))
44
73
  return 'qa-step-failed';
45
74
  if (message.startsWith('QA Step End:'))
@@ -113,6 +142,16 @@ function applyQaAnnotation(acc, ann) {
113
142
  }
114
143
  break;
115
144
  }
145
+ case 'qa-issue-key':
146
+ case 'qa-issue-keys': {
147
+ if (ann.body !== undefined && ann.body !== null) {
148
+ appendIssueKeys(acc, ann.body);
149
+ break;
150
+ }
151
+ const prefix = type === 'qa-issue-keys' ? 'QA IssueKeys:' : 'QA IssueKey:';
152
+ appendIssueKeys(acc, stripPrefix(message, prefix));
153
+ break;
154
+ }
116
155
  case 'qa-step': {
117
156
  const name = typeof ann.body === 'string'
118
157
  ? ann.body
@@ -209,6 +248,7 @@ function toQaMetaWire(acc, options) {
209
248
  acc.suite !== undefined ||
210
249
  (acc.fields && Object.keys(acc.fields).length > 0) ||
211
250
  (acc.parameters && Object.keys(acc.parameters).length > 0) ||
251
+ acc.issueKeys.length > 0 ||
212
252
  acc.steps.length > 0 ||
213
253
  acc.attachments.length > 0 ||
214
254
  acc.ignore === true;
@@ -230,6 +270,8 @@ function toQaMetaWire(acc, options) {
230
270
  if (acc.parameters && Object.keys(acc.parameters).length > 0) {
231
271
  wire.parameters = acc.parameters;
232
272
  }
273
+ if (acc.issueKeys.length > 0)
274
+ wire.issueKeys = [...acc.issueKeys];
233
275
  if (acc.suite) {
234
276
  wire.suite = acc.suite.split('\t').filter(Boolean).map((title) => ({ title }));
235
277
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qanalyzer/forge-commons",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Shared config, models, and Forge ingest client for QAnalyzer JS reporters",
5
5
  "keywords": [
6
6
  "qanalyzer",