allure-cucumberjs 3.0.0-beta.3 → 3.0.0-beta.4
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/dist/cjs/index.js +22 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/reporter.js +113 -72
- package/dist/cjs/reporter.js.map +1 -1
- package/dist/cjs/runtime.js +2 -19
- package/dist/cjs/runtime.js.map +1 -1
- package/dist/esm/index.js +24 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/reporter.js +115 -75
- package/dist/esm/reporter.js.map +1 -1
- package/dist/esm/runtime.js +2 -19
- package/dist/esm/runtime.js.map +1 -1
- package/dist/types/legacy.d.ts +1 -1
- package/dist/types/model.d.ts +5 -8
- package/dist/types/reporter.d.ts +4 -1
- package/dist/types/runtime.d.ts +1 -6
- package/package.json +16 -10
package/dist/cjs/runtime.js
CHANGED
|
@@ -4,32 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AllureCucumberTestRuntime = void 0;
|
|
7
|
+
var _cucumber = require("@cucumber/cucumber");
|
|
7
8
|
var _reporter = require("allure-js-commons/sdk/reporter");
|
|
8
9
|
var _runtime = require("allure-js-commons/sdk/runtime");
|
|
9
10
|
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); }
|
|
10
11
|
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); }); }; }
|
|
11
|
-
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; }
|
|
12
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
13
|
-
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); }
|
|
14
12
|
class AllureCucumberTestRuntime extends _runtime.MessageTestRuntime {
|
|
15
|
-
constructor(_ref) {
|
|
16
|
-
var {
|
|
17
|
-
attach,
|
|
18
|
-
log,
|
|
19
|
-
parameters
|
|
20
|
-
} = _ref;
|
|
21
|
-
super();
|
|
22
|
-
_defineProperty(this, "attach", void 0);
|
|
23
|
-
_defineProperty(this, "log", void 0);
|
|
24
|
-
_defineProperty(this, "parameters", void 0);
|
|
25
|
-
this.attach = attach;
|
|
26
|
-
this.log = log;
|
|
27
|
-
this.parameters = parameters;
|
|
28
|
-
}
|
|
29
13
|
sendMessage(message) {
|
|
30
|
-
var _this = this;
|
|
31
14
|
return _asyncToGenerator(function* () {
|
|
32
|
-
|
|
15
|
+
_cucumber.world.attach(JSON.stringify(message), _reporter.ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE);
|
|
33
16
|
yield Promise.resolve();
|
|
34
17
|
})();
|
|
35
18
|
}
|
package/dist/cjs/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","names":["
|
|
1
|
+
{"version":3,"file":"runtime.js","names":["_cucumber","require","_reporter","_runtime","asyncGeneratorStep","n","t","e","r","o","a","c","i","u","value","done","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","AllureCucumberTestRuntime","MessageTestRuntime","sendMessage","message","world","attach","JSON","stringify","ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE","exports"],"sources":["../../src/runtime.ts"],"sourcesContent":["import { world } 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 {\n async sendMessage(message: RuntimeMessage) {\n world.attach(JSON.stringify(message), ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE as string);\n await Promise.resolve();\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAAmE,SAAAG,mBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,cAAAC,CAAA,GAAAP,CAAA,CAAAK,CAAA,EAAAC,CAAA,GAAAE,CAAA,GAAAD,CAAA,CAAAE,KAAA,WAAAT,CAAA,gBAAAE,CAAA,CAAAF,CAAA,KAAAO,CAAA,CAAAG,IAAA,GAAAT,CAAA,CAAAO,CAAA,IAAAG,OAAA,CAAAC,OAAA,CAAAJ,CAAA,EAAAK,IAAA,CAAAV,CAAA,EAAAC,CAAA;AAAA,SAAAU,kBAAAd,CAAA,6BAAAC,CAAA,SAAAC,CAAA,GAAAa,SAAA,aAAAJ,OAAA,WAAAR,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAL,CAAA,CAAAgB,KAAA,CAAAf,CAAA,EAAAC,CAAA,YAAAe,MAAAjB,CAAA,IAAAD,kBAAA,CAAAM,CAAA,EAAAF,CAAA,EAAAC,CAAA,EAAAa,KAAA,EAAAC,MAAA,UAAAlB,CAAA,cAAAkB,OAAAlB,CAAA,IAAAD,kBAAA,CAAAM,CAAA,EAAAF,CAAA,EAAAC,CAAA,EAAAa,KAAA,EAAAC,MAAA,WAAAlB,CAAA,KAAAiB,KAAA;AAE5D,MAAME,yBAAyB,SAASC,2BAAkB,CAAC;EAC1DC,WAAWA,CAACC,OAAuB,EAAE;IAAA,OAAAR,iBAAA;MACzCS,eAAK,CAACC,MAAM,CAACC,IAAI,CAACC,SAAS,CAACJ,OAAO,CAAC,EAAEK,6CAA6C,CAAC;MACpF,MAAMhB,OAAO,CAACC,OAAO,CAAC,CAAC;IAAC;EAC1B;AACF;AAACgB,OAAA,CAAAT,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
import { Before } from "@cucumber/cucumber";
|
|
1
|
+
import { Before, BeforeAll, world } from "@cucumber/cucumber";
|
|
2
|
+
import { includedInTestPlan } from "allure-js-commons/sdk/reporter";
|
|
3
|
+
import { parseTestPlan } from "allure-js-commons/sdk/reporter";
|
|
2
4
|
import { setGlobalTestRuntime } from "allure-js-commons/sdk/runtime";
|
|
3
5
|
import { AllureCucumberWorld } from "./legacy.js";
|
|
4
|
-
import { ALLURE_SETUP_REPORTER_HOOK } from "./model.js";
|
|
5
6
|
import { AllureCucumberTestRuntime } from "./runtime.js";
|
|
7
|
+
BeforeAll(() => {
|
|
8
|
+
setGlobalTestRuntime(new AllureCucumberTestRuntime());
|
|
9
|
+
});
|
|
6
10
|
Before({
|
|
7
|
-
name:
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
name: "ALLURE_FIXTURE_IGNORE"
|
|
12
|
+
}, scenario => {
|
|
13
|
+
var testPlan = parseTestPlan();
|
|
14
|
+
if (!testPlan) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
var pickle = scenario.pickle;
|
|
18
|
+
var fullName = "".concat(pickle.uri, "#").concat(pickle.name);
|
|
19
|
+
var tags = pickle.tags.map(tag => tag.name);
|
|
20
|
+
if (!includedInTestPlan(testPlan, {
|
|
21
|
+
fullName,
|
|
22
|
+
tags
|
|
23
|
+
})) {
|
|
24
|
+
// we can't use regular message or Allure facade since we need label to be added
|
|
25
|
+
// to test, not fixture
|
|
26
|
+
world.attach(Buffer.from("allure-skip"), "application/vnd.allure.skipcucumber+json");
|
|
27
|
+
return "skipped";
|
|
28
|
+
}
|
|
17
29
|
});
|
|
18
30
|
export { AllureCucumberTestRuntime, AllureCucumberWorld };
|
|
19
31
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Before","
|
|
1
|
+
{"version":3,"file":"index.js","names":["Before","BeforeAll","world","includedInTestPlan","parseTestPlan","setGlobalTestRuntime","AllureCucumberWorld","AllureCucumberTestRuntime","name","scenario","testPlan","pickle","fullName","concat","uri","tags","map","tag","attach","Buffer","from"],"sources":["../../src/index.ts"],"sourcesContent":["import { Before, BeforeAll, world } from \"@cucumber/cucumber\";\nimport { includedInTestPlan } from \"allure-js-commons/sdk/reporter\";\nimport { parseTestPlan } from \"allure-js-commons/sdk/reporter\";\nimport { setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport { AllureCucumberWorld } from \"./legacy.js\";\nimport { AllureCucumberTestRuntime } from \"./runtime.js\";\n\nBeforeAll(() => {\n setGlobalTestRuntime(new AllureCucumberTestRuntime());\n});\n\nBefore({ name: \"ALLURE_FIXTURE_IGNORE\" }, (scenario) => {\n const testPlan = parseTestPlan();\n if (!testPlan) {\n return;\n }\n const pickle = scenario.pickle;\n const fullName = `${pickle.uri}#${pickle.name}`;\n const tags = pickle.tags.map((tag) => tag.name);\n\n if (!includedInTestPlan(testPlan, { fullName, tags })) {\n // we can't use regular message or Allure facade since we need label to be added\n // to test, not fixture\n world.attach(Buffer.from(\"allure-skip\"), \"application/vnd.allure.skipcucumber+json\");\n return \"skipped\";\n }\n});\n\nexport { AllureCucumberTestRuntime, AllureCucumberWorld };\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,SAAS,EAAEC,KAAK,QAAQ,oBAAoB;AAC7D,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,aAAa,QAAQ,gCAAgC;AAC9D,SAASC,oBAAoB,QAAQ,+BAA+B;AACpE,SAASC,mBAAmB,QAAQ,aAAa;AACjD,SAASC,yBAAyB,QAAQ,cAAc;AAExDN,SAAS,CAAC,MAAM;EACdI,oBAAoB,CAAC,IAAIE,yBAAyB,CAAC,CAAC,CAAC;AACvD,CAAC,CAAC;AAEFP,MAAM,CAAC;EAAEQ,IAAI,EAAE;AAAwB,CAAC,EAAGC,QAAQ,IAAK;EACtD,IAAMC,QAAQ,GAAGN,aAAa,CAAC,CAAC;EAChC,IAAI,CAACM,QAAQ,EAAE;IACb;EACF;EACA,IAAMC,MAAM,GAAGF,QAAQ,CAACE,MAAM;EAC9B,IAAMC,QAAQ,MAAAC,MAAA,CAAMF,MAAM,CAACG,GAAG,OAAAD,MAAA,CAAIF,MAAM,CAACH,IAAI,CAAE;EAC/C,IAAMO,IAAI,GAAGJ,MAAM,CAACI,IAAI,CAACC,GAAG,CAAEC,GAAG,IAAKA,GAAG,CAACT,IAAI,CAAC;EAE/C,IAAI,CAACL,kBAAkB,CAACO,QAAQ,EAAE;IAAEE,QAAQ;IAAEG;EAAK,CAAC,CAAC,EAAE;IACrD;IACA;IACAb,KAAK,CAACgB,MAAM,CAACC,MAAM,CAACC,IAAI,CAAC,aAAa,CAAC,EAAE,0CAA0C,CAAC;IACpF,OAAO,SAAS;EAClB;AACF,CAAC,CAAC;AAEF,SAASb,yBAAyB,EAAED,mBAAmB","ignoreList":[]}
|
package/dist/esm/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","names":["ALLURE_SETUP_REPORTER_HOOK"],"sources":["../../src/model.ts"],"sourcesContent":["import type { LabelName
|
|
1
|
+
{"version":3,"file":"model.js","names":["ALLURE_SETUP_REPORTER_HOOK"],"sources":["../../src/model.ts"],"sourcesContent":["import type { LabelName } from \"allure-js-commons\";\nimport type { Config, LinkConfig, LinkTypeOptions } from \"allure-js-commons/sdk/reporter\";\n\nexport const ALLURE_SETUP_REPORTER_HOOK = \"__allure_reporter_setup_hook__\";\n\nexport type LabelConfig = {\n pattern: RegExp[];\n name: LabelName | string;\n};\n\nexport type AllureCucumberLinkConfig = LinkConfig<LinkTypeOptions & { pattern: RegExp[] }>;\n\nexport interface AllureCucumberReporterConfig extends Omit<Config, \"writer\" | \"links\"> {\n links?: AllureCucumberLinkConfig;\n labels?: LabelConfig[];\n}\n"],"mappings":"AAGA,OAAO,IAAMA,0BAA0B,GAAG,gCAAgC","ignoreList":[]}
|
package/dist/esm/reporter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["resultsDir", "
|
|
1
|
+
var _excluded = ["resultsDir", "links", "labels"];
|
|
2
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
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
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; }
|
|
@@ -7,24 +7,24 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
7
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
8
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
9
|
import { Formatter, World } from "@cucumber/cucumber";
|
|
10
|
-
import { AttachmentContentEncoding } from "@cucumber/messages";
|
|
11
|
-
import { TestStepResultStatus } from "@cucumber/messages";
|
|
10
|
+
import { AttachmentContentEncoding, TestStepResultStatus } from "@cucumber/messages";
|
|
12
11
|
import os from "node:os";
|
|
13
12
|
import { extname } from "node:path";
|
|
14
13
|
import process from "node:process";
|
|
15
14
|
import { ContentType, LabelName, Stage, Status } from "allure-js-commons";
|
|
16
|
-
import {
|
|
15
|
+
import { getMessageAndTraceFromError } from "allure-js-commons/sdk";
|
|
16
|
+
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, FileSystemWriter, MessageWriter, ReporterRuntime, applyLinkTemplate, createStepResult, getWorstStepResultStatus, md5 } from "allure-js-commons/sdk/reporter";
|
|
17
17
|
import { AllureCucumberWorld } from "./legacy.js";
|
|
18
|
-
import { ALLURE_SETUP_REPORTER_HOOK } from "./model.js";
|
|
19
18
|
var {
|
|
20
|
-
ALLURE_THREAD_NAME
|
|
19
|
+
ALLURE_THREAD_NAME,
|
|
20
|
+
ALLURE_TEST_MODE
|
|
21
21
|
} = process.env;
|
|
22
22
|
export default class AllureCucumberReporter extends Formatter {
|
|
23
23
|
constructor(options) {
|
|
24
24
|
super(options);
|
|
25
25
|
_defineProperty(this, "afterHooks", {});
|
|
26
26
|
_defineProperty(this, "beforeHooks", {});
|
|
27
|
-
_defineProperty(this, "linksConfigs",
|
|
27
|
+
_defineProperty(this, "linksConfigs", {});
|
|
28
28
|
_defineProperty(this, "labelsConfigs", []);
|
|
29
29
|
_defineProperty(this, "allureRuntime", void 0);
|
|
30
30
|
_defineProperty(this, "documentMap", new Map());
|
|
@@ -35,22 +35,23 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
35
35
|
_defineProperty(this, "pickleMap", new Map());
|
|
36
36
|
_defineProperty(this, "testCaseMap", new Map());
|
|
37
37
|
_defineProperty(this, "testCaseStartedMap", new Map());
|
|
38
|
-
_defineProperty(this, "
|
|
38
|
+
_defineProperty(this, "testResultUuids", new Map());
|
|
39
|
+
_defineProperty(this, "scopeUuids", new Map());
|
|
40
|
+
_defineProperty(this, "fixtureUuids", new Map());
|
|
39
41
|
var _ref = options.parsedArgvOptions,
|
|
40
42
|
{
|
|
41
43
|
resultsDir = "./allure-results",
|
|
42
|
-
testMode,
|
|
43
44
|
links,
|
|
44
45
|
labels
|
|
45
46
|
} = _ref,
|
|
46
47
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
48
|
this.allureRuntime = new ReporterRuntime(_objectSpread({
|
|
48
|
-
writer:
|
|
49
|
+
writer: ALLURE_TEST_MODE ? new MessageWriter() : new FileSystemWriter({
|
|
49
50
|
resultsDir
|
|
50
51
|
}),
|
|
51
|
-
links
|
|
52
|
+
links
|
|
52
53
|
}, rest));
|
|
53
|
-
this.linksConfigs = links ||
|
|
54
|
+
this.linksConfigs = links || {};
|
|
54
55
|
this.labelsConfigs = labels || [];
|
|
55
56
|
options.eventBroadcaster.on("envelope", this.parseEnvelope.bind(this));
|
|
56
57
|
this.beforeHooks = options.supportCodeLibrary.beforeTestCaseHookDefinitions.reduce((acc, hook) => Object.assign(acc, {
|
|
@@ -71,10 +72,14 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
71
72
|
labelsConfigs,
|
|
72
73
|
linksConfigs
|
|
73
74
|
} = this;
|
|
74
|
-
|
|
75
|
+
var linkConfigEntries = Object.entries(linksConfigs).map(_ref2 => {
|
|
76
|
+
var [, v] = _ref2;
|
|
77
|
+
return v;
|
|
78
|
+
});
|
|
79
|
+
return [...labelsConfigs, ...linkConfigEntries].flatMap(_ref3 => {
|
|
75
80
|
var {
|
|
76
81
|
pattern
|
|
77
|
-
} =
|
|
82
|
+
} = _ref3;
|
|
78
83
|
return pattern;
|
|
79
84
|
});
|
|
80
85
|
}
|
|
@@ -104,6 +109,9 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
104
109
|
case !!envelope.testStepFinished:
|
|
105
110
|
this.onTestStepFinished(envelope.testStepFinished);
|
|
106
111
|
break;
|
|
112
|
+
case !!envelope.testRunFinished:
|
|
113
|
+
this.onTestRunFinished();
|
|
114
|
+
break;
|
|
107
115
|
}
|
|
108
116
|
}
|
|
109
117
|
parseTagsLabels(tags) {
|
|
@@ -133,16 +141,17 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
133
141
|
parseTagsLinks(tags) {
|
|
134
142
|
var tagKeyRe = /^@\S+=/;
|
|
135
143
|
var links = [];
|
|
136
|
-
if (this.linksConfigs.length === 0) {
|
|
144
|
+
if (Object.keys(this.linksConfigs).length === 0) {
|
|
137
145
|
return links;
|
|
138
146
|
}
|
|
139
|
-
this.linksConfigs.forEach(
|
|
147
|
+
Object.entries(this.linksConfigs).forEach(_ref4 => {
|
|
148
|
+
var [type, matcher] = _ref4;
|
|
140
149
|
var matchedTags = tags.filter(tag => matcher.pattern.some(pattern => pattern.test(tag.name)));
|
|
141
150
|
var matchedLinks = matchedTags.map(tag => {
|
|
142
151
|
var tagValue = tag.name.replace(tagKeyRe, "");
|
|
143
152
|
return {
|
|
144
|
-
url: matcher.urlTemplate
|
|
145
|
-
type
|
|
153
|
+
url: applyLinkTemplate(matcher.urlTemplate, tagValue) || tagValue,
|
|
154
|
+
type
|
|
146
155
|
};
|
|
147
156
|
});
|
|
148
157
|
links.push(...matchedLinks);
|
|
@@ -246,10 +255,11 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
246
255
|
var scenarioLinks = this.parseTagsLinks((scenario === null || scenario === void 0 ? void 0 : scenario.tags) || []);
|
|
247
256
|
result.labels.push(...featureLabels, ...scenarioLabels, ...pickleLabels);
|
|
248
257
|
result.links.push(...featureLinks, ...scenarioLinks);
|
|
249
|
-
var
|
|
258
|
+
var scopeUuid = this.allureRuntime.startScope();
|
|
259
|
+
this.scopeUuids.set(data.id, scopeUuid);
|
|
260
|
+
var testUuid = this.allureRuntime.startTest(result, [scopeUuid]);
|
|
261
|
+
this.testResultUuids.set(data.id, testUuid);
|
|
250
262
|
this.testCaseStartedMap.set(data.id, data);
|
|
251
|
-
this.allureResultsUuids.set(data.id, testUuid);
|
|
252
|
-
this.allureRuntime.startScope();
|
|
253
263
|
if (!(scenario !== null && scenario !== void 0 && scenario.examples)) {
|
|
254
264
|
return;
|
|
255
265
|
}
|
|
@@ -261,15 +271,18 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
261
271
|
return;
|
|
262
272
|
}
|
|
263
273
|
var csvDataTable = "".concat(csvDataTableHeader, "\n").concat(csvDataTableBody, "\n");
|
|
264
|
-
this.allureRuntime.writeAttachment("Examples", Buffer.from(csvDataTable, "utf-8"), {
|
|
274
|
+
this.allureRuntime.writeAttachment(testUuid, null, "Examples", Buffer.from(csvDataTable, "utf-8"), {
|
|
265
275
|
contentType: ContentType.CSV,
|
|
266
276
|
fileExtension: ".csv"
|
|
267
|
-
}
|
|
277
|
+
});
|
|
268
278
|
});
|
|
269
279
|
}
|
|
270
280
|
onTestCaseFinished(data) {
|
|
271
|
-
var testUuid = this.
|
|
272
|
-
|
|
281
|
+
var testUuid = this.testResultUuids.get(data.testCaseStartedId);
|
|
282
|
+
if (!testUuid) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
this.allureRuntime.updateTest(testUuid, result => {
|
|
273
286
|
result.status = result.steps.length > 0 ? getWorstStepResultStatus(result.steps) : Status.PASSED;
|
|
274
287
|
result.stage = Stage.FINISHED;
|
|
275
288
|
if (result.status === undefined) {
|
|
@@ -277,35 +290,42 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
277
290
|
message: "The test doesn't have an implementation."
|
|
278
291
|
};
|
|
279
292
|
}
|
|
280
|
-
}, testUuid);
|
|
281
|
-
this.allureRuntime.stopTest({
|
|
282
|
-
uuid: testUuid,
|
|
283
|
-
stop: Date.now()
|
|
284
293
|
});
|
|
294
|
+
this.allureRuntime.stopTest(testUuid);
|
|
285
295
|
this.allureRuntime.writeTest(testUuid);
|
|
286
|
-
this.
|
|
296
|
+
this.testResultUuids.delete(data.testCaseStartedId);
|
|
297
|
+
var scopeUuid = this.scopeUuids.get(data.testCaseStartedId);
|
|
298
|
+
if (scopeUuid) {
|
|
299
|
+
this.allureRuntime.writeScope(scopeUuid);
|
|
300
|
+
this.scopeUuids.delete(data.testCaseStartedId);
|
|
301
|
+
}
|
|
287
302
|
}
|
|
288
303
|
onTestStepStarted(data) {
|
|
289
304
|
var _stepPickle$argument;
|
|
290
|
-
var testUuid = this.
|
|
305
|
+
var testUuid = this.testResultUuids.get(data.testCaseStartedId);
|
|
291
306
|
var step = this.testStepMap.get(data.testStepId);
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
this.
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
+
if (step.hookId) {
|
|
308
|
+
var scopeUuid = this.scopeUuids.get(data.testCaseStartedId);
|
|
309
|
+
if (!scopeUuid) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
var beforeHook = step.hookId && this.beforeHooks[step.hookId];
|
|
313
|
+
var afterHook = step.hookId && this.afterHooks[step.hookId];
|
|
314
|
+
var type = beforeHook ? "before" : afterHook ? "after" : undefined;
|
|
315
|
+
if (!type) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
var name = beforeHook ? beforeHook.name : afterHook ? afterHook.name : "hook";
|
|
319
|
+
if (name === "ALLURE_FIXTURE_IGNORE") {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
var fixtureUuid = this.allureRuntime.startFixture(scopeUuid, type, {
|
|
323
|
+
name,
|
|
307
324
|
stage: Stage.RUNNING
|
|
308
325
|
});
|
|
326
|
+
if (fixtureUuid) {
|
|
327
|
+
this.fixtureUuids.set(data.testCaseStartedId, fixtureUuid);
|
|
328
|
+
}
|
|
309
329
|
return;
|
|
310
330
|
}
|
|
311
331
|
if (!step.pickleStepId) {
|
|
@@ -316,49 +336,52 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
316
336
|
return;
|
|
317
337
|
}
|
|
318
338
|
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) || "";
|
|
319
|
-
var
|
|
339
|
+
var stepUuid = this.allureRuntime.startStep(testUuid, undefined, _objectSpread(_objectSpread({}, createStepResult()), {}, {
|
|
320
340
|
name: "".concat(stepKeyword).concat(stepPickle.text),
|
|
321
341
|
start: data.timestamp.nanos
|
|
322
|
-
});
|
|
323
|
-
this.allureRuntime.startStep(stepResult, testUuid);
|
|
342
|
+
}));
|
|
324
343
|
if (!((_stepPickle$argument = stepPickle.argument) !== null && _stepPickle$argument !== void 0 && _stepPickle$argument.dataTable)) {
|
|
325
344
|
return;
|
|
326
345
|
}
|
|
327
346
|
var csvDataTable = stepPickle.argument.dataTable.rows.reduce((acc, row) => "".concat(acc + row.cells.map(cell => cell.value).join(","), "\n"), "");
|
|
328
|
-
this.allureRuntime.writeAttachment("Data table", Buffer.from(csvDataTable, "utf-8"), {
|
|
347
|
+
this.allureRuntime.writeAttachment(testUuid, stepUuid, "Data table", Buffer.from(csvDataTable, "utf-8"), {
|
|
329
348
|
contentType: ContentType.CSV,
|
|
330
349
|
fileExtension: ".csv"
|
|
331
|
-
}
|
|
350
|
+
});
|
|
332
351
|
}
|
|
333
352
|
onTestStepFinished(data) {
|
|
334
353
|
var step = this.testStepMap.get(data.testStepId);
|
|
335
|
-
|
|
336
|
-
var afterHook = step.hookId && this.afterHooks[step.hookId];
|
|
337
|
-
if (beforeHook && beforeHook.name === ALLURE_SETUP_REPORTER_HOOK) {
|
|
354
|
+
if (!step) {
|
|
338
355
|
return;
|
|
339
356
|
}
|
|
340
357
|
var status = this.parseStatus(data.testStepResult);
|
|
341
358
|
var stage = status !== Status.SKIPPED ? Stage.FINISHED : Stage.PENDING;
|
|
342
|
-
if (
|
|
343
|
-
this.
|
|
359
|
+
if (step.hookId) {
|
|
360
|
+
var fixtureUuid = this.fixtureUuids.get(data.testCaseStartedId);
|
|
361
|
+
if (!fixtureUuid) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
this.allureRuntime.updateFixture(fixtureUuid, r => {
|
|
344
365
|
r.stage = stage;
|
|
345
366
|
r.status = status;
|
|
346
367
|
if (data.testStepResult.exception) {
|
|
347
|
-
r.statusDetails = {
|
|
368
|
+
r.statusDetails = getMessageAndTraceFromError({
|
|
348
369
|
message: data.testStepResult.message,
|
|
349
|
-
|
|
350
|
-
};
|
|
370
|
+
stack: data.testStepResult.exception.stackTrace
|
|
371
|
+
});
|
|
351
372
|
}
|
|
352
373
|
});
|
|
353
|
-
|
|
374
|
+
// TODO stop from duration? use data.timestamp.nanos?
|
|
375
|
+
this.allureRuntime.stopFixture(fixtureUuid);
|
|
376
|
+
this.fixtureUuids.delete(data.testCaseStartedId);
|
|
354
377
|
return;
|
|
355
378
|
}
|
|
356
|
-
var testUuid = this.
|
|
357
|
-
var currentStep = this.allureRuntime.
|
|
379
|
+
var testUuid = this.testResultUuids.get(data.testCaseStartedId);
|
|
380
|
+
var currentStep = this.allureRuntime.currentStep(testUuid);
|
|
358
381
|
if (!currentStep) {
|
|
359
382
|
return;
|
|
360
383
|
}
|
|
361
|
-
this.allureRuntime.updateStep(r => {
|
|
384
|
+
this.allureRuntime.updateStep(currentStep, r => {
|
|
362
385
|
r.status = status;
|
|
363
386
|
r.stage = stage;
|
|
364
387
|
if (status === undefined) {
|
|
@@ -373,27 +396,42 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
373
396
|
trace: data.testStepResult.exception.stackTrace
|
|
374
397
|
};
|
|
375
398
|
}
|
|
376
|
-
}, testUuid);
|
|
377
|
-
this.allureRuntime.stopStep({
|
|
378
|
-
uuid: testUuid,
|
|
379
|
-
stop: currentStep.start + data.timestamp.nanos
|
|
380
399
|
});
|
|
400
|
+
|
|
401
|
+
// TODO stop from duration? use data.timestamp.nanos?
|
|
402
|
+
this.allureRuntime.stopStep(currentStep);
|
|
381
403
|
}
|
|
382
404
|
onAttachment(message) {
|
|
383
405
|
var _message$fileName;
|
|
384
406
|
if (!message.testCaseStartedId) {
|
|
385
407
|
return;
|
|
386
408
|
}
|
|
387
|
-
var
|
|
409
|
+
var fixtureUuid = this.fixtureUuids.get(message.testCaseStartedId);
|
|
410
|
+
var testUuid = this.testResultUuids.get(message.testCaseStartedId);
|
|
411
|
+
var rootUuid = fixtureUuid !== null && fixtureUuid !== void 0 ? fixtureUuid : testUuid;
|
|
412
|
+
if (!rootUuid) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (message.mediaType === "application/vnd.allure.skipcucumber+json") {
|
|
416
|
+
if (testUuid) {
|
|
417
|
+
this.allureRuntime.updateTest(testUuid, result => {
|
|
418
|
+
result.labels.push({
|
|
419
|
+
name: "ALLURE_TESTPLAN_SKIP",
|
|
420
|
+
value: "true"
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
388
426
|
if (message.mediaType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE) {
|
|
389
427
|
var parsedMessage = JSON.parse(message.body);
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
428
|
+
|
|
429
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
430
|
+
this.allureRuntime.applyRuntimeMessages(rootUuid, Array.isArray(parsedMessage) ? parsedMessage : [parsedMessage]);
|
|
393
431
|
return;
|
|
394
432
|
}
|
|
395
433
|
var encoding = message.contentEncoding === AttachmentContentEncoding.BASE64 ? "base64" : "utf-8";
|
|
396
|
-
this.allureRuntime.applyRuntimeMessages([{
|
|
434
|
+
this.allureRuntime.applyRuntimeMessages(rootUuid, [{
|
|
397
435
|
type: "attachment_content",
|
|
398
436
|
data: {
|
|
399
437
|
name: (_message$fileName = message.fileName) !== null && _message$fileName !== void 0 ? _message$fileName : "Attachment",
|
|
@@ -403,9 +441,11 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
403
441
|
fileExtension: message.fileName ? extname(message.fileName) : undefined,
|
|
404
442
|
wrapInStep: true
|
|
405
443
|
}
|
|
406
|
-
}]
|
|
407
|
-
|
|
408
|
-
|
|
444
|
+
}]);
|
|
445
|
+
}
|
|
446
|
+
onTestRunFinished() {
|
|
447
|
+
this.allureRuntime.writeCategoriesDefinitions();
|
|
448
|
+
this.allureRuntime.writeEnvironmentInfo();
|
|
409
449
|
}
|
|
410
450
|
}
|
|
411
451
|
//# sourceMappingURL=reporter.js.map
|