allure-cucumberjs 2.0.0-beta.2 → 2.0.0-beta.20

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.
Files changed (44) hide show
  1. package/LICENSE.txt +1 -1
  2. package/README.md +137 -43
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.js +9 -9
  5. package/dist/index.js.map +1 -1
  6. package/dist/src/CucumberAllureWorld.d.ts +77 -0
  7. package/dist/src/CucumberAllureWorld.js +220 -0
  8. package/dist/src/CucumberAllureWorld.js.map +1 -0
  9. package/dist/src/CucumberJSAllureReporter.d.ts +59 -0
  10. package/dist/src/CucumberJSAllureReporter.js +394 -283
  11. package/dist/src/CucumberJSAllureReporter.js.map +1 -1
  12. package/package.json +38 -14
  13. package/dist/declarations/index.d.ts +0 -2
  14. package/dist/declarations/src/CucumberAllureInterface.d.ts +0 -35
  15. package/dist/declarations/src/CucumberJSAllureReporter.d.ts +0 -75
  16. package/dist/declarations/src/events/Example.d.ts +0 -8
  17. package/dist/declarations/src/events/GherkinDocument.d.ts +0 -17
  18. package/dist/declarations/src/events/GherkinExample.d.ts +0 -15
  19. package/dist/declarations/src/events/GherkinStep.d.ts +0 -17
  20. package/dist/declarations/src/events/GherkinTestCase.d.ts +0 -18
  21. package/dist/declarations/src/events/Result.d.ts +0 -5
  22. package/dist/declarations/src/events/SourceLocation.d.ts +0 -11
  23. package/dist/declarations/src/events/TestHookDefinition.d.ts +0 -8
  24. package/dist/declarations/src/utilities.d.ts +0 -7
  25. package/dist/src/CucumberAllureInterface.js +0 -148
  26. package/dist/src/CucumberAllureInterface.js.map +0 -1
  27. package/dist/src/events/Example.js +0 -28
  28. package/dist/src/events/Example.js.map +0 -1
  29. package/dist/src/events/GherkinDocument.js +0 -10
  30. package/dist/src/events/GherkinDocument.js.map +0 -1
  31. package/dist/src/events/GherkinExample.js +0 -9
  32. package/dist/src/events/GherkinExample.js.map +0 -1
  33. package/dist/src/events/GherkinStep.js +0 -9
  34. package/dist/src/events/GherkinStep.js.map +0 -1
  35. package/dist/src/events/GherkinTestCase.js +0 -11
  36. package/dist/src/events/GherkinTestCase.js.map +0 -1
  37. package/dist/src/events/Result.js +0 -9
  38. package/dist/src/events/Result.js.map +0 -1
  39. package/dist/src/events/SourceLocation.js +0 -12
  40. package/dist/src/events/SourceLocation.js.map +0 -1
  41. package/dist/src/events/TestHookDefinition.js +0 -3
  42. package/dist/src/events/TestHookDefinition.js.map +0 -1
  43. package/dist/src/utilities.js +0 -49
  44. package/dist/src/utilities.js.map +0 -1
package/LICENSE.txt CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2018 Qameta Software
189
+ Copyright 2019-2021 Qameta Software
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -1,69 +1,163 @@
1
1
  # allure-cucumberjs
2
2
 
3
- Allure integration for Cucumber.JS framework
3
+ Allure integration for `cucumber-js` compatible with `@cucumber/cucumber@^8.x.x` and Allure 2+.
4
4
 
5
- Compatible with Cucumber.JS 3+ and Allure 2+
5
+ ## Basic usage
6
6
 
