allure-codeceptjs 3.0.5 → 3.0.6

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/README.md CHANGED
@@ -12,173 +12,103 @@
12
12
 
13
13
  ---
14
14
 
15
- ## Installation
16
-
17
- ```bash
18
- npm i -D allure-codeceptjs
19
- ```
15
+ ## The documentation and examples
20
16
 
21
- ## Usage
17
+ The docs for Allure CodeceptJS are available at [https://allurereport.org/docs/codeceptjs/](https://allurereport.org/docs/codeceptjs/).
22
18
 
23
- Add the allure plugin inside you plugins section of your CodeceptJS config file.
24
- For instance the config file is `codecept.config.(js|ts)` then:
19
+ Also, check out the examples at [github.com/allure-examples](https://github.com/orgs/allure-examples/repositories?q=visibility%3Apublic+archived%3Afalse+topic%3Aexample+topic%3Acodeceptjs).
25
20
 
26
- ```js
27
- module.exports.config = {
28
- plugins: {
29
- // ...
30
- allure: {
31
- enabled: true,
32
- require: "allure-codeceptjs",
33
- },
34
- // ...
35
- }
36
- };
37
- ```
38
-
39
- ## Allure Runtime API usage
21
+ ## Installation
40
22
 
41
- Right now you can access allure API through codeceptjs container.
23
+ Install `allure-codeceptjs` using a package manager of your choice. For example:
42
24
 
43
- ```js
44
- import { label, tag, tags, issue, owner, layer, allureId, description, story, feature, epic, attachment } from "allure-js-commons";
45
-
46
- Feature("login-feature");
47
- Scenario("login-scenario1", async () => {
48
- await label("name", "value");
49
- await tag("tag1");
50
- await tags("tag2", "tag3");
51
- await issue("issueName", "google.com");
52
- await owner("eroshenkoam");
53
- await layer("UI");
54
- await allureId("228");
55
- await description("aga");
56
- await story("aga");
57
- await feature("aga");
58
- await epic("aga");
59
- await attachment("data.txt", "some data", "text/plain");
60
- });
25
+ ```bash
26
+ npm install -D allure-codeceptjs
61
27
  ```
62
28
 
63
- You can also use tags to manage labels on scenarios.
29
+ ## Usage
64
30
 
65
- ## Links usage
31
+ Enable the `allure` plugin in [the CodeceptJS configuration file](https://codecept.io/configuration/):
66
32
 
67
33
  ```js
68
- import { link, issue, tms } from "allure-js-commons";
69
-
70
- Feature("login-feature");
71
- Scenario("login-scenario1", async () => {
72
- await link("link_type", "https://allurereport.org", "Allure Report");
73
- await issue("Issue Name", "https://github.com/allure-framework/allure-js/issues/352");
74
- await tms("Task Name", "https://github.com/allure-framework/allure-js/tasks/352");
75
- });
76
- ```
77
-
78
- You can also configure links formatters to make usage much more convenient. `%s`
79
- in `urlTemplate` parameter will be replaced by given value.
80
-
81
- ```diff
82
34
  module.exports.config = {
83
- // ...
84
35
  plugins: {
85
36
  allure: {
86
37
  enabled: true,
87
38
  require: "allure-codeceptjs",
88
- + links: [
89
- + {
90
- + type: "${LinkType.ISSUE}",
91
- + urlTemplate: "https://example.org/issues/%s",
92
- + nameTemplate: "Issue: %s",
93
- + },
94
- + {
95
- + type: "${LinkType.TMS}",
96
- + urlTemplate: "https://example.org/tasks/%s",
97
- + }
98
- + ]
99
39
  },
40
+
41
+ // Other plugins...
100
42
  },
101
- // ...
43
+
44
+ // Other CodeceptJS options...
102
45
  };
103
46
  ```
104
47
 
105
- Then you can assign link using shorter notation:
48
+ When the test run completes, the result files will be generated in the `./allure-results` directory.
106
49
 
107
- ```js
108
- import { link, issue, tms } from "allure-js-commons";
109
-
110
- Feature("login-feature");
111
- Scenario("login-scenario1", async () => {
112
- await issue("351");
113
- await issue("352", "Issue Name");
114
- await tms("351");
115
- await tms("352", "Task Name");
116
- await link("custom", "352");
117
- await link("custom", "352", "Link name");
118
- });
119
- ```
50
+ You may select another location, or further customize the plugin's behavior with [the configuration options](https://allurereport.org/docs/codeceptjs-configuration/).
120
51
 
121
- ## Tags metadata API
52
+ ### View the report
122
53
 
123
- You also can mark up your tests with Allure metadata using CodeceptJS tags API.
54
+ > You need Allure Report to be installed on your machine to generate and open the report from the result files. See the [installation instructions](https://allurereport.org/docs/install/) on how to get it.
124
55
 
125
- ### Id
126
-
127
- ```javascript
128
- Feature("login-feature");
129
- Scenario("login-scenario1", async () => {
130
- // your test
131
- }).tag("@allure.id:228");
132
- ```
56
+ Generate Allure Report after the tests are executed:
133
57
 
134
- ### Label
135
-
136
- ```javascript
137
- Feature("login-feature");
138
- Scenario("login-scenario1", async () => {
139
- // your test
140
- }).tag("@allure.label.{{labelName}}:{{labelValue}}");
58
+ ```bash
59
+ allure generate ./allure-results -o ./allure-report
141
60
  ```
142
61
 
143
- ### Story
62
+ Open the generated report:
144
63
 
145
- ```javascript
146
- Feature("login-feature");
147
- Scenario("login-scenario1", async () => {
148
- // your test
149
- }).tag("@allure.label.story:storyName");
150
- ```
151
- ### Suite
152
-
153
- ```javascript
154
- Feature("login-feature");
155
- Scenario("login-scenario1", async () => {
156
- // your test
157
- }).tag("@allure.label.suite:suiteName");
64
+ ```bash
65
+ allure open ./allure-report
158
66
  ```
159
67
 
160
- ### Owner
68
+ ## Allure API
161
69
 
162
- ```javascript
163
- Feature("login-feature");
164
- Scenario("login-scenario1", async () => {
165
- // your test
166
- }).tag("@allure.label.owner:ownerName");
167
- ```
168
-
169
- ### Tag
70
+ Enhance the report by utilizing the Allure API:
170
71
 
171
- ```javascript
172
- Feature("login-feature");
173
- Scenario("login-scenario1", async () => {
174
- // your test
175
- }).tag("@allure.label.tag:tagName");
72
+ ```js
73
+ import * as allure from "allure-js-commons";
74
+
75
+ Feature("Signing in with a password");
76
+ Scenario("Signing in with a correct password", async () => {
77
+ await allure.description("The test checks if an active user with a valid password can sign in to the app.");
78
+ await allure.epic("Signing in");
79
+ await allure.tags("signin", "ui", "positive");
80
+ await allure.issue("https://github.com/allure-framework/allure-js/issues/673", "ISSUE-673");
81
+ await allure.owner("eroshenkoam");
82
+ await allure.parameter("browser", "chrome");
83
+
84
+ const user = await allure.step("Prepare the user", async () => {
85
+ return await createAnActiveUserInDb();
86
+ });
87
+
88
+ await allure.step("Make a sign-in attempt", async () => {
89
+ await allure.step("Navigate to the sign-in page", async () => {
90
+ // ...
91
+ });
92
+
93
+ await allure.step("Fill the sign-in form", async (stepContext) => {
94
+ await stepContext.parameter("login", user.login);
95
+ await stepContext.parameter("password", user.password, "masked");
96
+
97
+ // ...
98
+ });
99
+
100
+ await allure.step("Submit the form", async () => {
101
+ // ...
102
+ // const responseData = ...
103
+
104
+ await allure.attachment("response", JSON.stringify(responseData), { contentType: "application/json" });
105
+ });
106
+ });
107
+
108
+ await allure.step("Assert the signed-in state", async () => {
109
+ // ...
110
+ });
111
+ });
176
112
  ```
177
- or keep it simple:
178
113
 
179
- ```javascript
180
- Feature("login-feature");
181
- Scenario("login-scenario1", async () => {
182
- // your test
183
- }).tag("tagName");
184
- ```
114
+ More details about the API are available at [https://allurereport.org/docs/codeceptjs-reference/](https://allurereport.org/docs/codeceptjs-reference/).
package/dist/cjs/index.js CHANGED
@@ -15,7 +15,15 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
15
15
  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); }
16
16
  var allurePlugin = config => {
17
17
  var mocha = _codeceptjs.container.mocha();
18
- mocha.reporter(_reporter.AllureCodeceptJsReporter.prototype.constructor, _objectSpread({}, config));
18
+
19
+ // At this point the configured reporter's constructor has been initialized and is available via the _reporter field.
20
+ // See https://github.com/mochajs/mocha/blob/05097db4f2e0118f033978b8503aec36b1867c55/lib/mocha.js#L352
21
+ // The field is not public but there is no other option to get the constructor; this is covered by tests in reporters.test.ts.
22
+ // eslint-disable-next-line no-underscore-dangle
23
+ var currentReporter = mocha._reporter;
24
+ mocha.reporter(_reporter.AllureCodeceptJsReporter.prototype.constructor, _objectSpread(_objectSpread({}, config), currentReporter ? {
25
+ extraReporters: [currentReporter, mocha.options.reporterOptions]
26
+ } : {}));
19
27
  return _objectSpread(_objectSpread({}, _legacy.allureCodeceptJsLegacyApi), {}, {
20
28
  // this method is used by various bundled codeceptjs plugins, e.g. by screenshotOnFail
21
29
  addAttachment: (name, content, contentType) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_codeceptjs","require","_allureJsCommons","_legacy","_reporter","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","allurePlugin","config","mocha","container","reporter","AllureCodeceptJsReporter","prototype","constructor","allureCodeceptJsLegacyApi","addAttachment","name","content","contentType","attachment","_default","exports","default","module"],"sources":["../../src/index.ts"],"sourcesContent":["import { container } from \"codeceptjs\";\nimport { attachment } from \"allure-js-commons\";\nimport type { ReporterConfig } from \"allure-js-commons/sdk/reporter\";\nimport { allureCodeceptJsLegacyApi } from \"./legacy.js\";\nimport { AllureCodeceptJsReporter } from \"./reporter.js\";\n\nconst allurePlugin = (config: ReporterConfig) => {\n const mocha = container.mocha();\n mocha.reporter(AllureCodeceptJsReporter.prototype.constructor, { ...config });\n\n return {\n ...allureCodeceptJsLegacyApi,\n // this method is used by various bundled codeceptjs plugins, e.g. by screenshotOnFail\n addAttachment: (name: string, content: Buffer | string, contentType: string) => {\n // wrap it in attachmentStep. Since we use Mocha, Runtime API is sync, so no awaits is fine\n attachment(name, content, contentType);\n },\n };\n};\n\nexport default allurePlugin;\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAAyD,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GA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,SAAAC,aAAAvB,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAwB,MAAA,CAAAC,WAAA,kBAAA3B,CAAA,QAAAwB,CAAA,GAAAxB,CAAA,CAAA4B,IAAA,CAAA1B,CAAA,EAAAD,CAAA,uCAAAuB,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAA5B,CAAA,GAAA6B,MAAA,GAAAC,MAAA,EAAA7B,CAAA;AAEzD,IAAM8B,YAAY,GAAIC,MAAsB,IAAK;EAC/C,IAAMC,KAAK,GAAGC,qBAAS,CAACD,KAAK,CAAC,CAAC;EAC/BA,KAAK,CAACE,QAAQ,CAACC,kCAAwB,CAACC,SAAS,CAACC,WAAW,EAAA3B,aAAA,KAAOqB,MAAM,CAAE,CAAC;EAE7E,OAAArB,aAAA,CAAAA,aAAA,KACK4B,iCAAyB;IAC5B;IACAC,aAAa,EAAEA,CAACC,IAAY,EAAEC,OAAwB,EAAEC,WAAmB,KAAK;MAC9E;MACA,IAAAC,2BAAU,EAACH,IAAI,EAAEC,OAAO,EAAEC,WAAW,CAAC;IACxC;EAAC;AAEL,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEahB,YAAY;AAAAiB,MAAA,CAAAF,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_codeceptjs","require","_allureJsCommons","_legacy","_reporter","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","allurePlugin","config","mocha","container","currentReporter","reporter","AllureCodeceptJsReporter","prototype","constructor","extraReporters","options","reporterOptions","allureCodeceptJsLegacyApi","addAttachment","name","content","contentType","attachment","_default","exports","default","module"],"sources":["../../src/index.ts"],"sourcesContent":["import { container } from \"codeceptjs\";\nimport { attachment } from \"allure-js-commons\";\nimport type { ReporterConfig } from \"allure-js-commons/sdk/reporter\";\nimport { allureCodeceptJsLegacyApi } from \"./legacy.js\";\nimport { AllureCodeceptJsReporter } from \"./reporter.js\";\n\nconst allurePlugin = (config: ReporterConfig) => {\n const mocha = container.mocha();\n\n // At this point the configured reporter's constructor has been initialized and is available via the _reporter field.\n // See https://github.com/mochajs/mocha/blob/05097db4f2e0118f033978b8503aec36b1867c55/lib/mocha.js#L352\n // The field is not public but there is no other option to get the constructor; this is covered by tests in reporters.test.ts.\n // eslint-disable-next-line no-underscore-dangle\n const currentReporter = mocha._reporter;\n mocha.reporter(AllureCodeceptJsReporter.prototype.constructor, {\n ...config,\n ...(currentReporter ? { extraReporters: [currentReporter, mocha.options.reporterOptions] } : {}),\n });\n\n return {\n ...allureCodeceptJsLegacyApi,\n // this method is used by various bundled codeceptjs plugins, e.g. by screenshotOnFail\n addAttachment: (name: string, content: Buffer | string, contentType: string) => {\n // wrap it in attachmentStep. Since we use Mocha, Runtime API is sync, so no awaits is fine\n attachment(name, content, contentType);\n },\n };\n};\n\nexport default allurePlugin;\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAAyD,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAA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AA,QAAAwB,CAAA,GAAAxB,CAAA,CAAA4B,IAAA,CAAA1B,CAAA,EAAAD,CAAA,uCAAAuB,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAA5B,CAAA,GAAA6B,MAAA,GAAAC,MAAA,EAAA7B,CAAA;AAEzD,IAAM8B,YAAY,GAAIC,MAAsB,IAAK;EAC/C,IAAMC,KAAK,GAAGC,qBAAS,CAACD,KAAK,CAAC,CAAC;;EAE/B;EACA;EACA;EACA;EACA,IAAME,eAAe,GAAGF,KAAK,CAACpC,SAAS;EACvCoC,KAAK,CAACG,QAAQ,CAACC,kCAAwB,CAACC,SAAS,CAACC,WAAW,EAAA5B,aAAA,CAAAA,aAAA,KACxDqB,MAAM,GACLG,eAAe,GAAG;IAAEK,cAAc,EAAE,CAACL,eAAe,EAAEF,KAAK,CAACQ,OAAO,CAACC,eAAe;EAAE,CAAC,GAAG,CAAC,CAAC,CAChG,CAAC;EAEF,OAAA/B,aAAA,CAAAA,aAAA,KACKgC,iCAAyB;IAC5B;IACAC,aAAa,EAAEA,CAACC,IAAY,EAAEC,OAAwB,EAAEC,WAAmB,KAAK;MAC9E;MACA,IAAAC,2BAAU,EAACH,IAAI,EAAEC,OAAO,EAAEC,WAAW,CAAC;IACxC;EAAC;AAEL,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEapB,YAAY;AAAAqB,MAAA,CAAAF,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
package/dist/esm/index.js CHANGED
@@ -9,7 +9,15 @@ import { allureCodeceptJsLegacyApi } from "./legacy.js";
9
9
  import { AllureCodeceptJsReporter } from "./reporter.js";
10
10
  var allurePlugin = config => {
11
11
  var mocha = container.mocha();
12
- mocha.reporter(AllureCodeceptJsReporter.prototype.constructor, _objectSpread({}, config));
12
+
13
+ // At this point the configured reporter's constructor has been initialized and is available via the _reporter field.
14
+ // See https://github.com/mochajs/mocha/blob/05097db4f2e0118f033978b8503aec36b1867c55/lib/mocha.js#L352
15
+ // The field is not public but there is no other option to get the constructor; this is covered by tests in reporters.test.ts.
16
+ // eslint-disable-next-line no-underscore-dangle
17
+ var currentReporter = mocha._reporter;
18
+ mocha.reporter(AllureCodeceptJsReporter.prototype.constructor, _objectSpread(_objectSpread({}, config), currentReporter ? {
19
+ extraReporters: [currentReporter, mocha.options.reporterOptions]
20
+ } : {}));
13
21
  return _objectSpread(_objectSpread({}, allureCodeceptJsLegacyApi), {}, {
14
22
  // this method is used by various bundled codeceptjs plugins, e.g. by screenshotOnFail
15
23
  addAttachment: (name, content, contentType) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["container","attachment","allureCodeceptJsLegacyApi","AllureCodeceptJsReporter","allurePlugin","config","mocha","reporter","prototype","constructor","_objectSpread","addAttachment","name","content","contentType"],"sources":["../../src/index.ts"],"sourcesContent":["import { container } from \"codeceptjs\";\nimport { attachment } from \"allure-js-commons\";\nimport type { ReporterConfig } from \"allure-js-commons/sdk/reporter\";\nimport { allureCodeceptJsLegacyApi } from \"./legacy.js\";\nimport { AllureCodeceptJsReporter } from \"./reporter.js\";\n\nconst allurePlugin = (config: ReporterConfig) => {\n const mocha = container.mocha();\n mocha.reporter(AllureCodeceptJsReporter.prototype.constructor, { ...config });\n\n return {\n ...allureCodeceptJsLegacyApi,\n // this method is used by various bundled codeceptjs plugins, e.g. by screenshotOnFail\n addAttachment: (name: string, content: Buffer | string, contentType: string) => {\n // wrap it in attachmentStep. Since we use Mocha, Runtime API is sync, so no awaits is fine\n attachment(name, content, contentType);\n },\n };\n};\n\nexport default allurePlugin;\n"],"mappings":";;;;;AAAA,SAASA,SAAS,QAAQ,YAAY;AACtC,SAASC,UAAU,QAAQ,mBAAmB;AAE9C,SAASC,yBAAyB,QAAQ,aAAa;AACvD,SAASC,wBAAwB,QAAQ,eAAe;AAExD,IAAMC,YAAY,GAAIC,MAAsB,IAAK;EAC/C,IAAMC,KAAK,GAAGN,SAAS,CAACM,KAAK,CAAC,CAAC;EAC/BA,KAAK,CAACC,QAAQ,CAACJ,wBAAwB,CAACK,SAAS,CAACC,WAAW,EAAAC,aAAA,KAAOL,MAAM,CAAE,CAAC;EAE7E,OAAAK,aAAA,CAAAA,aAAA,KACKR,yBAAyB;IAC5B;IACAS,aAAa,EAAEA,CAACC,IAAY,EAAEC,OAAwB,EAAEC,WAAmB,KAAK;MAC9E;MACAb,UAAU,CAACW,IAAI,EAAEC,OAAO,EAAEC,WAAW,CAAC;IACxC;EAAC;AAEL,CAAC;AAED,eAAeV,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["container","attachment","allureCodeceptJsLegacyApi","AllureCodeceptJsReporter","allurePlugin","config","mocha","currentReporter","_reporter","reporter","prototype","constructor","_objectSpread","extraReporters","options","reporterOptions","addAttachment","name","content","contentType"],"sources":["../../src/index.ts"],"sourcesContent":["import { container } from \"codeceptjs\";\nimport { attachment } from \"allure-js-commons\";\nimport type { ReporterConfig } from \"allure-js-commons/sdk/reporter\";\nimport { allureCodeceptJsLegacyApi } from \"./legacy.js\";\nimport { AllureCodeceptJsReporter } from \"./reporter.js\";\n\nconst allurePlugin = (config: ReporterConfig) => {\n const mocha = container.mocha();\n\n // At this point the configured reporter's constructor has been initialized and is available via the _reporter field.\n // See https://github.com/mochajs/mocha/blob/05097db4f2e0118f033978b8503aec36b1867c55/lib/mocha.js#L352\n // The field is not public but there is no other option to get the constructor; this is covered by tests in reporters.test.ts.\n // eslint-disable-next-line no-underscore-dangle\n const currentReporter = mocha._reporter;\n mocha.reporter(AllureCodeceptJsReporter.prototype.constructor, {\n ...config,\n ...(currentReporter ? { extraReporters: [currentReporter, mocha.options.reporterOptions] } : {}),\n });\n\n return {\n ...allureCodeceptJsLegacyApi,\n // this method is used by various bundled codeceptjs plugins, e.g. by screenshotOnFail\n addAttachment: (name: string, content: Buffer | string, contentType: string) => {\n // wrap it in attachmentStep. Since we use Mocha, Runtime API is sync, so no awaits is fine\n attachment(name, content, contentType);\n },\n };\n};\n\nexport default allurePlugin;\n"],"mappings":";;;;;AAAA,SAASA,SAAS,QAAQ,YAAY;AACtC,SAASC,UAAU,QAAQ,mBAAmB;AAE9C,SAASC,yBAAyB,QAAQ,aAAa;AACvD,SAASC,wBAAwB,QAAQ,eAAe;AAExD,IAAMC,YAAY,GAAIC,MAAsB,IAAK;EAC/C,IAAMC,KAAK,GAAGN,SAAS,CAACM,KAAK,CAAC,CAAC;;EAE/B;EACA;EACA;EACA;EACA,IAAMC,eAAe,GAAGD,KAAK,CAACE,SAAS;EACvCF,KAAK,CAACG,QAAQ,CAACN,wBAAwB,CAACO,SAAS,CAACC,WAAW,EAAAC,aAAA,CAAAA,aAAA,KACxDP,MAAM,GACLE,eAAe,GAAG;IAAEM,cAAc,EAAE,CAACN,eAAe,EAAED,KAAK,CAACQ,OAAO,CAACC,eAAe;EAAE,CAAC,GAAG,CAAC,CAAC,CAChG,CAAC;EAEF,OAAAH,aAAA,CAAAA,aAAA,KACKV,yBAAyB;IAC5B;IACAc,aAAa,EAAEA,CAACC,IAAY,EAAEC,OAAwB,EAAEC,WAAmB,KAAK;MAC9E;MACAlB,UAAU,CAACgB,IAAI,EAAEC,OAAO,EAAEC,WAAW,CAAC;IACxC;EAAC;AAEL,CAAC;AAED,eAAef,YAAY","ignoreList":[]}
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "allure-codeceptjs",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "Allure codeceptjs integration",
5
5
  "keywords": [
6
+ "allure",
6
7
  "codeceptjs",
7
- "allure"
8
+ "html",
9
+ "test",
10
+ "report",
11
+ "reporter",
12
+ "testing",
13
+ "testops"
8
14
  ],
9
15
  "homepage": "https://allurereport.org/",
10
16
  "repository": {
@@ -40,8 +46,8 @@
40
46
  "test": "vitest run"
41
47
  },
42
48
  "dependencies": {
43
- "allure-js-commons": "3.0.5",
44
- "allure-mocha": "3.0.5"
49
+ "allure-js-commons": "3.0.6",
50
+ "allure-mocha": "3.0.6"
45
51
  },
46
52
  "devDependencies": {
47
53
  "@babel/cli": "^7.24.6",
@@ -60,7 +66,7 @@
60
66
  "@typescript-eslint/eslint-plugin": "^8.0.0",
61
67
  "@typescript-eslint/parser": "^8.0.0",
62
68
  "allure-commandline": "^2.29.0",
63
- "allure-vitest": "3.0.5",
69
+ "allure-vitest": "3.0.6",
64
70
  "babel-plugin-add-module-exports": "^1.0.4",
65
71
  "codeceptjs": "^3.5.4",
66
72
  "eslint": "^8.57.0",
@@ -70,7 +76,7 @@
70
76
  "eslint-plugin-n": "^17.10.1",
71
77
  "eslint-plugin-no-null": "^1.0.2",
72
78
  "eslint-plugin-prefer-arrow": "^1.2.3",
73
- "npm-run-all2": "^6.1.2",
79
+ "npm-run-all2": "^7.0.0",
74
80
  "rimraf": "^6.0.0",
75
81
  "typescript": "^5.2.2",
76
82
  "vitest": "^1.6.0"