allure-cucumberjs 2.0.0-beta.9 → 2.0.0

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 (43) hide show
  1. package/LICENSE.txt +1 -1
  2. package/README.md +188 -48
  3. package/dist/index.d.ts +2 -1
  4. package/dist/index.js +3 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/src/CucumberAllureWorld.d.ts +25 -0
  7. package/dist/src/CucumberAllureWorld.js +102 -0
  8. package/dist/src/CucumberAllureWorld.js.map +1 -0
  9. package/dist/src/CucumberJSAllureReporter.d.ts +52 -67
  10. package/dist/src/CucumberJSAllureReporter.js +344 -222
  11. package/dist/src/CucumberJSAllureReporter.js.map +1 -1
  12. package/package.json +39 -28
  13. package/dist/src/CucumberAllureInterface.d.ts +0 -24
  14. package/dist/src/CucumberAllureInterface.js +0 -89
  15. package/dist/src/CucumberAllureInterface.js.map +0 -1
  16. package/dist/src/events/Example.d.ts +0 -8
  17. package/dist/src/events/Example.js +0 -26
  18. package/dist/src/events/Example.js.map +0 -1
  19. package/dist/src/events/GherkinDocument.d.ts +0 -17
  20. package/dist/src/events/GherkinDocument.js +0 -10
  21. package/dist/src/events/GherkinDocument.js.map +0 -1
  22. package/dist/src/events/GherkinExample.d.ts +0 -15
  23. package/dist/src/events/GherkinExample.js +0 -7
  24. package/dist/src/events/GherkinExample.js.map +0 -1
  25. package/dist/src/events/GherkinStep.d.ts +0 -17
  26. package/dist/src/events/GherkinStep.js +0 -7
  27. package/dist/src/events/GherkinStep.js.map +0 -1
  28. package/dist/src/events/GherkinTestCase.d.ts +0 -18
  29. package/dist/src/events/GherkinTestCase.js +0 -11
  30. package/dist/src/events/GherkinTestCase.js.map +0 -1
  31. package/dist/src/events/Result.d.ts +0 -5
  32. package/dist/src/events/Result.js +0 -7
  33. package/dist/src/events/Result.js.map +0 -1
  34. package/dist/src/events/SourceLocation.d.ts +0 -11
  35. package/dist/src/events/SourceLocation.js +0 -10
  36. package/dist/src/events/SourceLocation.js.map +0 -1
  37. package/dist/src/events/TestHookDefinition.d.ts +0 -8
  38. package/dist/src/events/TestHookDefinition.js +0 -3
  39. package/dist/src/events/TestHookDefinition.js.map +0 -1
  40. package/dist/src/utilities.d.ts +0 -7
  41. package/dist/src/utilities.js +0 -50
  42. package/dist/src/utilities.js.map +0 -1
  43. package/package-lock.json +0 -14
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 2019 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,70 +1,210 @@
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
- super(
13
- options,
14
- new AllureRuntime({ resultsDir: "./out/allure-results" }),
15
- {
16
- labels: {
17
- issue: [/@bug_(.*)/],
18
- epic: [/@feature:(.*)/]
19
- }
20
- }
21
- );
27
+ super(options, new AllureRuntime({ resultsDir: "./allure-results" }), {
28
+ labels: [
29
+ {
30
+ pattern: [/@feature:(.*)/],
31
+ name: "epic",
32
+ },
33
+ {
34
+ pattern: [/@severity:(.*)/],
35
+ name: "severity",
36
+ },
37
+ ],
38
+ links: [
39
+ {
40
+ pattern: [/@issue=(.*)/],
41
+ type: "issue",
42
+ urlTemplate: "http://localhost:8080/issue/%s",
43
+ },
44
+ {
45
+ pattern: [/@tms=(.*)/],
46
+ type: "tms",
47
+ urlTemplate: "http://localhost:8080/tms/%s",
48
+ },
49
+ ],
50
+ });
22
51
  }
23
52
  }