7
- ### How to use
8
- Create Reporter file:
9
- ```ecmascript 6
10
- export default class Reporter extends CucumberJSAllureFormatter {
7
+ Install the required packages using your favorite package manager:
8
+
9
+ ```shell
10
+ # using npm
11
+ npm install --save-dev allure-js-commons allure-cucumberjs
12
+ # using yarn
13
+ yarn add -D allure-js-commons allure-cucumberjs
14
+ # using pnpm
15
+ pnpm add -D allure-js-commons allure-cucumberjs
16
+ ```
17
+
18
+ Create the reporter file:
19
+
20
+ ```js
21
+ // reporter.js
22
+ import { AllureRuntime } from "allure-js-commons"
23
+ import { CucumberJSAllureFormatter } from "allure-cucumberjs";
24
+
25
+ export default class extends CucumberJSAllureFormatter {
11
26
  constructor(options) {
12
27
  super(
13
28
  options,
14
- new AllureRuntime({ resultsDir: "./out/allure-results" }),
29
+ new AllureRuntime({ resultsDir: "./allure-results" }),
15
30
  {
16
- labels: {
17
- issue: [/@bug_(.*)/],
18
- epic: [/@feature:(.*)/]
19
- }
31
+ labels: [
32
+ {
33
+ pattern: [/@feature:(.*)/],
34
+ name: "epic"
35
+ },
36
+ {
37
+ pattern: [/@severity:(.*)/],
38
+ name: "severity"
39
+ }
40
+ ],
41
+ links: [
42
+ {
43
+ pattern: [/@issue=(.*)/],
44
+ type: "issue",
45
+ urlTemplate: "http://localhost:8080/issue/%s"
46
+ },
47
+ {
48
+ pattern: [/@tms=(.*)/],
49
+ type: "tms",
50
+ urlTemplate: "http://localhost:8080/tms/%s"
51
+ }
52
+ ]
20
53
  }
21
54
  );
22
55
  }
23
56
  }
24
57
  ```
25
- This class MUST:
26
- * Be a default export
27
- * Extend `CucumberJSAllureFormatter`
28
- * Take 1 argument in constructor and pass it to `super()` as first argument
29
- * Second `super()` argument is `AllureRuntime` instance
30
- * Third is a config, currently allows to map tags to Allure labels
31
-
32
- Then pass with reporter as a Cucumber formatter:
58
+
59
+ Then let know `cucumber-js` about the reporter via CLI parameter:
60
+
61
+ ```shell
62
+ cucumber-js --format ./path/to/reporter.js
63
+ ```
64
+
65
+ Or via configuration file:
66
+
67
+ ```js
68
+ // config.js
69
+ module.exports = {
70
+ default: {
71
+ format: "./path/to/reporter.js"
72
+ }
73
+ }
33
74
  ```
34
- node cucumber.js --format ./path/to/Reporter.js
75
+
76
+ And then run CLI with `config` parameter:
77
+
78
+ ```shell
79
+ cucumber-js --config ./config.js
35
80
  ```
81
+
36
82
  If you want to retain default formatter add some dummy file as output:
83
+
84
+ ```shell
85
+ cucumber-js --format ./path/to/reporter.js:./dummy.txt
37
86
  ```
38
- node cucumber.js --format ./path/to/Reporter.js:./dummy.txt
87
+
88
+ ## Using Allure API
89
+
90
+ You're able to call Allure API methods injected to the `World` object by the reporter.
91
+ By default, the feature is available out of the box for single thread mode.
92
+
93
+ Example:
94
+
95
+ ```js
96
+ import { Given } from "@cucumber/cucumber"
97
+
98
+ Given(/my step/, async function () {
99
+ await this.step("step can have anonymous body function", async function () {
100
+ await this.label("label_name", "label_value")
101
+ await this.attach(JSON.stringify({ foo: "bar "}), "application/json")
102
+ })
103
+
104
+ await this.step("by the way, body function can be arrow one", async (step) => {
105
+ await step.label("label_name", "label_value")
106
+ await step.attach(JSON.stringify({ foo: "bar "}), "application/json")
107
+ })
108
+ })
39
109
  ```
40
110
 
41
- #### Reporter without classes
42
- If you can not use classes (ES6 or TypeScript), here is an example of Reporter.js file written in plain JS:
43
- ```javascript
44
- var CucumberJSAllureFormatter = require(allure-cucumberjs).CucumberJSAllureFormatter;
45
- var AllureRuntime = require(allure-cucumberjs).AllureRuntime;
46
-
47
- function Reporter(options) {
48
- CucumberJSAllureFormatter.call(this,
49
- options,
50
- new AllureRuntime({ resultsDir: "./out/allure-results" }),
51
- {});
52
- }
53
- Reporter.prototype = Object.create(CucumberJSAllureFormatter.prototype);
54
- Reporter.prototype.constructor = Reporter;
111
+ If you want to keep the functoinality in `parallel` mode, set `CucumberAllureWorld` as
112
+ world constructor:
113
+
114
+ ```diff
115
+ - import { Given } from "@cucumber/cucumber"
116
+ + import { Given, setWorldConstructor } from "@cucumber/cucumber"
117
+ + import { CucumberAllureWorld } from "allure-cucumberjs"
118
+
119
+ + setWorldConstructor(CucumberAllureWorld)
55
120
 
56
- exports.default = Reporter;
121
+ Given(/my step/, async function () {
122
+ await this.step("step can have anonymous body function", async function () {
123
+ await this.label("label_name", "label_value")
124
+ await this.attach(JSON.stringify({ foo: "bar "}), "application/json")
125
+ })
126
+
127
+ await this.step("by the way, body function can be arrow one", async (step) => {
128
+ await step.label("label_name", "label_value")
129
+ await step.attach(JSON.stringify({ foo: "bar "}), "application/json")
130
+ })
131
+ })
57
132
  ```
