@qanalyzer/forge-commons 1.1.1
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.
- package/LICENSE +202 -0
- package/dist/ci/context.d.ts +6 -0
- package/dist/ci/context.js +71 -0
- package/dist/ci/frameworks/jest.d.ts +1 -0
- package/dist/ci/frameworks/jest.js +6 -0
- package/dist/ci/frameworks/reporter.d.ts +41 -0
- package/dist/ci/frameworks/reporter.js +184 -0
- package/dist/ci/frameworks/upload.d.ts +10 -0
- package/dist/ci/frameworks/upload.js +58 -0
- package/dist/ci/frameworks/vitest.d.ts +2 -0
- package/dist/ci/frameworks/vitest.js +10 -0
- package/dist/ci/generate-ci-template.d.ts +7 -0
- package/dist/ci/generate-ci-template.js +79 -0
- package/dist/ci/index.d.ts +7 -0
- package/dist/ci/index.js +36 -0
- package/dist/ci/templates/azure-devops.d.ts +5 -0
- package/dist/ci/templates/azure-devops.js +142 -0
- package/dist/ci/templates/bitbucket.d.ts +5 -0
- package/dist/ci/templates/bitbucket.js +113 -0
- package/dist/ci/templates/github.d.ts +6 -0
- package/dist/ci/templates/github.js +156 -0
- package/dist/ci/templates/gitlab.d.ts +5 -0
- package/dist/ci/templates/gitlab.js +124 -0
- package/dist/ci/templates/jenkins.d.ts +5 -0
- package/dist/ci/templates/jenkins.js +125 -0
- package/dist/ci/types.d.ts +58 -0
- package/dist/ci/types.js +16 -0
- package/dist/client/attach-client.d.ts +48 -0
- package/dist/client/attach-client.js +122 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +8 -0
- package/dist/client/ingest-client.d.ts +19 -0
- package/dist/client/ingest-client.js +66 -0
- package/dist/config/config-loader.d.ts +8 -0
- package/dist/config/config-loader.js +62 -0
- package/dist/config/config-type.d.ts +24 -0
- package/dist/config/config-type.js +2 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +6 -0
- package/dist/env/ci-environment.d.ts +10 -0
- package/dist/env/ci-environment.js +59 -0
- package/dist/env/env-enum.d.ts +21 -0
- package/dist/env/env-enum.js +27 -0
- package/dist/env/env-to-config.d.ts +3 -0
- package/dist/env/env-to-config.js +53 -0
- package/dist/env/index.d.ts +4 -0
- package/dist/env/index.js +11 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +59 -0
- package/dist/models/attachment.d.ts +9 -0
- package/dist/models/attachment.js +2 -0
- package/dist/models/execution-sum.d.ts +7 -0
- package/dist/models/execution-sum.js +2 -0
- package/dist/models/host-data.d.ts +13 -0
- package/dist/models/host-data.js +2 -0
- package/dist/models/index.d.ts +14 -0
- package/dist/models/index.js +24 -0
- package/dist/models/ingest-payload.d.ts +56 -0
- package/dist/models/ingest-payload.js +56 -0
- package/dist/models/jest-vitest-report.d.ts +37 -0
- package/dist/models/jest-vitest-report.js +2 -0
- package/dist/models/meta-qa.d.ts +71 -0
- package/dist/models/meta-qa.js +257 -0
- package/dist/models/report.d.ts +15 -0
- package/dist/models/report.js +2 -0
- package/dist/models/short-result.d.ts +8 -0
- package/dist/models/short-result.js +2 -0
- package/dist/models/stats.d.ts +10 -0
- package/dist/models/stats.js +2 -0
- package/dist/models/step-data.d.ts +20 -0
- package/dist/models/step-data.js +2 -0
- package/dist/models/step-execution.d.ts +14 -0
- package/dist/models/step-execution.js +24 -0
- package/dist/models/test-execution.d.ts +18 -0
- package/dist/models/test-execution.js +30 -0
- package/dist/models/test-result.d.ts +34 -0
- package/dist/models/test-result.js +43 -0
- package/dist/models/test-step.d.ts +19 -0
- package/dist/models/test-step.js +46 -0
- package/dist/options/compose-options.d.ts +2 -0
- package/dist/options/compose-options.js +26 -0
- package/dist/options/index.d.ts +3 -0
- package/dist/options/index.js +7 -0
- package/dist/options/mode-enum.d.ts +5 -0
- package/dist/options/mode-enum.js +9 -0
- package/dist/options/options-type.d.ts +11 -0
- package/dist/options/options-type.js +2 -0
- package/dist/qanalyzer/index.d.ts +2 -0
- package/dist/qanalyzer/index.js +8 -0
- package/dist/qanalyzer/options-resolver.d.ts +11 -0
- package/dist/qanalyzer/options-resolver.js +31 -0
- package/dist/qanalyzer/reporter-factory.d.ts +11 -0
- package/dist/qanalyzer/reporter-factory.js +51 -0
- package/dist/qanalyzer.d.ts +29 -0
- package/dist/qanalyzer.js +96 -0
- package/dist/reporters/fallback-coordinator.d.ts +24 -0
- package/dist/reporters/fallback-coordinator.js +77 -0
- package/dist/reporters/file-reporter.d.ts +10 -0
- package/dist/reporters/file-reporter.js +16 -0
- package/dist/reporters/index.d.ts +4 -0
- package/dist/reporters/index.js +9 -0
- package/dist/reporters/ingest-reporter.d.ts +9 -0
- package/dist/reporters/ingest-reporter.js +14 -0
- package/dist/reporters/reporter-interface.d.ts +4 -0
- package/dist/reporters/reporter-interface.js +2 -0
- package/dist/utils/disabled-exception.d.ts +2 -0
- package/dist/utils/disabled-exception.js +6 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/issue-keys.d.ts +7 -0
- package/dist/utils/issue-keys.js +33 -0
- package/dist/utils/logger.d.ts +12 -0
- package/dist/utils/logger.js +21 -0
- package/dist/utils/token-masker.d.ts +2 -0
- package/dist/utils/token-masker.js +17 -0
- package/dist/utils/upload-attachment.d.ts +35 -0
- package/dist/utils/upload-attachment.js +158 -0
- package/dist/writer/fs-writer.d.ts +9 -0
- package/dist/writer/fs-writer.js +19 -0
- package/dist/writer/index.d.ts +1 -0
- package/dist/writer/index.js +5 -0
- package/package.json +34 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* FR41 wire shape for `assertionResults[].meta.qa`
|
|
4
|
+
* (architecture ingest contract — simplified TestResultType serialization).
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createQaMetaAccumulator = createQaMetaAccumulator;
|
|
8
|
+
exports.applyQaAnnotation = applyQaAnnotation;
|
|
9
|
+
exports.applyQaAnnotations = applyQaAnnotations;
|
|
10
|
+
exports.toQaMetaWire = toQaMetaWire;
|
|
11
|
+
exports.qaMetaFromEntries = qaMetaFromEntries;
|
|
12
|
+
function createQaMetaAccumulator() {
|
|
13
|
+
return { steps: [], attachments: [] };
|
|
14
|
+
}
|
|
15
|
+
function isRecord(value) {
|
|
16
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
17
|
+
}
|
|
18
|
+
function asStringRecord(value) {
|
|
19
|
+
if (!isRecord(value))
|
|
20
|
+
return undefined;
|
|
21
|
+
const out = {};
|
|
22
|
+
for (const [k, v] of Object.entries(value)) {
|
|
23
|
+
if (v != null)
|
|
24
|
+
out[String(k)] = String(v);
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
function resolveType(ann) {
|
|
29
|
+
if (ann.type?.startsWith('qa-')) {
|
|
30
|
+
return ann.type;
|
|
31
|
+
}
|
|
32
|
+
const message = ann.message ?? '';
|
|
33
|
+
if (message.startsWith('QA Title:'))
|
|
34
|
+
return 'qa-title';
|
|
35
|
+
if (message.startsWith('QA Comment:'))
|
|
36
|
+
return 'qa-comment';
|
|
37
|
+
if (message.startsWith('QA Suite:'))
|
|
38
|
+
return 'qa-suite';
|
|
39
|
+
if (message.startsWith('QA Fields:'))
|
|
40
|
+
return 'qa-fields';
|
|
41
|
+
if (message.startsWith('QA Parameters:'))
|
|
42
|
+
return 'qa-parameters';
|
|
43
|
+
if (message.startsWith('QA Step Failed:'))
|
|
44
|
+
return 'qa-step-failed';
|
|
45
|
+
if (message.startsWith('QA Step End:'))
|
|
46
|
+
return 'qa-step-end';
|
|
47
|
+
if (message.startsWith('QA Step Start:'))
|
|
48
|
+
return 'qa-step-start';
|
|
49
|
+
if (message.startsWith('QA Step:'))
|
|
50
|
+
return 'qa-step';
|
|
51
|
+
if (message.startsWith('QA Attach:'))
|
|
52
|
+
return 'qa-attach';
|
|
53
|
+
if (message.startsWith('QA Ignore'))
|
|
54
|
+
return 'qa-ignore';
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
function stripPrefix(message, prefix) {
|
|
58
|
+
return message.startsWith(prefix) ? message.slice(prefix.length).trim() : message.trim();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Apply a Vitest/Jest QA annotation (or typed helper entry) onto an accumulator.
|
|
62
|
+
* Non-QA annotations are ignored.
|
|
63
|
+
*/
|
|
64
|
+
function applyQaAnnotation(acc, ann) {
|
|
65
|
+
const type = resolveType(ann);
|
|
66
|
+
if (!type)
|
|
67
|
+
return;
|
|
68
|
+
const message = ann.message ?? '';
|
|
69
|
+
switch (type) {
|
|
70
|
+
case 'qa-title':
|
|
71
|
+
acc.title =
|
|
72
|
+
typeof ann.body === 'string' ? ann.body : stripPrefix(message, 'QA Title:');
|
|
73
|
+
break;
|
|
74
|
+
case 'qa-comment':
|
|
75
|
+
acc.comment =
|
|
76
|
+
typeof ann.body === 'string' ? ann.body : stripPrefix(message, 'QA Comment:');
|
|
77
|
+
break;
|
|
78
|
+
case 'qa-suite':
|
|
79
|
+
acc.suite =
|
|
80
|
+
typeof ann.body === 'string' ? ann.body : stripPrefix(message, 'QA Suite:');
|
|
81
|
+
break;
|
|
82
|
+
case 'qa-fields': {
|
|
83
|
+
const fromBody = asStringRecord(ann.body);
|
|
84
|
+
if (fromBody) {
|
|
85
|
+
acc.fields = { ...acc.fields, ...fromBody };
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
const parsed = JSON.parse(stripPrefix(message, 'QA Fields:'));
|
|
90
|
+
const record = asStringRecord(parsed);
|
|
91
|
+
if (record)
|
|
92
|
+
acc.fields = { ...acc.fields, ...record };
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// ignore malformed
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case 'qa-parameters': {
|
|
100
|
+
const fromBody = asStringRecord(ann.body);
|
|
101
|
+
if (fromBody) {
|
|
102
|
+
acc.parameters = { ...acc.parameters, ...fromBody };
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const parsed = JSON.parse(stripPrefix(message, 'QA Parameters:'));
|
|
107
|
+
const record = asStringRecord(parsed);
|
|
108
|
+
if (record)
|
|
109
|
+
acc.parameters = { ...acc.parameters, ...record };
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// ignore malformed
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case 'qa-step': {
|
|
117
|
+
const name = typeof ann.body === 'string'
|
|
118
|
+
? ann.body
|
|
119
|
+
: stripPrefix(message, 'QA Step:');
|
|
120
|
+
if (name)
|
|
121
|
+
acc.steps.push({ name, status: 'passed' });
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case 'qa-step-start': {
|
|
125
|
+
// WDIO helpers emit start; same as qa-step for accumulator
|
|
126
|
+
const name = typeof ann.body === 'string'
|
|
127
|
+
? ann.body
|
|
128
|
+
: stripPrefix(message, 'QA Step Start:');
|
|
129
|
+
if (name)
|
|
130
|
+
acc.steps.push({ name, status: 'passed' });
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case 'qa-step-end': {
|
|
134
|
+
const name = isRecord(ann.body) && typeof ann.body.name === 'string'
|
|
135
|
+
? ann.body.name
|
|
136
|
+
: stripPrefix(message, 'QA Step End:');
|
|
137
|
+
const status = isRecord(ann.body) && ann.body.status === 'failed' ? 'failed' : 'passed';
|
|
138
|
+
const step = [...acc.steps].reverse().find((s) => s.name === name);
|
|
139
|
+
if (step)
|
|
140
|
+
step.status = status;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case 'qa-step-failed': {
|
|
144
|
+
const name = isRecord(ann.body) && typeof ann.body.name === 'string'
|
|
145
|
+
? ann.body.name
|
|
146
|
+
: stripPrefix(message, 'QA Step Failed:');
|
|
147
|
+
const step = [...acc.steps].reverse().find((s) => s.name === name);
|
|
148
|
+
if (step)
|
|
149
|
+
step.status = 'failed';
|
|
150
|
+
else if (name)
|
|
151
|
+
acc.steps.push({ name, status: 'failed' });
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
case 'qa-attach': {
|
|
155
|
+
if (isRecord(ann.body)) {
|
|
156
|
+
acc.attachments.push({
|
|
157
|
+
file_name: typeof ann.body.name === 'string' ? ann.body.name : undefined,
|
|
158
|
+
mime_type: typeof ann.body.contentType === 'string'
|
|
159
|
+
? ann.body.contentType
|
|
160
|
+
: typeof ann.body.type === 'string'
|
|
161
|
+
? ann.body.type
|
|
162
|
+
: undefined,
|
|
163
|
+
size: typeof ann.body.size === 'number' ? ann.body.size : undefined,
|
|
164
|
+
content_ref: typeof ann.body.content_ref === 'string'
|
|
165
|
+
? ann.body.content_ref
|
|
166
|
+
: typeof ann.body.contentRef === 'string'
|
|
167
|
+
? ann.body.contentRef
|
|
168
|
+
: undefined,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
acc.attachments.push({
|
|
173
|
+
file_name: stripPrefix(message, 'QA Attach:') || undefined,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
case 'qa-ignore':
|
|
179
|
+
acc.ignore = true;
|
|
180
|
+
break;
|
|
181
|
+
default:
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function applyQaAnnotations(acc, annotations) {
|
|
186
|
+
for (const ann of annotations) {
|
|
187
|
+
applyQaAnnotation(acc, ann);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function defaultReporterName(framework) {
|
|
191
|
+
if (framework === 'jest')
|
|
192
|
+
return '@qanalyzer/forge-jest';
|
|
193
|
+
if (framework === 'mocha')
|
|
194
|
+
return '@qanalyzer/forge-mocha';
|
|
195
|
+
if (framework === 'cucumberjs')
|
|
196
|
+
return '@qanalyzer/forge-cucumberjs';
|
|
197
|
+
if (framework === 'cypress')
|
|
198
|
+
return '@qanalyzer/forge-cypress';
|
|
199
|
+
if (framework === 'playwright')
|
|
200
|
+
return '@qanalyzer/forge-playwright';
|
|
201
|
+
if (framework === 'wdio')
|
|
202
|
+
return '@qanalyzer/forge-wdio';
|
|
203
|
+
return '@qanalyzer/forge-vitest';
|
|
204
|
+
}
|
|
205
|
+
/** Returns undefined when accumulator has no QA data (omit empty meta.qa). */
|
|
206
|
+
function toQaMetaWire(acc, options) {
|
|
207
|
+
const hasData = acc.title !== undefined ||
|
|
208
|
+
acc.comment !== undefined ||
|
|
209
|
+
acc.suite !== undefined ||
|
|
210
|
+
(acc.fields && Object.keys(acc.fields).length > 0) ||
|
|
211
|
+
(acc.parameters && Object.keys(acc.parameters).length > 0) ||
|
|
212
|
+
acc.steps.length > 0 ||
|
|
213
|
+
acc.attachments.length > 0 ||
|
|
214
|
+
acc.ignore === true;
|
|
215
|
+
if (!hasData)
|
|
216
|
+
return undefined;
|
|
217
|
+
const wire = {
|
|
218
|
+
framework: options.framework,
|
|
219
|
+
host: {
|
|
220
|
+
framework: options.framework,
|
|
221
|
+
reporter: options.reporter ?? defaultReporterName(options.framework),
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
if (acc.title !== undefined)
|
|
225
|
+
wire.title = acc.title;
|
|
226
|
+
if (acc.comment !== undefined)
|
|
227
|
+
wire.comment = acc.comment;
|
|
228
|
+
if (acc.fields && Object.keys(acc.fields).length > 0)
|
|
229
|
+
wire.fields = acc.fields;
|
|
230
|
+
if (acc.parameters && Object.keys(acc.parameters).length > 0) {
|
|
231
|
+
wire.parameters = acc.parameters;
|
|
232
|
+
}
|
|
233
|
+
if (acc.suite) {
|
|
234
|
+
wire.suite = acc.suite.split('\t').filter(Boolean).map((title) => ({ title }));
|
|
235
|
+
}
|
|
236
|
+
if (acc.steps.length > 0) {
|
|
237
|
+
wire.steps = acc.steps.map((step, index) => ({
|
|
238
|
+
id: `s${index + 1}`,
|
|
239
|
+
stepType: 'text',
|
|
240
|
+
name: step.name,
|
|
241
|
+
status: step.status,
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
if (acc.attachments.length > 0)
|
|
245
|
+
wire.attachments = acc.attachments;
|
|
246
|
+
if (acc.ignore)
|
|
247
|
+
wire.ignore = true;
|
|
248
|
+
return wire;
|
|
249
|
+
}
|
|
250
|
+
/** Build meta.qa from typed helper buffer entries (`{ type, body }`). */
|
|
251
|
+
function qaMetaFromEntries(entries, options) {
|
|
252
|
+
const acc = createQaMetaAccumulator();
|
|
253
|
+
for (const entry of entries) {
|
|
254
|
+
applyQaAnnotation(acc, { type: entry.type, body: entry.body });
|
|
255
|
+
}
|
|
256
|
+
return toQaMetaWire(acc, options);
|
|
257
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HostData } from './host-data';
|
|
2
|
+
import { ShortResult } from './short-result';
|
|
3
|
+
import { Stats } from './stats';
|
|
4
|
+
import { ExecutionSum } from './execution-sum';
|
|
5
|
+
/** One persisted launch aggregate (results + stats + host). */
|
|
6
|
+
export interface Report {
|
|
7
|
+
environment: string;
|
|
8
|
+
execution: ExecutionSum;
|
|
9
|
+
host_data: HostData;
|
|
10
|
+
results: ShortResult[];
|
|
11
|
+
stats: Stats;
|
|
12
|
+
suites: string[];
|
|
13
|
+
threads: string[];
|
|
14
|
+
title: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Step payload variants (text, Gherkin, HTTP request). */
|
|
2
|
+
export interface StepTextData {
|
|
3
|
+
action: string;
|
|
4
|
+
expected_result: string | null;
|
|
5
|
+
data: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface StepGherkinData {
|
|
8
|
+
keyword: string;
|
|
9
|
+
name: string;
|
|
10
|
+
line: number;
|
|
11
|
+
}
|
|
12
|
+
export interface StepRequestData {
|
|
13
|
+
request_method: string;
|
|
14
|
+
request_url: string;
|
|
15
|
+
request_headers: Record<string, string> | null;
|
|
16
|
+
request_body: string | null;
|
|
17
|
+
status_code: number | null;
|
|
18
|
+
response_body: string | null;
|
|
19
|
+
response_headers: Record<string, string> | null;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Step status and timing. */
|
|
2
|
+
export declare enum StepStatusEnum {
|
|
3
|
+
passed = "passed",
|
|
4
|
+
failed = "failed",
|
|
5
|
+
blocked = "blocked",
|
|
6
|
+
skipped = "skipped"
|
|
7
|
+
}
|
|
8
|
+
export declare class StepExecution {
|
|
9
|
+
start_time: number | null;
|
|
10
|
+
status: StepStatusEnum;
|
|
11
|
+
end_time: number | null;
|
|
12
|
+
duration: number | null;
|
|
13
|
+
constructor();
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StepExecution = exports.StepStatusEnum = void 0;
|
|
4
|
+
/** Step status and timing. */
|
|
5
|
+
var StepStatusEnum;
|
|
6
|
+
(function (StepStatusEnum) {
|
|
7
|
+
StepStatusEnum["passed"] = "passed";
|
|
8
|
+
StepStatusEnum["failed"] = "failed";
|
|
9
|
+
StepStatusEnum["blocked"] = "blocked";
|
|
10
|
+
StepStatusEnum["skipped"] = "skipped";
|
|
11
|
+
})(StepStatusEnum || (exports.StepStatusEnum = StepStatusEnum = {}));
|
|
12
|
+
class StepExecution {
|
|
13
|
+
start_time;
|
|
14
|
+
status;
|
|
15
|
+
end_time;
|
|
16
|
+
duration;
|
|
17
|
+
constructor() {
|
|
18
|
+
this.status = StepStatusEnum.passed;
|
|
19
|
+
this.start_time = null;
|
|
20
|
+
this.end_time = null;
|
|
21
|
+
this.duration = null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.StepExecution = StepExecution;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Test status and timing for a single result. */
|
|
2
|
+
export declare enum TestStatusEnum {
|
|
3
|
+
passed = "passed",
|
|
4
|
+
failed = "failed",
|
|
5
|
+
skipped = "skipped",
|
|
6
|
+
disabled = "disabled",
|
|
7
|
+
blocked = "blocked",
|
|
8
|
+
invalid = "invalid"
|
|
9
|
+
}
|
|
10
|
+
export declare class TestExecution {
|
|
11
|
+
start_time: number | null;
|
|
12
|
+
status: TestStatusEnum;
|
|
13
|
+
end_time: number | null;
|
|
14
|
+
duration: number | null;
|
|
15
|
+
stacktrace: string | null;
|
|
16
|
+
thread: string | null;
|
|
17
|
+
constructor();
|
|
18
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestExecution = exports.TestStatusEnum = void 0;
|
|
4
|
+
/** Test status and timing for a single result. */
|
|
5
|
+
var TestStatusEnum;
|
|
6
|
+
(function (TestStatusEnum) {
|
|
7
|
+
TestStatusEnum["passed"] = "passed";
|
|
8
|
+
TestStatusEnum["failed"] = "failed";
|
|
9
|
+
TestStatusEnum["skipped"] = "skipped";
|
|
10
|
+
TestStatusEnum["disabled"] = "disabled";
|
|
11
|
+
TestStatusEnum["blocked"] = "blocked";
|
|
12
|
+
TestStatusEnum["invalid"] = "invalid";
|
|
13
|
+
})(TestStatusEnum || (exports.TestStatusEnum = TestStatusEnum = {}));
|
|
14
|
+
class TestExecution {
|
|
15
|
+
start_time;
|
|
16
|
+
status;
|
|
17
|
+
end_time;
|
|
18
|
+
duration;
|
|
19
|
+
stacktrace;
|
|
20
|
+
thread;
|
|
21
|
+
constructor() {
|
|
22
|
+
this.status = TestStatusEnum.passed;
|
|
23
|
+
this.start_time = null;
|
|
24
|
+
this.end_time = null;
|
|
25
|
+
this.duration = null;
|
|
26
|
+
this.stacktrace = null;
|
|
27
|
+
this.thread = null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.TestExecution = TestExecution;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TestStepType } from './test-step';
|
|
2
|
+
import { Attachment } from './attachment';
|
|
3
|
+
import { TestExecution } from './test-execution';
|
|
4
|
+
/**
|
|
5
|
+
* Normalized test result for Forge ingest.
|
|
6
|
+
* Jira traceability via title/tags (issue keys).
|
|
7
|
+
*/
|
|
8
|
+
export declare class TestResultType {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
signature: string;
|
|
12
|
+
execution: TestExecution;
|
|
13
|
+
fields: Record<string, string>;
|
|
14
|
+
attachments: Attachment[];
|
|
15
|
+
steps: TestStepType[];
|
|
16
|
+
params: Record<string, string>;
|
|
17
|
+
group_params: Record<string, string>;
|
|
18
|
+
author: string | null;
|
|
19
|
+
relations: Relation | null;
|
|
20
|
+
muted: boolean;
|
|
21
|
+
message: string | null;
|
|
22
|
+
tags: string[];
|
|
23
|
+
preparedAttachments?: string[];
|
|
24
|
+
constructor(title: string);
|
|
25
|
+
}
|
|
26
|
+
export interface Relation {
|
|
27
|
+
suite?: Suite;
|
|
28
|
+
}
|
|
29
|
+
export interface Suite {
|
|
30
|
+
data: SuiteData[];
|
|
31
|
+
}
|
|
32
|
+
export interface SuiteData {
|
|
33
|
+
title: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestResultType = void 0;
|
|
4
|
+
const test_execution_1 = require("./test-execution");
|
|
5
|
+
/**
|
|
6
|
+
* Normalized test result for Forge ingest.
|
|
7
|
+
* Jira traceability via title/tags (issue keys).
|
|
8
|
+
*/
|
|
9
|
+
class TestResultType {
|
|
10
|
+
id;
|
|
11
|
+
title;
|
|
12
|
+
signature;
|
|
13
|
+
execution;
|
|
14
|
+
fields;
|
|
15
|
+
attachments;
|
|
16
|
+
steps;
|
|
17
|
+
params;
|
|
18
|
+
group_params;
|
|
19
|
+
author;
|
|
20
|
+
relations;
|
|
21
|
+
muted;
|
|
22
|
+
message;
|
|
23
|
+
tags;
|
|
24
|
+
preparedAttachments;
|
|
25
|
+
constructor(title) {
|
|
26
|
+
this.id = '';
|
|
27
|
+
this.title = title;
|
|
28
|
+
this.signature = '';
|
|
29
|
+
this.execution = new test_execution_1.TestExecution();
|
|
30
|
+
this.fields = {};
|
|
31
|
+
this.attachments = [];
|
|
32
|
+
this.steps = [];
|
|
33
|
+
this.params = {};
|
|
34
|
+
this.group_params = {};
|
|
35
|
+
this.author = null;
|
|
36
|
+
this.relations = null;
|
|
37
|
+
this.muted = false;
|
|
38
|
+
this.message = null;
|
|
39
|
+
this.tags = [];
|
|
40
|
+
this.preparedAttachments = [];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.TestResultType = TestResultType;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StepGherkinData, StepRequestData, StepTextData } from './step-data';
|
|
2
|
+
import { StepExecution } from './step-execution';
|
|
3
|
+
import { Attachment } from './attachment';
|
|
4
|
+
/** Step type discriminant and step record. */
|
|
5
|
+
export declare enum StepType {
|
|
6
|
+
TEXT = "text",
|
|
7
|
+
GHERKIN = "gherkin",
|
|
8
|
+
REQUEST = "request"
|
|
9
|
+
}
|
|
10
|
+
export declare class TestStepType {
|
|
11
|
+
id: string;
|
|
12
|
+
step_type: StepType;
|
|
13
|
+
data: StepTextData | StepGherkinData | StepRequestData;
|
|
14
|
+
parent_id: string | null;
|
|
15
|
+
execution: StepExecution;
|
|
16
|
+
attachments: Attachment[];
|
|
17
|
+
steps: TestStepType[];
|
|
18
|
+
constructor(type?: StepType);
|
|
19
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestStepType = exports.StepType = void 0;
|
|
4
|
+
const step_execution_1 = require("./step-execution");
|
|
5
|
+
/** Step type discriminant and step record. */
|
|
6
|
+
var StepType;
|
|
7
|
+
(function (StepType) {
|
|
8
|
+
StepType["TEXT"] = "text";
|
|
9
|
+
StepType["GHERKIN"] = "gherkin";
|
|
10
|
+
StepType["REQUEST"] = "request";
|
|
11
|
+
})(StepType || (exports.StepType = StepType = {}));
|
|
12
|
+
class TestStepType {
|
|
13
|
+
id;
|
|
14
|
+
step_type;
|
|
15
|
+
data;
|
|
16
|
+
parent_id;
|
|
17
|
+
execution;
|
|
18
|
+
attachments;
|
|
19
|
+
steps;
|
|
20
|
+
constructor(type = StepType.TEXT) {
|
|
21
|
+
this.id = '';
|
|
22
|
+
this.step_type = type;
|
|
23
|
+
this.parent_id = null;
|
|
24
|
+
this.execution = new step_execution_1.StepExecution();
|
|
25
|
+
this.attachments = [];
|
|
26
|
+
this.steps = [];
|
|
27
|
+
if (type === StepType.TEXT) {
|
|
28
|
+
this.data = { action: '', expected_result: null, data: null };
|
|
29
|
+
}
|
|
30
|
+
else if (type === StepType.GHERKIN) {
|
|
31
|
+
this.data = { keyword: '', name: '', line: 0 };
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.data = {
|
|
35
|
+
request_method: '',
|
|
36
|
+
request_url: '',
|
|
37
|
+
request_headers: null,
|
|
38
|
+
request_body: null,
|
|
39
|
+
status_code: null,
|
|
40
|
+
response_body: null,
|
|
41
|
+
response_headers: null,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.TestStepType = TestStepType;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.composeOptions = composeOptions;
|
|
4
|
+
function isPlainObject(value) {
|
|
5
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
/** Deep-merge sources; later defined keys win; `undefined` is skipped. */
|
|
8
|
+
function composeOptions(...sources) {
|
|
9
|
+
const result = {};
|
|
10
|
+
for (const source of sources) {
|
|
11
|
+
if (!source)
|
|
12
|
+
continue;
|
|
13
|
+
for (const [key, value] of Object.entries(source)) {
|
|
14
|
+
if (value === undefined)
|
|
15
|
+
continue;
|
|
16
|
+
const existing = result[key];
|
|
17
|
+
if (isPlainObject(existing) && isPlainObject(value)) {
|
|
18
|
+
result[key] = composeOptions(existing, value);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
result[key] = value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.composeOptions = exports.ModeEnum = void 0;
|
|
4
|
+
var mode_enum_1 = require("./mode-enum");
|
|
5
|
+
Object.defineProperty(exports, "ModeEnum", { enumerable: true, get: function () { return mode_enum_1.ModeEnum; } });
|
|
6
|
+
var compose_options_1 = require("./compose-options");
|
|
7
|
+
Object.defineProperty(exports, "composeOptions", { enumerable: true, get: function () { return compose_options_1.composeOptions; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModeEnum = void 0;
|
|
4
|
+
var ModeEnum;
|
|
5
|
+
(function (ModeEnum) {
|
|
6
|
+
ModeEnum["ingest"] = "ingest";
|
|
7
|
+
ModeEnum["file"] = "file";
|
|
8
|
+
ModeEnum["off"] = "off";
|
|
9
|
+
})(ModeEnum || (exports.ModeEnum = ModeEnum = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ModeEnum } from './mode-enum';
|
|
2
|
+
import type { ConfigType } from '../config';
|
|
3
|
+
export type FrameworkOptionsType = {
|
|
4
|
+
frameworkPackage?: string;
|
|
5
|
+
frameworkName?: string;
|
|
6
|
+
reporterName?: string;
|
|
7
|
+
};
|
|
8
|
+
export type OptionsType = FrameworkOptionsType & Partial<ConfigType> & {
|
|
9
|
+
mode?: `${ModeEnum}`;
|
|
10
|
+
fallback?: `${ModeEnum}`;
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReporterFactory = exports.createDefaultConfig = exports.OptionsResolver = void 0;
|
|
4
|
+
var options_resolver_1 = require("./options-resolver");
|
|
5
|
+
Object.defineProperty(exports, "OptionsResolver", { enumerable: true, get: function () { return options_resolver_1.OptionsResolver; } });
|
|
6
|
+
Object.defineProperty(exports, "createDefaultConfig", { enumerable: true, get: function () { return options_resolver_1.createDefaultConfig; } });
|
|
7
|
+
var reporter_factory_1 = require("./reporter-factory");
|
|
8
|
+
Object.defineProperty(exports, "ReporterFactory", { enumerable: true, get: function () { return reporter_factory_1.ReporterFactory; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConfigType } from '../config';
|
|
2
|
+
import { ModeEnum, type OptionsType } from '../options';
|
|
3
|
+
export type ResolvedOptions = {
|
|
4
|
+
effectiveMode: ModeEnum;
|
|
5
|
+
effectiveFallback: ModeEnum;
|
|
6
|
+
composed: ConfigType & OptionsType;
|
|
7
|
+
};
|
|
8
|
+
export declare class OptionsResolver {
|
|
9
|
+
resolve(options?: OptionsType): ResolvedOptions;
|
|
10
|
+
}
|
|
11
|
+
export declare function createDefaultConfig(): ConfigType;
|