24
53
  ```
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:
54
+
55
+ Then let know `cucumber-js` about the reporter via CLI parameter:
56
+
57
+ ```shell
58
+ cucumber-js --format ./path/to/reporter.js
33
59
  ```
34
- node cucumber.js --format ./path/to/Reporter.js
60
+
61
+ Or via configuration file:
62
+
63
+ ```js
64
+ // config.js
65
+ module.exports = {
66
+ default: {
67
+ format: "./path/to/reporter.js",
68
+ },
69
+ };
70
+ ```
71
+
72
+ And then run CLI with `config` parameter:
73
+
74
+ ```shell
75
+ cucumber-js --config ./config.js
35
76
  ```
77
+
36
78
  If you want to retain default formatter add some dummy file as output:
79
+
80
+ ```shell
81
+ cucumber-js --format ./path/to/reporter.js:./dummy.txt
37
82
  ```
38
- node cucumber.js --format ./path/to/Reporter.js:./dummy.txt
83
+
84
+ ## Using Allure API
85
+
86
+ You're able to call Allure API methods injected to the `World` object by the reporter.
87
+ By default, the feature is available out of the box for single thread mode.
88
+
89
+ Example:
90
+
91
+ ```js
92
+ import { Given } from "@cucumber/cucumber";
93
+
94
+ Given(/my step/, async function () {
95
+ await this.step("step can have anonymous body function", async function () {
96
+ await this.label("label_name", "label_value");
97
+ await this.attach(JSON.stringify({ foo: "bar " }), "application/json");
98
+ });
99
+
100
+ await this.step("by the way, body function can be arrow one", async (step) => {
101
+ await step.label("label_name", "label_value");
102
+ await step.attach(JSON.stringify({ foo: "bar " }), "application/json");
103
+ });
104
+ });
39
105
  ```
40
106
 
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
- const { CucumberJSAllureFormatter } = require("allure-cucumberjs");
45
- const { AllureRuntime } = require("allure-cucumberjs");
46
-
47
- function Reporter(options) {
48
- return new CucumberJSAllureFormatter(
49
- options,
50
- new AllureRuntime({ resultsDir: "./allure-results" }),
51
- {}
52
- );
107
+ If you want to keep the functoinality in `parallel` mode, set `CucumberAllureWorld` as
108
+ world constructor:
109
+
110
+ ```diff
111
+ - import { Given } from "@cucumber/cucumber"
112
+ + import { Given, setWorldConstructor } from "@cucumber/cucumber"
113
+ + import { CucumberAllureWorld } from "allure-cucumberjs"
114
+
115
+ + setWorldConstructor(CucumberAllureWorld)
116
+
117
+ Given(/my step/, async function () {
118
+ await this.step("step can have anonymous body function", async function () {
119
+ await this.label("label_name", "label_value")
120
+ await this.attach(JSON.stringify({ foo: "bar "}), "application/json")
121
+ })
122
+
123
+ await this.step("by the way, body function can be arrow one", async (step) => {
124
+ await step.label("label_name", "label_value")
125
+ await step.attach(JSON.stringify({ foo: "bar "}), "application/json")
126
+ })
127
+ })
128
+ ```
129
+
130
+ Follow the same approach when you need to use your own `World` implementation. Just extend it from
131
+ `CucumberAllureWorld`:
132
+
133
+ ```diff
134
+ - import { Given } from "@cucumber/cucumber"
135
+ + import { Given, setWorldConstructor } from "@cucumber/cucumber"
136
+ + import { CucumberAllureWorld } from "allure-cucumberjs"
137
+
138
+ + class MyWorld extends CucumberAllureWorld {
139
+ + hello() {
140
+ + console.log('say hello!')
141
+ + }
142
+ + }
143
+
144
+ + setWorldConstructor(MyWorld)
145
+
146
+ Given(/my step/, async function () {
147
+ + this.hello()
148
+
149
+ await this.step("step can have anonymous body function", async function () {
150
+ await this.label("label_name", "label_value")
151
+ await this.attach(JSON.stringify({ foo: "bar "}), "application/json")
152
+ })
153
+
154
+ await this.step("by the way, body function can be arrow one", async (step) => {
155
+ await step.label("label_name", "label_value")
156
+ await step.attach(JSON.stringify({ foo: "bar "}), "application/json")
157
+ })
158
+ })
159
+ ```
160
+
161
+ ## TypeScript
162
+
163
+ To properly type your cucumber tests you need to declare `CustomWorld` type and use it.
164
+
165
+ ```ts
166
+ import { Given } from "@cucumber/cucumber";
167
+ import { CucumberAllureWorld } from "allure-cucumberjs";
168
+
169
+ if (process.env.PARALLEL) {
170
+ setWorldConstructor(CucumberAllureWorld);
53
171
  }