58
133
 
59
- ### API
60
- Instance of AllureInterface will be added to World prototype.
61
- You can use it for creating nested steps and adding info to the report.
134
+ Follow the same approach when you need to use your own `World` implementation. Just extend it from
135
+ `CucumberAllureWorld`:
136
+
137
+ ```diff
138
+ - import { Given } from "@cucumber/cucumber"
139
+ + import { Given, setWorldConstructor } from "@cucumber/cucumber"
140
+ + import { CucumberAllureWorld } from "allure-cucumberjs"
62
141
 
63
- ### Author
142
+ + class MyWorld extends CucumberAllureWorld {
143
+ + hello() {
144
+ + console.log('say hello!')
145
+ + }
146
+ + }
64
147
 
65
- Ilya Korobitsyn <mail@korobochka.org>
148
+ + setWorldConstructor(MyWorld)
66
149
 
67
- #### Contributors
150
+ Given(/my step/, async function () {
151
+ + this.hello()
152
+
153
+ await this.step("step can have anonymous body function", async function () {
154
+ await this.label("label_name", "label_value")
155
+ await this.attach(JSON.stringify({ foo: "bar "}), "application/json")
156
+ })
68
157
 
69
- * Claudia Hardman <claudia.hardman@mattel.com>
158
+ await this.step("by the way, body function can be arrow one", async (step) => {
159
+ await step.label("label_name", "label_value")
160
+ await step.attach(JSON.stringify({ foo: "bar "}), "application/json")
161
+ })
162
+ })
163
+ ```
@@ -0,0 +1,3 @@
1
+ export { Allure, CucumberJSAllureFormatter, CucumberJSAllureFormatterConfig } from "./src/CucumberJSAllureReporter";
2
+ export { CucumberAllureWorld } from "./src/CucumberAllureWorld";
3
+ export { AllureRuntime, AllureConfig, ContentType, Severity, ExecutorInfo, Category } from "allure-js-commons";
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Severity = exports.ContentType = exports.AllureRuntime = exports.CucumberAllureWorld = exports.CucumberJSAllureFormatterConfig = exports.CucumberJSAllureFormatter = exports.Allure = void 0;
3
4
  var CucumberJSAllureReporter_1 = require("./src/CucumberJSAllureReporter");
4
- exports.AllureInterface = CucumberJSAllureReporter_1.AllureInterface;
5
- exports.CucumberJSAllureFormatter = CucumberJSAllureReporter_1.CucumberJSAllureFormatter;
6
- exports.CucumberJSAllureFormatterConfig = CucumberJSAllureReporter_1.CucumberJSAllureFormatterConfig;
5
+ Object.defineProperty(exports, "Allure", { enumerable: true, get: function () { return CucumberJSAllureReporter_1.Allure; } });
6
+ Object.defineProperty(exports, "CucumberJSAllureFormatter", { enumerable: true, get: function () { return CucumberJSAllureReporter_1.CucumberJSAllureFormatter; } });
7
+ Object.defineProperty(exports, "CucumberJSAllureFormatterConfig", { enumerable: true, get: function () { return CucumberJSAllureReporter_1.CucumberJSAllureFormatterConfig; } });
8
+ var CucumberAllureWorld_1 = require("./src/CucumberAllureWorld");
9
+ Object.defineProperty(exports, "CucumberAllureWorld", { enumerable: true, get: function () { return CucumberAllureWorld_1.CucumberAllureWorld; } });
7
10
  var allure_js_commons_1 = require("allure-js-commons");
