allure-cucumberjs 3.0.0-beta.2 → 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 +23 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model.js +6 -0
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/reporter.js +145 -70
- 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 +25 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model.js +1 -1
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/reporter.js +147 -73
- 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 +6 -8
- package/dist/types/reporter.d.ts +5 -5
- 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,16 +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
6
|
import { AllureCucumberTestRuntime } from "./runtime.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
BeforeAll(() => {
|
|
8
|
+
setGlobalTestRuntime(new AllureCucumberTestRuntime());
|
|
9
|
+
});
|
|
10
|
+
Before({
|
|
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
|
+
}
|
|
14
29
|
});
|
|
15
30
|
export { AllureCucumberTestRuntime, AllureCucumberWorld };
|
|
16
31
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Before","setGlobalTestRuntime","AllureCucumberWorld","AllureCucumberTestRuntime","attach","
|
|
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
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var ALLURE_SETUP_REPORTER_HOOK = "__allure_reporter_setup_hook__";
|
|
2
2
|
//# sourceMappingURL=model.js.map
|
package/dist/esm/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","names":[],"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,56 +7,59 @@ 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
18
|
var {
|
|
19
|
-
ALLURE_THREAD_NAME
|
|
19
|
+
ALLURE_THREAD_NAME,
|
|
20
|
+
ALLURE_TEST_MODE
|
|
20
21
|
} = process.env;
|
|
21
22
|
export default class AllureCucumberReporter extends Formatter {
|
|
22
23
|
constructor(options) {
|
|
23
24
|
super(options);
|
|
24
|
-
_defineProperty(this, "afterHooks",
|
|
25
|
-
_defineProperty(this, "beforeHooks",
|
|
26
|
-
_defineProperty(this, "linksConfigs",
|
|
25
|
+
_defineProperty(this, "afterHooks", {});
|
|
26
|
+
_defineProperty(this, "beforeHooks", {});
|
|
27
|
+
_defineProperty(this, "linksConfigs", {});
|
|
27
28
|
_defineProperty(this, "labelsConfigs", []);
|
|
28
|
-
_defineProperty(this, "
|
|
29
|
+
_defineProperty(this, "allureRuntime", void 0);
|
|
29
30
|
_defineProperty(this, "documentMap", new Map());
|
|
30
31
|
_defineProperty(this, "scenarioMap", new Map());
|
|
31
32
|
_defineProperty(this, "stepMap", new Map());
|
|
32
33
|
_defineProperty(this, "testStepMap", new Map());
|
|
33
34
|
_defineProperty(this, "pickleStepMap", new Map());
|
|
34
|
-
_defineProperty(this, "testCaseTestStepsResults", new Map());
|
|
35
35
|
_defineProperty(this, "pickleMap", new Map());
|
|
36
|
-
_defineProperty(this, "hookMap", new Map());
|
|
37
36
|
_defineProperty(this, "testCaseMap", new Map());
|
|
38
37
|
_defineProperty(this, "testCaseStartedMap", new Map());
|
|
39
|
-
_defineProperty(this, "
|
|
38
|
+
_defineProperty(this, "testResultUuids", new Map());
|
|
39
|
+
_defineProperty(this, "scopeUuids", new Map());
|
|
40
|
+
_defineProperty(this, "fixtureUuids", new Map());
|
|
40
41
|
var _ref = options.parsedArgvOptions,
|
|
41
42
|
{
|
|
42
43
|
resultsDir = "./allure-results",
|
|
43
|
-
testMode,
|
|
44
44
|
links,
|
|
45
45
|
labels
|
|
46
46
|
} = _ref,
|
|
47
47
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
-
this.
|
|
49
|
-
writer:
|
|
48
|
+
this.allureRuntime = new ReporterRuntime(_objectSpread({
|
|
49
|
+
writer: ALLURE_TEST_MODE ? new MessageWriter() : new FileSystemWriter({
|
|
50
50
|
resultsDir
|
|
51
51
|
}),
|
|
52
|
-
links
|
|
52
|
+
links
|
|
53
53
|
}, rest));
|
|
54
|
-
this.linksConfigs = links ||
|
|
54
|
+
this.linksConfigs = links || {};
|
|
55
55
|
this.labelsConfigs = labels || [];
|
|
56
56
|
options.eventBroadcaster.on("envelope", this.parseEnvelope.bind(this));
|
|
57
|
-
this.beforeHooks = options.supportCodeLibrary.beforeTestCaseHookDefinitions
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
this.beforeHooks = options.supportCodeLibrary.beforeTestCaseHookDefinitions.reduce((acc, hook) => Object.assign(acc, {
|
|
58
|
+
[hook.id]: hook
|
|
59
|
+
}), {});
|
|
60
|
+
this.afterHooks = options.supportCodeLibrary.afterTestCaseHookDefinitions.reduce((acc, hook) => Object.assign(acc, {
|
|
61
|
+
[hook.id]: hook
|
|
62
|
+
}), {});
|
|
60
63
|
// set AllureCucumberWorld for single thread mode
|
|
61
64
|
if (options.supportCodeLibrary.World === World) {
|
|
62
65
|
// @ts-ignore
|
|
@@ -69,10 +72,14 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
69
72
|
labelsConfigs,
|
|
70
73
|
linksConfigs
|
|
71
74
|
} = this;
|
|
72
|
-
|
|
75
|
+
var linkConfigEntries = Object.entries(linksConfigs).map(_ref2 => {
|
|
76
|
+
var [, v] = _ref2;
|
|
77
|
+
return v;
|
|
78
|
+
});
|
|
79
|
+
return [...labelsConfigs, ...linkConfigEntries].flatMap(_ref3 => {
|
|
73
80
|
var {
|
|
74
81
|
pattern
|
|
75
|
-
} =
|
|
82
|
+
} = _ref3;
|
|
76
83
|
return pattern;
|
|
77
84
|
});
|
|
78
85
|
}
|
|
@@ -96,15 +103,15 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
96
103
|
case !!envelope.attachment:
|
|
97
104
|
this.onAttachment(envelope.attachment);
|
|
98
105
|
break;
|
|
99
|
-
case !!envelope.hook:
|
|
100
|
-
this.onHook(envelope.hook);
|
|
101
|
-
break;
|
|
102
106
|
case !!envelope.testStepStarted:
|
|
103
107
|
this.onTestStepStarted(envelope.testStepStarted);
|
|
104
108
|
break;
|
|
105
109
|
case !!envelope.testStepFinished:
|
|
106
110
|
this.onTestStepFinished(envelope.testStepFinished);
|
|
107
111
|
break;
|
|
112
|
+
case !!envelope.testRunFinished:
|
|
113
|
+
this.onTestRunFinished();
|
|
114
|
+
break;
|
|
108
115
|
}
|
|
109
116
|
}
|
|
110
117
|
parseTagsLabels(tags) {
|
|
@@ -134,16 +141,17 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
134
141
|
parseTagsLinks(tags) {
|
|
135
142
|
var tagKeyRe = /^@\S+=/;
|
|
136
143
|
var links = [];
|
|
137
|
-
if (this.linksConfigs.length === 0) {
|
|
144
|
+
if (Object.keys(this.linksConfigs).length === 0) {
|
|
138
145
|
return links;
|
|
139
146
|
}
|
|
140
|
-
this.linksConfigs.forEach(
|
|
147
|
+
Object.entries(this.linksConfigs).forEach(_ref4 => {
|
|
148
|
+
var [type, matcher] = _ref4;
|
|
141
149
|
var matchedTags = tags.filter(tag => matcher.pattern.some(pattern => pattern.test(tag.name)));
|
|
142
150
|
var matchedLinks = matchedTags.map(tag => {
|
|
143
151
|
var tagValue = tag.name.replace(tagKeyRe, "");
|
|
144
152
|
return {
|
|
145
|
-
url: matcher.urlTemplate
|
|
146
|
-
type
|
|
153
|
+
url: applyLinkTemplate(matcher.urlTemplate, tagValue) || tagValue,
|
|
154
|
+
type
|
|
147
155
|
};
|
|
148
156
|
});
|
|
149
157
|
links.push(...matchedLinks);
|
|
@@ -247,9 +255,11 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
247
255
|
var scenarioLinks = this.parseTagsLinks((scenario === null || scenario === void 0 ? void 0 : scenario.tags) || []);
|
|
248
256
|
result.labels.push(...featureLabels, ...scenarioLabels, ...pickleLabels);
|
|
249
257
|
result.links.push(...featureLinks, ...scenarioLinks);
|
|
250
|
-
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);
|
|
251
262
|
this.testCaseStartedMap.set(data.id, data);
|
|
252
|
-
this.allureResultsUuids.set(data.id, testUuid);
|
|
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.
|
|
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,19 +290,44 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
277
290
|
message: "The test doesn't have an implementation."
|
|
278
291
|
};
|
|
279
292
|
}
|
|
280
|
-
}, testUuid);
|
|
281
|
-
this.runtime.stopTest({
|
|
282
|
-
uuid: testUuid,
|
|
283
|
-
stop: Date.now()
|
|
284
293
|
});
|
|
285
|
-
this.
|
|
294
|
+
this.allureRuntime.stopTest(testUuid);
|
|
295
|
+
this.allureRuntime.writeTest(testUuid);
|
|
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
|
+
}
|
|
286
302
|
}
|
|
287
303
|
onTestStepStarted(data) {
|
|
288
304
|
var _stepPickle$argument;
|
|
289
|
-
var testUuid = this.
|
|
305
|
+
var testUuid = this.testResultUuids.get(data.testCaseStartedId);
|
|
290
306
|
var step = this.testStepMap.get(data.testStepId);
|
|
291
|
-
|
|
292
|
-
|
|
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,
|
|
324
|
+
stage: Stage.RUNNING
|
|
325
|
+
});
|
|
326
|
+
if (fixtureUuid) {
|
|
327
|
+
this.fixtureUuids.set(data.testCaseStartedId, fixtureUuid);
|
|
328
|
+
}
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
293
331
|
if (!step.pickleStepId) {
|
|
294
332
|
return;
|
|
295
333
|
}
|
|
@@ -298,68 +336,102 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
298
336
|
return;
|
|
299
337
|
}
|
|
300
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) || "";
|
|
301
|
-
var
|
|
339
|
+
var stepUuid = this.allureRuntime.startStep(testUuid, undefined, _objectSpread(_objectSpread({}, createStepResult()), {}, {
|
|
302
340
|
name: "".concat(stepKeyword).concat(stepPickle.text),
|
|
303
341
|
start: data.timestamp.nanos
|
|
304
|
-
});
|
|
305
|
-
this.runtime.startStep(stepResult, testUuid);
|
|
342
|
+
}));
|
|
306
343
|
if (!((_stepPickle$argument = stepPickle.argument) !== null && _stepPickle$argument !== void 0 && _stepPickle$argument.dataTable)) {
|
|
307
344
|
return;
|
|
308
345
|
}
|
|
309
346
|
var csvDataTable = stepPickle.argument.dataTable.rows.reduce((acc, row) => "".concat(acc + row.cells.map(cell => cell.value).join(","), "\n"), "");
|
|
310
|
-
this.
|
|
347
|
+
this.allureRuntime.writeAttachment(testUuid, stepUuid, "Data table", Buffer.from(csvDataTable, "utf-8"), {
|
|
311
348
|
contentType: ContentType.CSV,
|
|
312
349
|
fileExtension: ".csv"
|
|
313
|
-
}
|
|
350
|
+
});
|
|
314
351
|
}
|
|
315
352
|
onTestStepFinished(data) {
|
|
316
|
-
var
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
353
|
+
var step = this.testStepMap.get(data.testStepId);
|
|
354
|
+
if (!step) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
var status = this.parseStatus(data.testStepResult);
|
|
358
|
+
var stage = status !== Status.SKIPPED ? Stage.FINISHED : Stage.PENDING;
|
|
359
|
+
if (step.hookId) {
|
|
360
|
+
var fixtureUuid = this.fixtureUuids.get(data.testCaseStartedId);
|
|
361
|
+
if (!fixtureUuid) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
this.allureRuntime.updateFixture(fixtureUuid, r => {
|
|
365
|
+
r.stage = stage;
|
|
366
|
+
r.status = status;
|
|
367
|
+
if (data.testStepResult.exception) {
|
|
368
|
+
r.statusDetails = getMessageAndTraceFromError({
|
|
369
|
+
message: data.testStepResult.message,
|
|
370
|
+
stack: data.testStepResult.exception.stackTrace
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
// TODO stop from duration? use data.timestamp.nanos?
|
|
375
|
+
this.allureRuntime.stopFixture(fixtureUuid);
|
|
376
|
+
this.fixtureUuids.delete(data.testCaseStartedId);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
var testUuid = this.testResultUuids.get(data.testCaseStartedId);
|
|
380
|
+
var currentStep = this.allureRuntime.currentStep(testUuid);
|
|
320
381
|
if (!currentStep) {
|
|
321
382
|
return;
|
|
322
383
|
}
|
|
323
|
-
this.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
step.stage = status !== Status.SKIPPED ? Stage.FINISHED : Stage.PENDING;
|
|
384
|
+
this.allureRuntime.updateStep(currentStep, r => {
|
|
385
|
+
r.status = status;
|
|
386
|
+
r.stage = stage;
|
|
327
387
|
if (status === undefined) {
|
|
328
|
-
|
|
388
|
+
r.statusDetails = {
|
|
329
389
|
message: "The step doesn't have an implementation."
|
|
330
390
|
};
|
|
331
391
|
return;
|
|
332
392
|
}
|
|
333
393
|
if (data.testStepResult.exception) {
|
|
334
|
-
|
|
394
|
+
r.statusDetails = {
|
|
335
395
|
message: data.testStepResult.message,
|
|
336
396
|
trace: data.testStepResult.exception.stackTrace
|
|
337
397
|
};
|
|
338
398
|
}
|
|
339
|
-
}, testUuid);
|
|
340
|
-
this.runtime.stopStep({
|
|
341
|
-
uuid: testUuid,
|
|
342
|
-
stop: currentStep.start + data.timestamp.nanos
|
|
343
399
|
});
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
this.
|
|
400
|
+
|
|
401
|
+
// TODO stop from duration? use data.timestamp.nanos?
|
|
402
|
+
this.allureRuntime.stopStep(currentStep);
|
|
347
403
|
}
|
|
348
404
|
onAttachment(message) {
|
|
349
405
|
var _message$fileName;
|
|
350
406
|
if (!message.testCaseStartedId) {
|
|
351
407
|
return;
|
|
352
408
|
}
|
|
353
|
-
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
|
+
}
|
|
354
426
|
if (message.mediaType === ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE) {
|
|
355
427
|
var parsedMessage = JSON.parse(message.body);
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
428
|
+
|
|
429
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
430
|
+
this.allureRuntime.applyRuntimeMessages(rootUuid, Array.isArray(parsedMessage) ? parsedMessage : [parsedMessage]);
|
|
359
431
|
return;
|
|
360
432
|
}
|
|
361
433
|
var encoding = message.contentEncoding === AttachmentContentEncoding.BASE64 ? "base64" : "utf-8";
|
|
362
|
-
this.
|
|
434
|
+
this.allureRuntime.applyRuntimeMessages(rootUuid, [{
|
|
363
435
|
type: "attachment_content",
|
|
364
436
|
data: {
|
|
365
437
|
name: (_message$fileName = message.fileName) !== null && _message$fileName !== void 0 ? _message$fileName : "Attachment",
|
|
@@ -369,9 +441,11 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
369
441
|
fileExtension: message.fileName ? extname(message.fileName) : undefined,
|
|
370
442
|
wrapInStep: true
|
|
371
443
|
}
|
|
372
|
-
}]
|
|
373
|
-
|
|
374
|
-
|
|
444
|
+
}]);
|
|
445
|
+
}
|
|
446
|
+
onTestRunFinished() {
|
|
447
|
+
this.allureRuntime.writeCategoriesDefinitions();
|
|
448
|
+
this.allureRuntime.writeEnvironmentInfo();
|
|
375
449
|
}
|
|
376
450
|
}
|
|
377
451
|
//# sourceMappingURL=reporter.js.map
|