allure-cucumberjs 2.15.1 → 3.0.0-beta.2

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy.js","names":["World","allure","AllureCucumberWorld","constructor","arguments","_defineProperty","name","value","Promise","resolve","label","type","url","link","options","parameter","description","html","descriptionHtml","id","testCaseId","historyId","allureId","displayName","content","attachment","contentType","issue","tms","epic","feature","story","suite","parentSuite","subSuite","owner","severity","layer","tag","body","step"],"sources":["../../src/legacy.ts"],"sourcesContent":["import { World } from \"@cucumber/cucumber\";\nimport * as allure from \"allure-js-commons\";\nimport type { ParameterOptions } from \"allure-js-commons\";\n\n/**\n * @deprecated please use api exported by \"allure-js-commons\" instead.\n */\nexport interface AllureCucumberLegacyApi {\n label: (name: string, value: string) => Promise<void>;\n link: (type: string, url: string, name?: string) => Promise<void>;\n parameter: (name: string, value: string, options?: ParameterOptions) => Promise<void>;\n description: (markdown: string) => Promise<void>;\n descriptionHtml: (html: string) => Promise<void>;\n testCaseId: (id: string) => Promise<void>;\n historyId: (id: string) => Promise<void>;\n allureId: (id: string) => Promise<void>;\n displayName: (name: string) => Promise<void>;\n attachment: (name: string, content: Buffer | string, type: string) => Promise<void>;\n issue: (name: string, url: string) => Promise<void>;\n tms: (name: string, url: string) => Promise<void>;\n epic: (name: string) => Promise<void>;\n feature: (name: string) => Promise<void>;\n story: (name: string) => Promise<void>;\n suite: (name: string) => Promise<void>;\n parentSuite: (name: string) => Promise<void>;\n subSuite: (name: string) => Promise<void>;\n owner: (name: string) => Promise<void>;\n severity: (name: string) => Promise<void>;\n layer: (name: string) => Promise<void>;\n tag: (name: string) => Promise<void>;\n step: (name: string, body: () => Promise<void>) => Promise<void>;\n}\n\n/**\n * @deprecated please use api exported by \"allure-js-commons\" instead.\n */\nexport class AllureCucumberWorld extends World implements AllureCucumberLegacyApi {\n /**\n * @deprecated please use import { label } from \"allure-js-commons\" instead.\n */\n label = (name: string, value: string) => Promise.resolve(allure.label(name, value));\n /**\n * @deprecated please use import { link } from \"allure-js-commons\" instead.\n */\n link = (type: string, url: string, name?: string) => Promise.resolve(allure.link(url, name, type));\n /**\n * @deprecated please use import { parameter } from \"allure-js-commons\" instead.\n */\n parameter = (name: string, value: string, options?: ParameterOptions) =>\n Promise.resolve(allure.parameter(name, value, options));\n /**\n * @deprecated please use import { description } from \"allure-js-commons\" instead.\n */\n description = (value: string) => Promise.resolve(allure.description(value));\n /**\n * @deprecated please use import { descriptionHtml } from \"allure-js-commons\" instead.\n */\n descriptionHtml = (html: string) => Promise.resolve(allure.descriptionHtml(html));\n /**\n * @deprecated please use import { testCaseId } from \"allure-js-commons\" instead.\n */\n testCaseId = (id: string) => Promise.resolve(allure.testCaseId(id));\n /**\n * @deprecated please use import { historyId } from \"allure-js-commons\" instead.\n */\n historyId = (id: string) => Promise.resolve(allure.historyId(id));\n /**\n * @deprecated please use import { allureId } from \"allure-js-commons\" instead.\n */\n allureId = (id: string) => Promise.resolve(allure.allureId(id));\n /**\n * @deprecated please use import { displayName } from \"allure-js-commons\" instead.\n */\n displayName = (name: string) => Promise.resolve(allure.displayName(name));\n /**\n * @deprecated please use import { attachment } from \"allure-js-commons\" instead.\n */\n attachment = (name: string, content: Buffer | string, type: string) =>\n Promise.resolve(allure.attachment(name, content, { contentType: type }));\n /**\n * @deprecated please use import { issue } from \"allure-js-commons\" instead.\n */\n issue = (name: string, url: string) => Promise.resolve(allure.issue(url, name));\n /**\n * @deprecated please use import { tms } from \"allure-js-commons\" instead.\n */\n tms = (name: string, url: string) => Promise.resolve(allure.tms(url, name));\n /**\n * @deprecated please use import { epic } from \"allure-js-commons\" instead.\n */\n epic = (name: string) => Promise.resolve(allure.epic(name));\n /**\n * @deprecated please use import { feature } from \"allure-js-commons\" instead.\n */\n feature = (name: string) => Promise.resolve(allure.feature(name));\n /**\n * @deprecated please use import { story } from \"allure-js-commons\" instead.\n */\n story = (name: string) => Promise.resolve(allure.story(name));\n /**\n * @deprecated please use import { suite } from \"allure-js-commons\" instead.\n */\n suite = (name: string) => Promise.resolve(allure.suite(name));\n /**\n * @deprecated please use import { parentSuite } from \"allure-js-commons\" instead.\n */\n parentSuite = (name: string) => Promise.resolve(allure.parentSuite(name));\n /**\n * @deprecated please use import { subSuite } from \"allure-js-commons\" instead.\n */\n subSuite = (name: string) => Promise.resolve(allure.subSuite(name));\n /**\n * @deprecated please use import { owner } from \"allure-js-commons\" instead.\n */\n owner = (name: string) => Promise.resolve(allure.owner(name));\n /**\n * @deprecated please use import { severity } from \"allure-js-commons\" instead.\n */\n severity = (name: string) => Promise.resolve(allure.severity(name));\n /**\n * @deprecated please use import { layer } from \"allure-js-commons\" instead.\n */\n layer = (name: string) => Promise.resolve(allure.layer(name));\n /**\n * @deprecated please use import { tag } from \"allure-js-commons\" instead.\n */\n tag = (name: string) => Promise.resolve(allure.tag(name));\n /**\n * @deprecated please use import { step } from \"allure-js-commons\" instead.\n */\n step = (name: string, body: () => any) => Promise.resolve(allure.step(name, body));\n}\n"],"mappings":";;;AAAA,SAASA,KAAK,QAAQ,oBAAoB;AAC1C,OAAO,KAAKC,MAAM,MAAM,mBAAmB;;AAG3C;AACA;AACA;;AA2BA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,SAASF,KAAK,CAAoC;EAAAG,YAAA;IAAA,SAAAC,SAAA;IAChF;AACF;AACA;IAFEC,eAAA,gBAGQ,CAACC,IAAY,EAAEC,KAAa,KAAKC,OAAO,CAACC,OAAO,CAACR,MAAM,CAACS,KAAK,CAACJ,IAAI,EAAEC,KAAK,CAAC,CAAC;IACnF;AACF;AACA;IAFEF,eAAA,eAGO,CAACM,IAAY,EAAEC,GAAW,EAAEN,IAAa,KAAKE,OAAO,CAACC,OAAO,CAACR,MAAM,CAACY,IAAI,CAACD,GAAG,EAAEN,IAAI,EAAEK,IAAI,CAAC,CAAC;IAClG;AACF;AACA;IAFEN,eAAA,oBAGY,CAACC,IAAY,EAA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AY,IAAKE,OAAO,CAACC,OAAO,CAACR,MAAM,CAACqC,GAAG,CAAChC,IAAI,CAAC,CAAC;IACzD;AACF;AACA;IAFED,eAAA,eAGO,CAACC,IAAY,EAAEiC,IAAe,KAAK/B,OAAO,CAACC,OAAO,CAACR,MAAM,CAACuC,IAAI,CAAClC,IAAI,EAAEiC,IAAI,CAAC,CAAC;EAAA;AACpF","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","names":[],"sources":["../../src/model.ts"],"sourcesContent":["import type { LabelName, LinkType } from \"allure-js-commons\";\nimport type { Config } from \"allure-js-commons/sdk/reporter\";\n\nexport type LabelConfig = {\n pattern: RegExp[];\n name: LabelName | string;\n};\n\nexport type LinkConfig = {\n pattern: RegExp[];\n urlTemplate: string;\n type: LinkType | string;\n};\n\nexport interface AllureCucumberReporterConfig extends Omit<Config, \"writer\" | \"links\"> {\n testMode?: boolean;\n links?: LinkConfig[];\n labels?: LabelConfig[];\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,377 @@
1
+ var _excluded = ["resultsDir", "testMode", "links", "labels"];
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
5
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
8
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ import { Formatter, World } from "@cucumber/cucumber";
10
+ import { AttachmentContentEncoding } from "@cucumber/messages";
11
+ import { TestStepResultStatus } from "@cucumber/messages";
12
+ import os from "node:os";
13
+ import { extname } from "node:path";
14
+ import process from "node:process";
15
+ import { ContentType, LabelName, Stage, Status } from "allure-js-commons";
16
+ import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, FileSystemWriter, MessageWriter, ReporterRuntime, createStepResult, getWorstStepResultStatus, md5 } from "allure-js-commons/sdk/reporter";
17
+ import { AllureCucumberWorld } from "./legacy.js";
18
+ var {
19
+ ALLURE_THREAD_NAME
20
+ } = process.env;
21
+ export default class AllureCucumberReporter extends Formatter {
22
+ constructor(options) {
23
+ super(options);
24
+ _defineProperty(this, "afterHooks", void 0);
25
+ _defineProperty(this, "beforeHooks", void 0);
26
+ _defineProperty(this, "linksConfigs", []);
27
+ _defineProperty(this, "labelsConfigs", []);
28
+ _defineProperty(this, "runtime", void 0);
29
+ _defineProperty(this, "documentMap", new Map());
30
+ _defineProperty(this, "scenarioMap", new Map());
31
+ _defineProperty(this, "stepMap", new Map());
32
+ _defineProperty(this, "testStepMap", new Map());
33
+ _defineProperty(this, "pickleStepMap", new Map());
34
+ _defineProperty(this, "testCaseTestStepsResults", new Map());
35
+ _defineProperty(this, "pickleMap", new Map());
36
+ _defineProperty(this, "hookMap", new Map());
37
+ _defineProperty(this, "testCaseMap", new Map());
38
+ _defineProperty(this, "testCaseStartedMap", new Map());
39
+ _defineProperty(this, "allureResultsUuids", new Map());
40
+ var _ref = options.parsedArgvOptions,
41
+ {
42
+ resultsDir = "./allure-results",
43
+ testMode,
44
+ links,
45
+ labels
46
+ } = _ref,
47
+ rest = _objectWithoutProperties(_ref, _excluded);
48
+ this.runtime = new ReporterRuntime(_objectSpread({
49
+ writer: testMode ? new MessageWriter() : new FileSystemWriter({
50
+ resultsDir
51
+ }),
52
+ links: links
53
+ }, rest));
54
+ this.linksConfigs = links || [];
55
+ this.labelsConfigs = labels || [];
56
+ options.eventBroadcaster.on("envelope", this.parseEnvelope.bind(this));
57
+ this.beforeHooks = options.supportCodeLibrary.beforeTestCaseHookDefinitions;
58
+ this.afterHooks = options.supportCodeLibrary.afterTestCaseHookDefinitions;
59
+
60
+ // set AllureCucumberWorld for single thread mode
61
+ if (options.supportCodeLibrary.World === World) {
62
+ // @ts-ignore
63
+ // noinspection JSConstantReassignment
64
+ options.supportCodeLibrary.World = AllureCucumberWorld;
65
+ }
66
+ }
67
+ get tagsIgnorePatterns() {
68
+ var {
69
+ labelsConfigs,
70
+ linksConfigs
71
+ } = this;
72
+ return [...labelsConfigs, ...linksConfigs].flatMap(_ref2 => {
73
+ var {
74
+ pattern
75
+ } = _ref2;
76
+ return pattern;
77
+ });
78
+ }
79
+ parseEnvelope(envelope) {
80
+ switch (true) {
81
+ case !!envelope.gherkinDocument:
82
+ this.onGherkinDocument(envelope.gherkinDocument);
83
+ break;
84
+ case !!envelope.pickle:
85
+ this.onPickle(envelope.pickle);
86
+ break;
87
+ case !!envelope.testCase:
88
+ this.onTestCase(envelope.testCase);
89
+ break;
90
+ case !!envelope.testCaseStarted:
91
+ this.onTestCaseStarted(envelope.testCaseStarted);
92
+ break;
93
+ case !!envelope.testCaseFinished:
94
+ this.onTestCaseFinished(envelope.testCaseFinished);
95
+ break;
96
+ case !!envelope.attachment:
97
+ this.onAttachment(envelope.attachment);
98
+ break;
99
+ case !!envelope.hook:
100
+ this.onHook(envelope.hook);
101
+ break;
102
+ case !!envelope.testStepStarted:
103
+ this.onTestStepStarted(envelope.testStepStarted);
104
+ break;
105
+ case !!envelope.testStepFinished:
106
+ this.onTestStepFinished(envelope.testStepFinished);
107
+ break;
108
+ }
109
+ }
110
+ parseTagsLabels(tags) {
111
+ var labels = [];
112
+ if (this.labelsConfigs.length === 0) {
113
+ return labels;
114
+ }
115
+ this.labelsConfigs.forEach(matcher => {
116
+ var matchedTags = tags.filter(tag => matcher.pattern.some(pattern => pattern.test(tag.name)));
117
+ var matchedLabels = matchedTags.map(tag => {
118
+ var tagValue = tag.name.replace(/^@\S+:/, "");
119
+ return {
120
+ name: matcher.name,
121
+ value: tagValue
122
+ };
123
+ });
124
+ labels.push(...matchedLabels);
125
+ });
126
+ return labels;
127
+ }
128
+ parsePickleTags(tags) {
129
+ return tags.filter(tag => !this.tagsIgnorePatterns.some(pattern => pattern.test(tag.name))).map(tag => ({
130
+ name: LabelName.TAG,
131
+ value: tag.name
132
+ }));
133
+ }
134
+ parseTagsLinks(tags) {
135
+ var tagKeyRe = /^@\S+=/;
136
+ var links = [];
137
+ if (this.linksConfigs.length === 0) {
138
+ return links;
139
+ }
140
+ this.linksConfigs.forEach(matcher => {
141
+ var matchedTags = tags.filter(tag => matcher.pattern.some(pattern => pattern.test(tag.name)));
142
+ var matchedLinks = matchedTags.map(tag => {
143
+ var tagValue = tag.name.replace(tagKeyRe, "");
144
+ return {
145
+ url: matcher.urlTemplate.replace(/%s$/, tagValue) || tagValue,
146
+ type: matcher.type
147
+ };
148
+ });
149
+ links.push(...matchedLinks);
150
+ });
151
+ return links;
152
+ }
153
+ parseStatus(stepResult) {
154
+ var _stepResult$exception;
155
+ var containsAssertionError = /assertion/i.test((stepResult === null || stepResult === void 0 || (_stepResult$exception = stepResult.exception) === null || _stepResult$exception === void 0 ? void 0 : _stepResult$exception.type) || "");
156
+ switch (stepResult.status) {
157
+ case TestStepResultStatus.FAILED:
158
+ return containsAssertionError ? Status.FAILED : Status.BROKEN;
159
+ case TestStepResultStatus.PASSED:
160
+ return Status.PASSED;
161
+ case TestStepResultStatus.SKIPPED:
162
+ case TestStepResultStatus.PENDING:
163
+ return Status.SKIPPED;
164
+ default:
165
+ return undefined;
166
+ }
167
+ }
168
+ onRule(data) {
169
+ var _data$children;
170
+ (_data$children = data.children) === null || _data$children === void 0 || _data$children.forEach(c => {
171
+ if (c.scenario) {
172
+ this.onScenario(c.scenario);
173
+ }
174
+ });
175
+ }
176
+ onGherkinDocument(data) {
177
+ var _data$feature;
178
+ if (data.uri) {
179
+ this.documentMap.set(data.uri, data);
180
+ }
181
+ (_data$feature = data.feature) === null || _data$feature === void 0 || (_data$feature = _data$feature.children) === null || _data$feature === void 0 || _data$feature.forEach(c => {
182
+ if (c.rule) {
183
+ this.onRule(c.rule);
184
+ } else if (c.scenario) {
185
+ this.onScenario(c.scenario);
186
+ }
187
+ });
188
+ }
189
+ onScenario(data) {
190
+ this.scenarioMap.set(data.id, data);
191
+ data.steps.forEach(step => this.stepMap.set(step.id, step));
192
+ }
193
+ onPickle(data) {
194
+ this.pickleMap.set(data.id, data);
195
+ data.steps.forEach(ps => this.pickleStepMap.set(ps.id, ps));
196
+ }
197
+ onTestCase(data) {
198
+ this.testCaseMap.set(data.id, data);
199
+ data.testSteps.forEach(ts => this.testStepMap.set(ts.id, ts));
200
+ }
201
+ onTestCaseStarted(data) {
202
+ var _doc$feature, _doc$feature2, _doc$feature3;
203
+ var testCase = this.testCaseMap.get(data.testCaseId);
204
+ var pickle = this.pickleMap.get(testCase.pickleId);
205
+ var doc = this.documentMap.get(pickle.uri);
206
+ var [scenarioId] = pickle.astNodeIds;
207
+ var scenario = this.scenarioMap.get(scenarioId);
208
+ var fullName = "".concat(pickle.uri, "#").concat(pickle.name);
209
+ var result = {
210
+ name: pickle.name,
211
+ description: ((scenario === null || scenario === void 0 ? void 0 : scenario.description) || (doc === null || doc === void 0 || (_doc$feature = doc.feature) === null || _doc$feature === void 0 ? void 0 : _doc$feature.description) || "").trim(),
212
+ labels: [],
213
+ links: [],
214
+ testCaseId: md5(fullName),
215
+ start: Date.now(),
216
+ fullName
217
+ };
218
+ result.labels.push({
219
+ name: LabelName.HOST,
220
+ value: os.hostname()
221
+ }, {
222
+ name: LabelName.LANGUAGE,
223
+ value: "javascript"
224
+ }, {
225
+ name: LabelName.FRAMEWORK,
226
+ value: "cucumberjs"
227
+ }, {
228
+ name: LabelName.THREAD,
229
+ value: data.workerId || ALLURE_THREAD_NAME || process.pid.toString()
230
+ });
231
+ if (doc !== null && doc !== void 0 && doc.feature) {
232
+ result.labels.push({
233
+ name: LabelName.FEATURE,
234
+ value: doc.feature.name
235
+ });
236
+ }
237
+ if (scenario) {
238
+ result.labels.push({
239
+ name: LabelName.SUITE,
240
+ value: scenario.name
241
+ });
242
+ }
243
+ var pickleLabels = this.parsePickleTags(pickle.tags || []);
244
+ var featureLabels = this.parseTagsLabels((doc === null || doc === void 0 || (_doc$feature2 = doc.feature) === null || _doc$feature2 === void 0 ? void 0 : _doc$feature2.tags) || []);
245
+ var featureLinks = this.parseTagsLinks((doc === null || doc === void 0 || (_doc$feature3 = doc.feature) === null || _doc$feature3 === void 0 ? void 0 : _doc$feature3.tags) || []);
246
+ var scenarioLabels = this.parseTagsLabels((scenario === null || scenario === void 0 ? void 0 : scenario.tags) || []);
247
+ var scenarioLinks = this.parseTagsLinks((scenario === null || scenario === void 0 ? void 0 : scenario.tags) || []);
248
+ result.labels.push(...featureLabels, ...scenarioLabels, ...pickleLabels);
249
+ result.links.push(...featureLinks, ...scenarioLinks);
250
+ var testUuid = this.runtime.startTest(result);
251
+ this.testCaseStartedMap.set(data.id, data);
252
+ this.allureResultsUuids.set(data.id, testUuid);
253
+ if (!(scenario !== null && scenario !== void 0 && scenario.examples)) {
254
+ return;
255
+ }
256
+ scenario.examples.forEach(example => {
257
+ var _example$tableHeader;
258
+ var csvDataTableHeader = (example === null || example === void 0 || (_example$tableHeader = example.tableHeader) === null || _example$tableHeader === void 0 ? void 0 : _example$tableHeader.cells.map(cell => cell.value).join(",")) || "";
259
+ var csvDataTableBody = (example === null || example === void 0 ? void 0 : example.tableBody.map(row => row.cells.map(cell => cell.value).join(",")).join("\n")) || "";
260
+ if (!csvDataTableHeader && !csvDataTableBody) {
261
+ return;
262
+ }
263
+ var csvDataTable = "".concat(csvDataTableHeader, "\n").concat(csvDataTableBody, "\n");
264
+ this.runtime.writeAttachment("Examples", Buffer.from(csvDataTable, "utf-8"), {
265
+ contentType: ContentType.CSV,
266
+ fileExtension: ".csv"
267
+ }, testUuid);
268
+ });
269
+ }
270
+ onTestCaseFinished(data) {
271
+ var testUuid = this.allureResultsUuids.get(data.testCaseStartedId);
272
+ this.runtime.updateTest(result => {
273
+ result.status = result.steps.length > 0 ? getWorstStepResultStatus(result.steps) : Status.PASSED;
274
+ result.stage = Stage.FINISHED;
275
+ if (result.status === undefined) {
276
+ result.statusDetails = {
277
+ message: "The test doesn't have an implementation."
278
+ };
279
+ }
280
+ }, testUuid);
281
+ this.runtime.stopTest({
282
+ uuid: testUuid,
283
+ stop: Date.now()
284
+ });
285
+ this.runtime.writeTest(testUuid);
286
+ }
287
+ onTestStepStarted(data) {
288
+ var _stepPickle$argument;
289
+ var testUuid = this.allureResultsUuids.get(data.testCaseStartedId);
290
+ var step = this.testStepMap.get(data.testStepId);
291
+
292
+ // TODO: support hooks reporting
293
+ if (!step.pickleStepId) {
294
+ return;
295
+ }
296
+ var stepPickle = this.pickleStepMap.get(step.pickleStepId);
297
+ if (!stepPickle) {
298
+ return;
299
+ }
300
+ var stepKeyword = stepPickle.astNodeIds.map(astNodeId => this.stepMap.get(astNodeId)).map(stepAstNode => stepAstNode === null || stepAstNode === void 0 ? void 0 : stepAstNode.keyword).find(keyword => keyword !== undefined) || "";
301
+ var stepResult = _objectSpread(_objectSpread({}, createStepResult()), {}, {
302
+ name: "".concat(stepKeyword).concat(stepPickle.text),
303
+ start: data.timestamp.nanos
304
+ });
305
+ this.runtime.startStep(stepResult, testUuid);
306
+ if (!((_stepPickle$argument = stepPickle.argument) !== null && _stepPickle$argument !== void 0 && _stepPickle$argument.dataTable)) {
307
+ return;
308
+ }
309
+ var csvDataTable = stepPickle.argument.dataTable.rows.reduce((acc, row) => "".concat(acc + row.cells.map(cell => cell.value).join(","), "\n"), "");
310
+ this.runtime.writeAttachment("Data table", Buffer.from(csvDataTable, "utf-8"), {
311
+ contentType: ContentType.CSV,
312
+ fileExtension: ".csv"
313
+ }, testUuid);
314
+ }
315
+ onTestStepFinished(data) {
316
+ var testUuid = this.allureResultsUuids.get(data.testCaseStartedId);
317
+ var currentStep = this.runtime.getCurrentStep(testUuid);
318
+
319
+ // TODO: support hooks reporting
320
+ if (!currentStep) {
321
+ return;
322
+ }
323
+ this.runtime.updateStep(step => {
324
+ var status = this.parseStatus(data.testStepResult);
325
+ step.status = status;
326
+ step.stage = status !== Status.SKIPPED ? Stage.FINISHED : Stage.PENDING;
327
+ if (status === undefined) {
328
+ step.statusDetails = {
329
+ message: "The step doesn't have an implementation."
330
+ };
331
+ return;
332
+ }
333
+ if (data.testStepResult.exception) {
334
+ step.statusDetails = {
335
+ message: data.testStepResult.message,
336
+ trace: data.testStepResult.exception.stackTrace
337
+ };
338
+ }
339
+ }, testUuid);
340
+ this.runtime.stopStep({
341
+ uuid: testUuid,
342
+ stop: currentStep.start + data.timestamp.nanos
343
+ });
344
+ }
345
+ onHook(data) {
346
+ this.hookMap.set(data.id, data);
347
+ }
348
+ onAttachment(message) {
349
+ var _message$fileName;
350
+ if (!message.testCaseStartedId) {
351
+ return;
352
+ }
353
+ var testUuid = this.allureResultsUuids.get(message.testCaseStartedId);
354
+ if (message.mediaType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE) {
355
+ var parsedMessage = JSON.parse(message.body);
356
+ this.runtime.applyRuntimeMessages(Array.isArray(parsedMessage) ? parsedMessage : [parsedMessage], {
357
+ testUuid
358
+ });
359
+ return;
360
+ }
361
+ var encoding = message.contentEncoding === AttachmentContentEncoding.BASE64 ? "base64" : "utf-8";
362
+ this.runtime.applyRuntimeMessages([{
363
+ type: "attachment_content",
364
+ data: {
365
+ name: (_message$fileName = message.fileName) !== null && _message$fileName !== void 0 ? _message$fileName : "Attachment",
366
+ content: Buffer.from(message.body, encoding).toString("base64"),
367
+ encoding: "base64",
368
+ contentType: message.mediaType,
369
+ fileExtension: message.fileName ? extname(message.fileName) : undefined,
370
+ wrapInStep: true
371
+ }
372
+ }], {
373
+ testUuid
374
+ });
375
+ }
376
+ }
377
+ //# sourceMappingURL=reporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reporter.js","names":["Formatter","World","AttachmentContentEncoding","TestStepResultStatus","os","extname","process","ContentType","LabelName","Stage","Status","ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE","FileSystemWriter","MessageWriter","ReporterRuntime","createStepResult","getWorstStepResultStatus","md5","AllureCucumberWorld","ALLURE_THREAD_NAME","env","AllureCucumberReporter","constructor","options","_defineProperty","Map","_ref","parsedArgvOptions","resultsDir","testMode","links","labels","rest","_objectWithoutProperties","_excluded","runtime","_objectSpread","writer","linksConfigs","labelsConfigs","eventBroadcaster","on","parseEnvelope","bind","beforeHooks","supportCodeLibrary","beforeTestCaseHookDefinitions","afterHooks","afterTestCaseHookDefinitions","tagsIgnorePatterns","flatMap","_ref2","pattern","envelope","gherkinDocument","onGherkinDocument","pickle","onPickle","testCase","onTestCase","testCaseStarted","onTestCaseStarted","testCaseFinished","onTestCaseFinished","attachment","onAttachment","hook","onHook","testStepStarted","onTestStepStarted","testStepFinished","onTestStepFinished","parseTagsLabels","tags","length","forEach","matcher","matchedTags","filter","tag","some","test","name","matchedLabels","map","tagValue","replace","value","push","parsePickleTags","TAG","parseTagsLinks","tagKeyRe","matchedLinks","url","urlTemplate","type","parseStatus","stepResult","_stepResult$exception","containsAssertionError","exception","status","FAILED","BROKEN","PASSED","SKIPPED","PENDING","undefined","onRule","data","_data$children","children","c","scenario","onScenario","_data$feature","uri","documentMap","set","feature","rule","scenarioMap","id","steps","step","stepMap","pickleMap","ps","pickleStepMap","testCaseMap","testSteps","ts","testStepMap","_doc$feature","_doc$feature2","_doc$feature3","get","testCaseId","pickleId","doc","scenarioId","astNodeIds","fullName","concat","result","description","trim","start","Date","now","HOST","hostname","LANGUAGE","FRAMEWORK","THREAD","workerId","pid","toString","FEATURE","SUITE","pickleLabels","featureLabels","featureLinks","scenarioLabels","scenarioLinks","testUuid","startTest","testCaseStartedMap","allureResultsUuids","examples","example","_example$tableHeader","csvDataTableHeader","tableHeader","cells","cell","join","csvDataTableBody","tableBody","row","csvDataTable","writeAttachment","Buffer","from","contentType","CSV","fileExtension","testCaseStartedId","updateTest","stage","FINISHED","statusDetails","message","stopTest","uuid","stop","writeTest","_stepPickle$argument","testStepId","pickleStepId","stepPickle","stepKeyword","astNodeId","stepAstNode","keyword","find","text","timestamp","nanos","startStep","argument","dataTable","rows","reduce","acc","currentStep","getCurrentStep","updateStep","testStepResult","trace","stackTrace","stopStep","hookMap","_message$fileName","mediaType","parsedMessage","JSON","parse","body","applyRuntimeMessages","Array","isArray","encoding","contentEncoding","BASE64","fileName","content","wrapInStep"],"sources":["../../src/reporter.ts"],"sourcesContent":["import type { IFormatterOptions, TestCaseHookDefinition } from \"@cucumber/cucumber\";\nimport { Formatter, World } from \"@cucumber/cucumber\";\nimport type * as messages from \"@cucumber/messages\";\nimport { AttachmentContentEncoding, type PickleTag, type Tag, type TestStepResult } from \"@cucumber/messages\";\nimport { TestStepResultStatus } from \"@cucumber/messages\";\nimport os from \"node:os\";\nimport { extname } from \"node:path\";\nimport process from \"node:process\";\nimport { ContentType, LabelName, Stage, Status } from \"allure-js-commons\";\nimport type { Label, Link, TestResult } from \"allure-js-commons\";\nimport {\n ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE,\n FileSystemWriter,\n MessageWriter,\n ReporterRuntime,\n createStepResult,\n getWorstStepResultStatus,\n md5,\n} from \"allure-js-commons/sdk/reporter\";\nimport type { Config } from \"allure-js-commons/sdk/reporter\";\nimport { AllureCucumberWorld } from \"./legacy.js\";\nimport type { AllureCucumberReporterConfig, LabelConfig, LinkConfig } from \"./model.js\";\n\nconst { ALLURE_THREAD_NAME } = process.env;\n\nexport default class AllureCucumberReporter extends Formatter {\n private readonly afterHooks: TestCaseHookDefinition[];\n private readonly beforeHooks: TestCaseHookDefinition[];\n\n private linksConfigs: LinkConfig[] = [];\n private labelsConfigs: LabelConfig[] = [];\n private runtime: ReporterRuntime;\n\n private readonly documentMap: Map<string, messages.GherkinDocument> = new Map();\n private readonly scenarioMap: Map<string, messages.Scenario> = new Map();\n private readonly stepMap: Map<string, messages.Step> = new Map();\n private readonly testStepMap: Map<string, messages.TestStep> = new Map();\n private readonly pickleStepMap: Map<string, messages.PickleStep> = new Map();\n private readonly testCaseTestStepsResults: Map<string, messages.TestStepResult[]> = new Map();\n private readonly pickleMap: Map<string, messages.Pickle> = new Map();\n private readonly hookMap: Map<string, messages.Hook> = new Map();\n private readonly testCaseMap: Map<string, messages.TestCase> = new Map();\n private readonly testCaseStartedMap: Map<string, messages.TestCaseStarted> = new Map();\n\n private readonly allureResultsUuids: Map<string, string> = new Map();\n\n constructor(options: IFormatterOptions) {\n super(options);\n\n const {\n resultsDir = \"./allure-results\",\n testMode,\n links,\n labels,\n ...rest\n } = options.parsedArgvOptions as AllureCucumberReporterConfig;\n\n this.runtime = new ReporterRuntime({\n writer: testMode\n ? new MessageWriter()\n : new FileSystemWriter({\n resultsDir,\n }),\n links: links as Config[\"links\"] | undefined,\n ...rest,\n });\n this.linksConfigs = links || [];\n this.labelsConfigs = labels || [];\n\n options.eventBroadcaster.on(\"envelope\", this.parseEnvelope.bind(this));\n\n this.beforeHooks = options.supportCodeLibrary.beforeTestCaseHookDefinitions;\n this.afterHooks = options.supportCodeLibrary.afterTestCaseHookDefinitions;\n\n // set AllureCucumberWorld for single thread mode\n if (options.supportCodeLibrary.World === World) {\n // @ts-ignore\n // noinspection JSConstantReassignment\n options.supportCodeLibrary.World = AllureCucumberWorld;\n }\n }\n\n private get tagsIgnorePatterns(): RegExp[] {\n const { labelsConfigs, linksConfigs } = this;\n\n return [...labelsConfigs, ...linksConfigs].flatMap(({ pattern }) => pattern);\n }\n\n private parseEnvelope(envelope: messages.Envelope) {\n switch (true) {\n case !!envelope.gherkinDocument:\n this.onGherkinDocument(envelope.gherkinDocument);\n break;\n case !!envelope.pickle:\n this.onPickle(envelope.pickle);\n break;\n case !!envelope.testCase:\n this.onTestCase(envelope.testCase);\n break;\n case !!envelope.testCaseStarted:\n this.onTestCaseStarted(envelope.testCaseStarted);\n break;\n case !!envelope.testCaseFinished:\n this.onTestCaseFinished(envelope.testCaseFinished);\n break;\n case !!envelope.attachment:\n this.onAttachment(envelope.attachment);\n break;\n case !!envelope.hook:\n this.onHook(envelope.hook);\n break;\n case !!envelope.testStepStarted:\n this.onTestStepStarted(envelope.testStepStarted);\n break;\n case !!envelope.testStepFinished:\n this.onTestStepFinished(envelope.testStepFinished);\n break;\n }\n }\n\n private parseTagsLabels(tags: readonly Tag[]): Label[] {\n const labels: Label[] = [];\n\n if (this.labelsConfigs.length === 0) {\n return labels;\n }\n\n this.labelsConfigs.forEach((matcher) => {\n const matchedTags = tags.filter((tag) => matcher.pattern.some((pattern) => pattern.test(tag.name)));\n const matchedLabels = matchedTags.map((tag) => {\n const tagValue = tag.name.replace(/^@\\S+:/, \"\");\n\n return {\n name: matcher.name,\n value: tagValue,\n };\n });\n\n labels.push(...matchedLabels);\n });\n\n return labels;\n }\n\n private parsePickleTags(tags: readonly PickleTag[]): Label[] {\n return tags\n .filter((tag) => !this.tagsIgnorePatterns.some((pattern) => pattern.test(tag.name)))\n .map((tag) => ({\n name: LabelName.TAG,\n value: tag.name,\n }));\n }\n\n private parseTagsLinks(tags: readonly Tag[]): Link[] {\n const tagKeyRe = /^@\\S+=/;\n const links: Link[] = [];\n\n if (this.linksConfigs.length === 0) {\n return links;\n }\n\n this.linksConfigs.forEach((matcher) => {\n const matchedTags = tags.filter((tag) => matcher.pattern.some((pattern) => pattern.test(tag.name)));\n const matchedLinks = matchedTags.map((tag) => {\n const tagValue = tag.name.replace(tagKeyRe, \"\");\n\n return {\n url: matcher.urlTemplate.replace(/%s$/, tagValue) || tagValue,\n type: matcher.type,\n };\n });\n\n links.push(...matchedLinks);\n });\n\n return links;\n }\n\n private parseStatus(stepResult: TestStepResult): Status | undefined {\n const containsAssertionError = /assertion/i.test(stepResult?.exception?.type || \"\");\n\n switch (stepResult.status) {\n case TestStepResultStatus.FAILED:\n return containsAssertionError ? Status.FAILED : Status.BROKEN;\n case TestStepResultStatus.PASSED:\n return Status.PASSED;\n case TestStepResultStatus.SKIPPED:\n case TestStepResultStatus.PENDING:\n return Status.SKIPPED;\n default:\n return undefined;\n }\n }\n\n private onRule(data: messages.Rule): void {\n data.children?.forEach((c) => {\n if (c.scenario) {\n this.onScenario(c.scenario);\n }\n });\n }\n\n private onGherkinDocument(data: messages.GherkinDocument): void {\n if (data.uri) {\n this.documentMap.set(data.uri, data);\n }\n\n data.feature?.children?.forEach((c) => {\n if (c.rule) {\n this.onRule(c.rule);\n } else if (c.scenario) {\n this.onScenario(c.scenario);\n }\n });\n }\n\n private onScenario(data: messages.Scenario): void {\n this.scenarioMap.set(data.id, data);\n data.steps.forEach((step) => this.stepMap.set(step.id, step));\n }\n\n private onPickle(data: messages.Pickle): void {\n this.pickleMap.set(data.id, data);\n data.steps.forEach((ps) => this.pickleStepMap.set(ps.id, ps));\n }\n\n private onTestCase(data: messages.TestCase): void {\n this.testCaseMap.set(data.id, data);\n data.testSteps.forEach((ts) => this.testStepMap.set(ts.id, ts));\n }\n\n private onTestCaseStarted(data: messages.TestCaseStarted) {\n const testCase = this.testCaseMap.get(data.testCaseId)!;\n const pickle = this.pickleMap.get(testCase.pickleId)!;\n const doc = this.documentMap.get(pickle.uri)!;\n const [scenarioId] = pickle.astNodeIds;\n const scenario = this.scenarioMap.get(scenarioId);\n const fullName = `${pickle.uri}#${pickle.name}`;\n const result: Partial<TestResult> = {\n name: pickle.name,\n description: (scenario?.description || doc?.feature?.description || \"\").trim(),\n labels: [],\n links: [],\n testCaseId: md5(fullName),\n start: Date.now(),\n fullName,\n };\n\n result.labels!.push(\n {\n name: LabelName.HOST,\n value: os.hostname(),\n },\n {\n name: LabelName.LANGUAGE,\n value: \"javascript\",\n },\n {\n name: LabelName.FRAMEWORK,\n value: \"cucumberjs\",\n },\n {\n name: LabelName.THREAD,\n value: data.workerId || ALLURE_THREAD_NAME || process.pid.toString(),\n },\n );\n\n if (doc?.feature) {\n result.labels!.push({\n name: LabelName.FEATURE,\n value: doc.feature.name,\n });\n }\n\n if (scenario) {\n result.labels!.push({\n name: LabelName.SUITE,\n value: scenario.name,\n });\n }\n\n const pickleLabels = this.parsePickleTags(pickle.tags || []);\n const featureLabels = this.parseTagsLabels(doc?.feature?.tags || []);\n const featureLinks = this.parseTagsLinks(doc?.feature?.tags || []);\n const scenarioLabels = this.parseTagsLabels(scenario?.tags || []);\n const scenarioLinks = this.parseTagsLinks(scenario?.tags || []);\n\n result.labels!.push(...featureLabels, ...scenarioLabels, ...pickleLabels);\n result.links!.push(...featureLinks, ...scenarioLinks);\n\n const testUuid = this.runtime.startTest(result);\n\n this.testCaseStartedMap.set(data.id, data);\n this.allureResultsUuids.set(data.id, testUuid as string);\n\n if (!scenario?.examples) {\n return;\n }\n\n scenario.examples.forEach((example) => {\n const csvDataTableHeader = example?.tableHeader?.cells.map((cell) => cell.value).join(\",\") || \"\";\n const csvDataTableBody =\n example?.tableBody.map((row) => row.cells.map((cell) => cell.value).join(\",\")).join(\"\\n\") || \"\";\n\n if (!csvDataTableHeader && !csvDataTableBody) {\n return;\n }\n\n const csvDataTable = `${csvDataTableHeader}\\n${csvDataTableBody}\\n`;\n\n this.runtime.writeAttachment(\n \"Examples\",\n Buffer.from(csvDataTable, \"utf-8\"),\n { contentType: ContentType.CSV, fileExtension: \".csv\" },\n testUuid,\n );\n });\n }\n\n private onTestCaseFinished(data: messages.TestCaseFinished) {\n const testUuid = this.allureResultsUuids.get(data.testCaseStartedId)!;\n\n this.runtime.updateTest((result) => {\n result.status = result.steps.length > 0 ? getWorstStepResultStatus(result.steps) : Status.PASSED;\n result.stage = Stage.FINISHED;\n\n if (result.status === undefined) {\n result.statusDetails = {\n message: \"The test doesn't have an implementation.\",\n };\n }\n }, testUuid);\n this.runtime.stopTest({ uuid: testUuid, stop: Date.now() });\n this.runtime.writeTest(testUuid);\n }\n\n private onTestStepStarted(data: messages.TestStepStarted) {\n const testUuid = this.allureResultsUuids.get(data.testCaseStartedId)!;\n const step = this.testStepMap.get(data.testStepId)!;\n\n // TODO: support hooks reporting\n if (!step.pickleStepId) {\n return;\n }\n\n const stepPickle = this.pickleStepMap.get(step.pickleStepId)!;\n\n if (!stepPickle) {\n return;\n }\n\n const stepKeyword =\n stepPickle.astNodeIds\n .map((astNodeId) => this.stepMap.get(astNodeId))\n .map((stepAstNode) => stepAstNode?.keyword)\n .find((keyword) => keyword !== undefined) || \"\";\n const stepResult = {\n ...createStepResult(),\n name: `${stepKeyword}${stepPickle.text}`,\n start: data.timestamp.nanos,\n };\n\n this.runtime.startStep(stepResult, testUuid);\n\n if (!stepPickle.argument?.dataTable) {\n return;\n }\n\n const csvDataTable = stepPickle.argument.dataTable.rows.reduce(\n (acc, row) => `${acc + row.cells.map((cell) => cell.value).join(\",\")}\\n`,\n \"\",\n );\n\n this.runtime.writeAttachment(\n \"Data table\",\n Buffer.from(csvDataTable, \"utf-8\"),\n {\n contentType: ContentType.CSV,\n fileExtension: \".csv\",\n },\n testUuid,\n );\n }\n\n private onTestStepFinished(data: messages.TestStepFinished) {\n const testUuid = this.allureResultsUuids.get(data.testCaseStartedId)!;\n const currentStep = this.runtime.getCurrentStep(testUuid);\n\n // TODO: support hooks reporting\n if (!currentStep) {\n return;\n }\n\n this.runtime.updateStep((step) => {\n const status = this.parseStatus(data.testStepResult);\n\n step.status = status;\n step.stage = status !== Status.SKIPPED ? Stage.FINISHED : Stage.PENDING;\n\n if (status === undefined) {\n step.statusDetails = {\n message: \"The step doesn't have an implementation.\",\n };\n return;\n }\n\n if (data.testStepResult.exception) {\n step.statusDetails = {\n message: data.testStepResult.message,\n trace: data.testStepResult.exception.stackTrace,\n };\n }\n }, testUuid);\n\n this.runtime.stopStep({\n uuid: testUuid,\n stop: currentStep.start! + data.timestamp.nanos,\n });\n }\n\n private onHook(data: messages.Hook) {\n this.hookMap.set(data.id, data);\n }\n\n private onAttachment(message: messages.Attachment): void {\n if (!message.testCaseStartedId) {\n return;\n }\n\n const testUuid = this.allureResultsUuids.get(message.testCaseStartedId)!;\n\n if (message.mediaType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE) {\n const parsedMessage = JSON.parse(message.body);\n\n this.runtime.applyRuntimeMessages(Array.isArray(parsedMessage) ? parsedMessage : [parsedMessage], {\n testUuid,\n });\n return;\n }\n\n const encoding: BufferEncoding = message.contentEncoding === AttachmentContentEncoding.BASE64 ? \"base64\" : \"utf-8\";\n\n this.runtime.applyRuntimeMessages(\n [\n {\n type: \"attachment_content\",\n data: {\n name: message.fileName ?? \"Attachment\",\n content: Buffer.from(message.body, encoding).toString(\"base64\"),\n encoding: \"base64\",\n contentType: message.mediaType,\n fileExtension: message.fileName ? extname(message.fileName) : undefined,\n wrapInStep: true,\n },\n },\n ],\n { testUuid },\n );\n }\n}\n"],"mappings":";;;;;;;;AACA,SAASA,SAAS,EAAEC,KAAK,QAAQ,oBAAoB;AAErD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mE,QAAwB,GAAGxC,OAAO,CAACyC,eAAe,KAAKxO,yBAAyB,CAACyO,MAAM,GAAG,QAAQ,GAAG,OAAO;IAElH,IAAI,CAACxM,OAAO,CAACmM,oBAAoB,CAC/B,CACE;MACEtI,IAAI,EAAE,oBAAoB;MAC1Bc,IAAI,EAAE;QACJ5B,IAAI,GAAA8I,iBAAA,GAAE/B,OAAO,CAAC2C,QAAQ,cAAAZ,iBAAA,cAAAA,iBAAA,GAAI,YAAY;QACtCa,OAAO,EAAEtD,MAAM,CAACC,IAAI,CAACS,OAAO,CAACoC,IAAI,EAAEI,QAAQ,CAAC,CAAC3E,QAAQ,CAAC,QAAQ,CAAC;QAC/D2E,QAAQ,EAAE,QAAQ;QAClBhD,WAAW,EAAEQ,OAAO,CAACgC,SAAS;QAC9BtC,aAAa,EAAEM,OAAO,CAAC2C,QAAQ,GAAGvO,OAAO,CAAC4L,OAAO,CAAC2C,QAAQ,CAAC,GAAGhI,SAAS;QACvEkI,UAAU,EAAE;MACd;IACF,CAAC,CACF,EACD;MAAExE;IAAS,CACb,CAAC;EACH;AACF","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
2
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE } from "allure-js-commons/sdk/reporter";
7
+ import { MessageTestRuntime } from "allure-js-commons/sdk/runtime";
8
+ export class AllureCucumberTestRuntime extends MessageTestRuntime {
9
+ constructor(_ref) {
10
+ var {
11
+ attach,
12
+ log,
13
+ parameters
14
+ } = _ref;
15
+ super();
16
+ _defineProperty(this, "attach", void 0);
17
+ _defineProperty(this, "log", void 0);
18
+ _defineProperty(this, "parameters", void 0);
19
+ this.attach = attach;
20
+ this.log = log;
21
+ this.parameters = parameters;
22
+ }
23
+ sendMessage(message) {
24
+ var _this = this;
25
+ return _asyncToGenerator(function* () {
26
+ _this.attach(JSON.stringify(message), ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE);
27
+ yield Promise.resolve();
28
+ })();
29
+ }
30
+ }
31
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","names":["ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE","MessageTestRuntime","AllureCucumberTestRuntime","constructor","_ref","attach","log","parameters","_defineProperty","sendMessage","message","_this","_asyncToGenerator","JSON","stringify","Promise","resolve"],"sources":["../../src/runtime.ts"],"sourcesContent":["import type { IWorld, IWorldOptions } from \"@cucumber/cucumber\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\nimport { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE } from \"allure-js-commons/sdk/reporter\";\nimport { MessageTestRuntime } from \"allure-js-commons/sdk/runtime\";\n\nexport class AllureCucumberTestRuntime extends MessageTestRuntime implements IWorld {\n public readonly attach: IWorldOptions[\"attach\"];\n public readonly log: IWorldOptions[\"log\"];\n public readonly parameters: IWorldOptions[\"parameters\"];\n\n constructor({ attach, log, parameters }: IWorldOptions) {\n super();\n this.attach = attach;\n this.log = log;\n this.parameters = parameters;\n }\n\n async sendMessage(message: RuntimeMessage) {\n this.attach(JSON.stringify(message), ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE as string);\n await Promise.resolve();\n }\n}\n"],"mappings":";;;;;AAEA,SAASA,mCAAmC,QAAQ,gCAAgC;AACpF,SAASC,kBAAkB,QAAQ,+BAA+B;AAElE,OAAO,MAAMC,yBAAyB,SAASD,kBAAkB,CAAmB;EAKlFE,WAAWA,CAAAC,IAAA,EAA6C;IAAA,IAA5C;MAAEC,MAAM;MAAEC,GAAG;MAAEC;IAA0B,CAAC,GAAAH,IAAA;IACpD,KAAK,CAAC,CAAC;IAACI,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACR,IAAI,CAACH,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,GAAG,GAAGA,GAAG;IACd,IAAI,CAACC,UAAU,GAAGA,UAAU;EAC9B;EAEME,WAAWA,CAACC,OAAuB,EAAE;IAAA,IAAAC,KAAA;IAAA,OAAAC,iBAAA;MACzCD,KAAI,CAACN,MAAM,CAACQ,IAAI,CAACC,SAAS,CAACJ,OAAO,CAAC,EAAEV,mCAA6C,CAAC;MACnF,MAAMe,OAAO,CAACC,OAAO,CAAC,CAAC;IAAC;EAC1B;AACF","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import { AllureCucumberWorld } from "./legacy.js";
2
+ import { AllureCucumberTestRuntime } from "./runtime.js";
3
+ export { AllureCucumberTestRuntime, AllureCucumberWorld };