8
- exports.AllureRuntime = allure_js_commons_1.AllureRuntime;
9
- exports.AllureConfig = allure_js_commons_1.AllureConfig;
10
- exports.ContentType = allure_js_commons_1.ContentType;
11
- exports.Severity = allure_js_commons_1.Severity;
12
- exports.ExecutorInfo = allure_js_commons_1.ExecutorInfo;
13
- exports.Category = allure_js_commons_1.Category;
11
+ Object.defineProperty(exports, "AllureRuntime", { enumerable: true, get: function () { return allure_js_commons_1.AllureRuntime; } });
12
+ Object.defineProperty(exports, "ContentType", { enumerable: true, get: function () { return allure_js_commons_1.ContentType; } });
13
+ Object.defineProperty(exports, "Severity", { enumerable: true, get: function () { return allure_js_commons_1.Severity; } });
14
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;AAAA,2EAGwC;AAFtC,qDAAA,eAAe,CAAA;AAAS,+DAAA,yBAAyB,CAAA;AAAE,qEAAA,+BAA+B,CAAA;AAGpF,uDAE2B;AADzB,4CAAA,aAAa,CAAA;AAAE,2CAAA,YAAY,CAAA;AAAE,0CAAA,WAAW,CAAA;AAAE,uCAAA,QAAQ,CAAA;AAAoB,2CAAA,YAAY,CAAA;AAAE,uCAAA,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,2EAEwC;AADtC,kHAAA,MAAM,OAAA;AAAE,qIAAA,yBAAyB,OAAA;AAAE,2IAAA,+BAA+B,OAAA;AAEpE,iEAEmC;AADjC,0HAAA,mBAAmB,OAAA;AAErB,uDAE2B;AADzB,kHAAA,aAAa,OAAA;AAAgB,gHAAA,WAAW,OAAA;AAAE,6GAAA,QAAQ,OAAA"}
@@ -0,0 +1,77 @@
1
+ /// <reference types="node" />
2
+ import { World } from "@cucumber/cucumber";
3
+ import { AttachmentMetadata, AttachmentOptions, Category, ContentType, ExecutableItem, ParameterOptions } from "allure-js-commons";
4
+ export declare type CucumberAttachment = {
5
+ name: string;
6
+ type: string;
7
+ content: string;
8
+ };
9
+ export declare type CucumberAttachmentStepMetadata = Omit<ExecutableItem, "steps" | "attachments"> & {
10
+ attachments: CucumberAttachment[];
11
+ };
12
+ export interface CucumberAttachmentMetadata extends AttachmentMetadata {
13
+ step?: CucumberAttachmentStepMetadata;
14
+ descriptionHtml?: string;
15
+ environmentInfo?: Record<string, string>;
16
+ categories?: Category[];
17
+ }
18
+ export interface CucumberExecutable {
19
+ label(label: string, value: string): void | Promise<void>;
20
+ link(url: string, name?: string, type?: string): void | Promise<void>;
21
+ parameter(name: string, value: string, options?: ParameterOptions): void | Promise<void>;
22
+ epic(epic: string): void | Promise<void>;
23
+ feature(feature: string): void | Promise<void>;
24
+ story(story: string): void | Promise<void>;
25
+ suite(name: string): void | Promise<void>;
26
+ parentSuite(name: string): void | Promise<void>;
27
+ subSuite(name: string): void | Promise<void>;
28
+ owner(owner: string): void | Promise<void>;
29
+ severity(severity: string): void | Promise<void>;
30
+ tag(tag: string): void | Promise<void>;
31
+ issue(issue: string, url: string): void | Promise<void>;
32
+ tms(issue: string, url: string): void | Promise<void>;
33
+ attach(name: string, content: Buffer | string, options: ContentType | string | AttachmentOptions): void | Promise<void>;
34
+ }
35
+ export declare class CucumberWorldStep implements CucumberExecutable {
36
+ name: string;
37
+ attachments: CucumberAttachment[];
38
+ metadata: CucumberAttachmentMetadata;
39
+ constructor(name: string);
40
+ label(label: string, value: string): void;
41
+ link(url: string, name?: string, type?: string): void;
42
+ parameter(name: string, value: string, options?: ParameterOptions): void;
43
+ epic(epic: string): void;
44
+ feature(feature: string): void;
45
+ story(story: string): void;
46
+ suite(name: string): void;
47
+ parentSuite(name: string): void;
48
+ subSuite(name: string): void;
49
+ owner(owner: string): void;
50
+ severity(severity: string): void;
51
+ tag(tag: string): void;
52
+ issue(name: string, url: string): void;
53
+ tms(name: string, url: string): void;
54
+ attach(source: string | Buffer, type: string): void;
55
+ start(body: (step: CucumberWorldStep) => any | Promise<any>): Promise<CucumberAttachmentMetadata>;
56
+ }
57
+ export declare class CucumberAllureWorld extends World implements Omit<CucumberExecutable, "attach"> {
58
+ label(label: string, value: string): Promise<void>;
59
+ link(url: string, name?: string, type?: string): Promise<void>;
60
+ parameter(name: string, value: string, options?: ParameterOptions): Promise<void>;
61
+ description(markdown: string): Promise<void>;
62
+ descriptionHtml(html: string): Promise<void>;
63
+ writeEnvironmentInfo(info: Record<string, string>): Promise<void>;
64
+ writeCategoriesDefinitions(categories: Category[]): Promise<void>;
65
+ step(name: string, body: (this: CucumberWorldStep, step: CucumberWorldStep) => Promise<any>): Promise<void>;
66
+ epic(epic: string): Promise<void>;
67
+ feature(feature: string): Promise<void>;
68
+ story(story: string): Promise<void>;
69
+ suite(name: string): Promise<void>;
70
+ parentSuite(name: string): Promise<void>;
71
+ subSuite(name: string): Promise<void>;
72
+ owner(owner: string): Promise<void>;
73
+ severity(severity: string): Promise<void>;
74
+ tag(tag: string): Promise<void>;
75
+ issue(name: string, url: string): Promise<void>;
76
+ tms(name: string, url: string): Promise<void>;
77
+ }
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CucumberAllureWorld = exports.CucumberWorldStep = void 0;
4
+ const cucumber_1 = require("@cucumber/cucumber");
5
+ const allure_js_commons_1 = require("allure-js-commons");
6
+ const internal_1 = require("allure-js-commons/internal");
7
+ class CucumberWorldStep {
8
+ constructor(name) {
9
+ this.name = "";
10
+ this.attachments = [];
11
+ this.metadata = {
12
+ labels: [],
13
+ parameter: [],
14
+ };
15
+ this.name = name;
16
+ }
17
+ label(label, value) {
18
+ var _a;
19
+ (_a = this.metadata.labels) === null || _a === void 0 ? void 0 : _a.push({
20
+ name: label,
21
+ value,
22
+ });
23
+ }
24
+ link(url, name, type) {
25
+ var _a;
26
+ (_a = this.metadata.links) === null || _a === void 0 ? void 0 : _a.push({
27
+ name,
28
+ url,
29
+ type,
30
+ });
31
+ }
32
+ parameter(name, value, options) {
33
+ var _a;
34
+ (_a = this.metadata.parameter) === null || _a === void 0 ? void 0 : _a.push({
35
+ name,
36
+ value,
37
+ hidden: (options === null || options === void 0 ? void 0 : options.hidden) || false,
38
+ excluded: (options === null || options === void 0 ? void 0 : options.excluded) || false,
39
+ });
40
+ }
41
+ epic(epic) {
42
+ this.label(allure_js_commons_1.LabelName.EPIC, epic);
43
+ }
44
+ feature(feature) {
45
+ this.label(allure_js_commons_1.LabelName.FEATURE, feature);
46
+ }
47
+ story(story) {
48
+ this.label(allure_js_commons_1.LabelName.STORY, story);
49
+ }
50
+ suite(name) {
51
+ this.label(allure_js_commons_1.LabelName.SUITE, name);
52
+ }
53
+ parentSuite(name) {
54
+ this.label(allure_js_commons_1.LabelName.PARENT_SUITE, name);
55
+ }
56
+ subSuite(name) {
57
+ this.label(allure_js_commons_1.LabelName.SUB_SUITE, name);
58
+ }
59
+ owner(owner) {
60
+ this.label(allure_js_commons_1.LabelName.OWNER, owner);
61
+ }
62
+ severity(severity) {
63
+ this.label(allure_js_commons_1.LabelName.SEVERITY, severity);
64
+ }
65
+ tag(tag) {
66
+ this.label(allure_js_commons_1.LabelName.TAG, tag);
67
+ }
68
+ issue(name, url) {
69
+ this.link(url, name, allure_js_commons_1.LinkType.ISSUE);
70
+ }
71
+ tms(name, url) {
72
+ this.link(url, name, allure_js_commons_1.LinkType.TMS);
73
+ }
74
+ attach(source, type) {
75
+ this.attachments.push({
76
+ name: "attachment",
77
+ content: Buffer.isBuffer(source)
78
+ ? source.toString("base64")
79
+ : Buffer.from(source, "utf8").toString("base64"),
80
+ type,
81
+ });
82
+ }
83
+ async start(body) {
84
+ const startDate = new Date().getTime();
85
+ try {
86
+ const res = body.call(this, this);
87
+ const stepResult = await res;
88
+ return Object.assign(Object.assign({}, this.metadata), { step: {
89
+ name: this.name,
90
+ start: startDate,
91
+ stop: new Date().getTime(),
92
+ stage: allure_js_commons_1.Stage.FINISHED,
93
+ status: allure_js_commons_1.Status.PASSED,
94
+ statusDetails: {},
95
+ attachments: this.attachments,
96
+ parameters: [],
97
+ } });
98
+ }
99
+ catch (err) {
100
+ return Object.assign(Object.assign({}, this.metadata), { step: {
101
+ name: this.name,
102
+ start: startDate,
103
+ stop: new Date().getTime(),
104
+ stage: allure_js_commons_1.Stage.FINISHED,
105
+ status: allure_js_commons_1.Status.FAILED,
106
+ statusDetails: err instanceof Error
107
+ ? {
108
+ message: err.message,
109
+ trace: err.stack,
110
+ }
111
+ : {},
112
+ attachments: this.attachments,
113
+ parameters: [],
114
+ } });
115
+ }
116
+ }
117
+ }
118
+ exports.CucumberWorldStep = CucumberWorldStep;
119
+ class CucumberAllureWorld extends cucumber_1.World {
120
+ async label(label, value) {
121
+ const msgBody = {
122
+ labels: [
123
+ {
124
+ name: label,
125
+ value,
126
+ },
127
+ ],
128
+ };
129
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
130
+ }
131
+ async link(url, name, type) {
132
+ const msgBody = {
133
+ links: [
134
+ {
135
+ name,
136
+ url,
137
+ type,
138
+ },
139
+ ],
140
+ };
141
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
142
+ }
143
+ async parameter(name, value, options) {
144
+ const msgBody = {
145
+ parameter: [
146
+ {
147
+ name,
148
+ value,
149
+ hidden: (options === null || options === void 0 ? void 0 : options.hidden) || false,
150
+ excluded: (options === null || options === void 0 ? void 0 : options.excluded) || false,
151
+ },
152
+ ],
153
+ };
154
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
155
+ }
156
+ async description(markdown) {
157
+ const msgBody = {
158
+ description: markdown,
159
+ };
160
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
161
+ }
162
+ async descriptionHtml(html) {
163
+ const msgBody = {
164
+ descriptionHtml: html,
165
+ };
166
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
167
+ }
168
+ async writeEnvironmentInfo(info) {
169
+ const msgBody = {
170
+ environmentInfo: info,
171
+ };
172
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
173
+ }
174
+ async writeCategoriesDefinitions(categories) {
175
+ const msgBody = {
176
+ categories,
177
+ };
178
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
179
+ }
180
+ async step(name, body) {
181
+ const testStep = new CucumberWorldStep(name);
182
+ const msgBody = await testStep.start(body);
183
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
184
+ }
185
+ async epic(epic) {
186
+ await this.label(allure_js_commons_1.LabelName.EPIC, epic);
187
+ }
188
+ async feature(feature) {
189
+ await this.label(allure_js_commons_1.LabelName.FEATURE, feature);
190
+ }
191
+ async story(story) {
192
+ await this.label(allure_js_commons_1.LabelName.STORY, story);
193
+ }
194
+ async suite(name) {
195
+ await this.label(allure_js_commons_1.LabelName.SUITE, name);
196
+ }
197
+ async parentSuite(name) {
198
+ await this.label(allure_js_commons_1.LabelName.PARENT_SUITE, name);
199
+ }
200
+ async subSuite(name) {
201
+ await this.label(allure_js_commons_1.LabelName.SUB_SUITE, name);
202
+ }
203
+ async owner(owner) {
204
+ await this.label(allure_js_commons_1.LabelName.OWNER, owner);
205
+ }
206
+ async severity(severity) {
207
+ await this.label(allure_js_commons_1.LabelName.SEVERITY, severity);
208
+ }
209
+ async tag(tag) {
210
+ await this.label(allure_js_commons_1.LabelName.TAG, tag);
211
+ }
212
+ async issue(name, url) {
213
+ await this.link(url, name, allure_js_commons_1.LinkType.ISSUE);
214
+ }
215
+ async tms(name, url) {
216
+ await this.link(url, name, allure_js_commons_1.LinkType.TMS);
217
+ }
218
+ }
219
+ exports.CucumberAllureWorld = CucumberAllureWorld;
220
+ //# sourceMappingURL=CucumberAllureWorld.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CucumberAllureWorld.js","sourceRoot":"","sources":["../../src/CucumberAllureWorld.ts"],"names":[],"mappings":";;;AAAA,iDAA2C;AAC3C,yDAY2B;AAC3B,yDAA0E;AAuD1E,MAAa,iBAAiB;IAU5B,YAAY,IAAY;QATxB,SAAI,GAAW,EAAE,CAAC;QAElB,gBAAW,GAAyB,EAAE,CAAC;QAEvC,aAAQ,GAA+B;YACrC,MAAM,EAAE,EAAE;YACV,SAAS,EAAE,EAAE;SACd,CAAC;QAGA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,KAAa,EAAE,KAAa;;QAChC,MAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,0CAAE,IAAI,CAAC;YACzB,IAAI,EAAE,KAAK;YACX,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,GAAW,EAAE,IAAa,EAAE,IAAa;;QAC5C,MAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,0CAAE,IAAI,CAAC;YACxB,IAAI;YACJ,GAAG;YACH,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,KAAa,EAAE,OAA0B;;QAC/D,MAAA,IAAI,CAAC,QAAQ,CAAC,SAAS,0CAAE,IAAI,CAAC;YAC5B,IAA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,GAAW;QAC1B,MAAM,IAAI,CAAC,KAAK,CAAC,6BAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,GAAW;QAC1C,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,4BAAQ,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,GAAW;QACxC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,4BAAQ,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;CACF;AAhID,kDAgIC"}
@@ -0,0 +1,59 @@
1
+ import { Formatter } from "@cucumber/cucumber";
2
+ import { IFormatterOptions } from "@cucumber/cucumber/lib/formatter";
3
+ import { Allure, AllureRuntime } from "allure-js-commons";
4
+ export { Allure };
5
+ export declare type LabelMatcher = {
6
+ pattern: RegExp[];
7
+ name: "epic" | "severity" | string;
8
+ };
9
+ export declare type LinkMatcher = {
10
+ pattern: RegExp[];
11
+ urlTemplate: string;
12
+ type: "tms" | "issue" | string;
13
+ };
14
+ export declare class CucumberJSAllureFormatterConfig {
15
+ exceptionFormatter?: (message: string) => string;
16
+ labels?: LabelMatcher[];
17
+ links?: LinkMatcher[];
18
+ }
19
+ export declare class CucumberJSAllureFormatter extends Formatter {
20
+ private readonly allureRuntime;
21
+ private readonly currentTestsMap;
22
+ private readonly hostname;
23
+ private readonly afterHooks;
24
+ private readonly beforeHooks;
25
+ private readonly exceptionFormatter;
26
+ private readonly labelsMathers;
27
+ private readonly linksMatchers;
28
+ private readonly documentMap;
29
+ private readonly scenarioMap;
30
+ private readonly stepMap;
31
+ private readonly testStepMap;
32
+ private readonly pickleStepMap;
33
+ private readonly testCaseTestStepsResults;
34
+ private readonly pickleMap;
35
+ private readonly hookMap;
36
+ private readonly sourceMap;
37
+ private readonly testCaseMap;
38
+ private readonly testCaseStartedMap;
39
+ private readonly allureSteps;
40
+ constructor(options: IFormatterOptions, allureRuntime: AllureRuntime, config: CucumberJSAllureFormatterConfig);
41
+ private get tagsIgnorePatterns();
42
+ private parseEnvelope;
43
+ private parseTagsLabels;
44
+ private parseTagsLinks;
45
+ private onGherkinDocument;
46
+ private onScenario;
47
+ private onPickle;
48
+ private onTestCase;
49
+ private onTestCaseStarted;
50
+ private onAttachment;
51
+ private handleAllureAttachment;
52
+ private handleAllureStep;
53
+ private onTestCaseFinished;
54
+ private onHook;
55
+ private onSource;
56
+ private onTestStepStarted;
57
+ private onTestStepFinished;
58
+ private convertStatus;
59
+ }