54
- Reporter.prototype = Object.create(CucumberJSAllureFormatter.prototype);
55
- Reporter.prototype.constructor = Reporter;
56
172
 
57
- exports.default = Reporter;
173
+ type CustomWorld = {
174
+ someCustomOptions: string;
175
+ } & CucumberAllureWorld;
176
+
177
+ Given("A cat fact is recieved", async function (this: CustomWorld) {
178
+ await this.step("example name", async () => {
179
+ await this.label("test label", "value");
180
+ });
181
+ });
58
182
  ```
59
183
 
60
- ### API
61
- Instance of AllureInterface will be added to World prototype.
62
- You can use it for creating nested steps and adding info to the report.
184
+ ### Parameters usage
63
185
 
64
- ### Author
186
+ ```ts
187
+ import { Given } from "@cucumber/cucumber";
65
188
 
66
- Ilya Korobitsyn <mail@korobochka.org>
189
+ Given(/my step/, async function () {
190
+ await this.step("step can have anonymous body function", async function () {
191
+ await this.parameter("parameterName", "parameterValue");
192
+ });
193
+ });
194
+ ```
195
+
196
+ Also addParameter takes an third optional parameter with the hidden and excluded options:
197
+
198
+ `mode: "hidden" | "masked"` - `masked` hide parameter value to secure sensitive data, and `hidden` entirely hide parameter from report
67
199
 
68
- #### Contributors
200
+ `excluded: true` - excludes parameter from the history
69
201
 
70
- * Claudia Hardman <claudia.hardman@mattel.com>
202
+ ```ts
203
+ import { Given } from "@cucumber/cucumber";
204
+
205
+ Given(/my step/, async function () {
206
+ await this.step("step can have anonymous body function", async function () {
207
+ await this.parameter("parameterName", "parameterValue", { mode: "hidden", excluded: true });
208
+ });
209
+ });
210
+ ```
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export { Allure, World, CucumberJSAllureFormatter, CucumberJSAllureFormatterConfig } from "./src/CucumberJSAllureReporter";
1
+ export { Allure, CucumberJSAllureFormatter, CucumberJSAllureFormatterConfig } from "./src/CucumberJSAllureReporter";
2
+ export { CucumberAllureWorld } from "./src/CucumberAllureWorld";
2
3
  export { AllureRuntime, AllureConfig, ContentType, Severity, ExecutorInfo, Category } from "allure-js-commons";
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Severity = exports.ContentType = exports.AllureConfig = exports.AllureRuntime = exports.CucumberJSAllureFormatterConfig = exports.CucumberJSAllureFormatter = exports.Allure = void 0;
3
+ exports.Severity = exports.ContentType = exports.AllureRuntime = exports.CucumberAllureWorld = exports.CucumberJSAllureFormatterConfig = exports.CucumberJSAllureFormatter = exports.Allure = void 0;
4
4
  var CucumberJSAllureReporter_1 = require("./src/CucumberJSAllureReporter");
5
5
  Object.defineProperty(exports, "Allure", { enumerable: true, get: function () { return CucumberJSAllureReporter_1.Allure; } });
6
6
  Object.defineProperty(exports, "CucumberJSAllureFormatter", { enumerable: true, get: function () { return CucumberJSAllureReporter_1.CucumberJSAllureFormatter; } });
7
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; } });
8
10
  var allure_js_commons_1 = require("allure-js-commons");
9
11
  Object.defineProperty(exports, "AllureRuntime", { enumerable: true, get: function () { return allure_js_commons_1.AllureRuntime; } });
10
- Object.defineProperty(exports, "AllureConfig", { enumerable: true, get: function () { return allure_js_commons_1.AllureConfig; } });
11
12
  Object.defineProperty(exports, "ContentType", { enumerable: true, get: function () { return allure_js_commons_1.ContentType; } });
12
13
  Object.defineProperty(exports, "Severity", { enumerable: true, get: function () { return allure_js_commons_1.Severity; } });
13
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,kHAAA,MAAM,OAAA;AAAS,qIAAA,yBAAyB,OAAA;AAAE,2IAAA,+BAA+B,OAAA;AAG3E,uDAE2B;AADzB,kHAAA,aAAa,OAAA;AAAE,iHAAA,YAAY,OAAA;AAAE,gHAAA,WAAW,OAAA;AAAE,6GAAA,QAAQ,OAAA"}
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,25 @@
1
+ import { World } from "@cucumber/cucumber";
2
+ import { AllureCommandStep, ParameterOptions, StepBodyFunction } from "allure-js-commons";
3
+ declare type AllureWorld = Omit<AllureCommandStep, "attach" | "name" | "attachments" | "metadata">;
4
+ export declare class CucumberAllureWorld extends World implements AllureWorld {
5
+ label(label: string, value: string): Promise<void>;
6
+ link(url: string, name?: string, type?: string): Promise<void>;
7
+ parameter(name: string, value: string, options?: ParameterOptions): Promise<void>;
8
+ description(markdown: string): Promise<void>;
9
+ descriptionHtml(html: string): Promise<void>;
10
+ step(name: string, body: StepBodyFunction): Promise<void>;
11
+ id(allureId: string): Promise<void>;
12
+ epic(epic: string): Promise<void>;
13
+ layer(layer: string): Promise<void>;
14
+ feature(feature: string): Promise<void>;
15
+ story(story: string): Promise<void>;
16
+ suite(name: string): Promise<void>;
17
+ parentSuite(name: string): Promise<void>;
18
+ subSuite(name: string): Promise<void>;
19
+ owner(owner: string): Promise<void>;
20
+ severity(severity: string): Promise<void>;
21
+ tag(tag: string): Promise<void>;
22
+ issue(name: string, url: string): Promise<void>;
23
+ tms(name: string, url: string): Promise<void>;
24
+ }
25
+ export {};
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CucumberAllureWorld = 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 CucumberAllureWorld extends cucumber_1.World {
8
+ async label(label, value) {
9
+ const msgBody = {
10
+ labels: [
11
+ {
12
+ name: label,
13
+ value,
14
+ },
15
+ ],
16
+ };
17
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
18
+ }
19
+ async link(url, name, type) {
20
+ const msgBody = {
21
+ links: [
22
+ {
23
+ name,
24
+ url,
25
+ type,
26
+ },
27
+ ],
28
+ };
29
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
30
+ }
31
+ async parameter(name, value, options) {
32
+ const msgBody = {
33
+ parameter: [
34
+ {
35
+ name,
36
+ value,
37
+ excluded: (options === null || options === void 0 ? void 0 : options.excluded) || false,
38
+ mode: options === null || options === void 0 ? void 0 : options.mode,
39
+ },
40
+ ],
41
+ };
42
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
43
+ }
44
+ async description(markdown) {
45
+ const msgBody = {
46
+ description: markdown,
47
+ };
48
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
49
+ }
50
+ async descriptionHtml(html) {
51
+ const msgBody = {
52
+ descriptionHtml: html,
53
+ };
54
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
55
+ }
56
+ async step(name, body) {
57
+ const testStep = new allure_js_commons_1.AllureCommandStepExecutable(name);
58
+ const msgBody = await testStep.start(body);
59
+ await this.attach(JSON.stringify(msgBody), internal_1.ALLURE_METADATA_CONTENT_TYPE);
60
+ }
61
+ async id(allureId) {
62
+ await this.label(allure_js_commons_1.LabelName.ALLURE_ID, allureId);
63
+ }
64
+ async epic(epic) {
65
+ await this.label(allure_js_commons_1.LabelName.EPIC, epic);
66
+ }
67
+ async layer(layer) {
68
+ await this.label(allure_js_commons_1.LabelName.LAYER, layer);
69
+ }
70
+ async feature(feature) {
71
+ await this.label(allure_js_commons_1.LabelName.FEATURE, feature);
72
+ }
73
+ async story(story) {
74
+ await this.label(allure_js_commons_1.LabelName.STORY, story);
75
+ }
76
+ async suite(name) {
77
+ await this.label(allure_js_commons_1.LabelName.SUITE, name);
78
+ }
79
+ async parentSuite(name) {
80
+ await this.label(allure_js_commons_1.LabelName.PARENT_SUITE, name);
81
+ }
82
+ async subSuite(name) {
83
+ await this.label(allure_js_commons_1.LabelName.SUB_SUITE, name);
84
+ }
85
+ async owner(owner) {
86
+ await this.label(allure_js_commons_1.LabelName.OWNER, owner);
87
+ }
88
+ async severity(severity) {
89
+ await this.label(allure_js_commons_1.LabelName.SEVERITY, severity);
90
+ }
91
+ async tag(tag) {
92
+ await this.label(allure_js_commons_1.LabelName.TAG, tag);
93
+ }
94
+ async issue(name, url) {
95
+ await this.link(url, name, allure_js_commons_1.LinkType.ISSUE);
96
+ }
97
+ async tms(name, url) {
98
+ await this.link(url, name, allure_js_commons_1.LinkType.TMS);
99
+ }
100
+ }
101
+ exports.CucumberAllureWorld = CucumberAllureWorld;
102
+ //# sourceMappingURL=CucumberAllureWorld.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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llureRuntime, AllureStep, AllureTest, AttachmentOptions, ContentType, ExecutableItemWrapper } from "allure-js-commons";
4
- import { Result } from "./events/Result";
5
- import { SourceLocation } from "./events/SourceLocation";
6
- import { GherkinDocument } from "./events/GherkinDocument";
7
- export { Allure } from "allure-js-commons";
8
- export interface World extends CucumberWorld {
9
- allure: Allure;
10
- }
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
+ };
11
14
  export declare class CucumberJSAllureFormatterConfig {
12
- labels?: {
13
- [key: string]: RegExp[];
14
- };
15
15
  exceptionFormatter?: (message: string) => string;
16
+ labels?: LabelMatcher[];
17
+ links?: LinkMatcher[];
16
18
  }
17
19
  export declare class CucumberJSAllureFormatter extends Formatter {
18
20
  private readonly allureRuntime;
19
- private readonly sourceMap;
20
- private readonly stepsMap;
21
- private readonly featureMap;
22
- private readonly labels;
23
- private readonly exceptionFormatter;
24
- private readonly beforeHooks;
21
+ private readonly currentTestsMap;
22
+ private readonly hostname;
25
23
  private readonly afterHooks;
26
- private stepStack;
27
- currentGroup: AllureGroup | null;
28
- currentTest: AllureTest | null;
29
- currentBefore: ExecutableItemWrapper | null;
30
- currentAfter: ExecutableItemWrapper | null;
31
- readonly allureInterface: Allure;
32
- constructor(options: any, allureRuntime: AllureRuntime, config: CucumberJSAllureFormatterConfig);
33
- onSource(data: {
34
- uri: string;
35
- data: string;
36
- media: {
37
- encoding: string;
38
- type: string;
39
- };
40
- }): void;
41
- onGherkinDocument(data: {
42
- uri: string;
43
- document: GherkinDocument;
44
- }): void;
45
- onTestCasePrepared(data: {
46
- steps: SourceLocation[];
47
- } & SourceLocation): void;
48
- onTestCaseStarted(data: SourceLocation): void;
49
- onTestStepStarted(data: {
50
- index: number;
51
- testCase: SourceLocation;
52
- }): void;
53
- onTestStepAttachment(data: {
54
- index: number;
55
- data: string;
56
- media: {
57
- type: string;
58
- };
59
- testCase: SourceLocation;
60
- }): void;
61
- onTestStepFinished(data: {
62
- index: number;
63
- result: Result;
64
- testCase: SourceLocation;
65
- }): void;
66
- onTestCaseFinished(data: {
67
- result: Result;
68
- } & SourceLocation): void;
69
- private setException;
70
- pushStep(step: AllureStep): void;
71
- popStep(): void;
72
- get currentStep(): AllureStep | null;
73
- writeAttachment(content: Buffer | string, options: ContentType | string | AttachmentOptions): string;
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;
74
59
  }