allure-codeceptjs 3.6.0 → 3.7.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.
package/README.md CHANGED
@@ -18,6 +18,12 @@ The docs for Allure CodeceptJS are available at [https://allurereport.org/docs/c
18
18
 
19
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).
20
20
 
21
+ ## Features
22
+
23
+ - writes standard `allure-results` files directly from CodeceptJS runs
24
+ - supports Allure labels, links, parameters, steps, and attachments through `allure-js-commons`
25
+ - works with Allure Report 2 and Allure Report 3
26
+
21
27
  ## Installation
22
28
 
23
29
  Install `allure-codeceptjs` using a package manager of your choice. For example:
@@ -26,6 +32,17 @@ Install `allure-codeceptjs` using a package manager of your choice. For example:
26
32
  npm install -D allure-codeceptjs
27
33
  ```
28
34
 
35
+ Install Allure Report separately when you want to render the generated `allure-results`:
36
+
37
+ - follow the [Allure Report 2 installation guide](https://allurereport.org/docs/install/) to use the `allure` CLI
38
+ - or install Allure Report 3 with `npm install -D allure` to use `npx allure`
39
+
40
+ ## Supported versions and platforms
41
+
42
+ - `codeceptjs >= 2.3.6`
43
+ - Linux, macOS, and Windows wherever CodeceptJS supports Node.js
44
+ - this repository is validated in CI on Node.js 20 and 22
45
+
29
46
  ## Usage
30
47
 
31
48
  Enable the `allure` plugin in [the CodeceptJS configuration file](https://codecept.io/configuration/):
@@ -51,18 +68,18 @@ You may select another location, or further customize the plugin's behavior with
51
68
 
52
69
  ### View the report
53
70
 
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.
55
-
56
- Generate Allure Report after the tests are executed:
71
+ Use Allure Report 2:
57
72
 
58
73
  ```bash
59
74
  allure generate ./allure-results -o ./allure-report
75
+ allure open ./allure-report
60
76
  ```
61
77
 
62
- Open the generated report:
78
+ Or use Allure Report 3:
63
79
 
64
80
  ```bash
65
- allure open ./allure-report
81
+ npx allure generate ./allure-results
82
+ npx allure open ./allure-report
66
83
  ```
67
84
 
68
85
  ## Allure API
package/dist/cjs/index.js CHANGED
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _codeceptjs = require("codeceptjs");
8
7
  var _allureJsCommons = require("allure-js-commons");
8
+ var _codeceptjs = require("codeceptjs");
9
9
  var _legacy = require("./legacy.js");
10
10
  var _reporter = require("./reporter.js");
11
11
  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; }
@@ -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","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,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,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K,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":[]}
1
+ {"version":3,"file":"index.js","names":["_allureJsCommons","require","_codeceptjs","_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 { attachment } from \"allure-js-commons\";\nimport type { ReporterConfig } from \"allure-js-commons/sdk/reporter\";\nimport { container } from \"codeceptjs\";\n\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,gBAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,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,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OA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A;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":[]}
@@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AllureCodeceptJsReporter = void 0;
7
- var _codeceptjs = require("codeceptjs");
8
- var _nodeProcess = require("node:process");
9
7
  var _allureJsCommons = require("allure-js-commons");
10
8
  var _sdk = require("allure-js-commons/sdk");
11
9
  var _allureMocha = _interopRequireDefault(require("allure-mocha"));
10
+ var _codeceptjs = require("codeceptjs");
12
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
12
  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; }
14
13
  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; }
@@ -16,15 +15,47 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
16
15
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
17
16
  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); }
18
17
  var MAX_META_STEP_NESTING = 10;
18
+ // CodeceptJS tryTo() uses a dedicated "tryTo" recorder session.
19
+ // Docs: https://codecept.io/effects.html
20
+ var TRY_TO_SESSION = "tryTo";
21
+ var knownCodeceptVerificationErrorPatterns = [/^Element ".+" is (?:not visible on page|still visible on page|not seen in DOM|still seen in DOM)\.?$/i, /^(?:Element|Clickable element|Context element|Frame|Option ".+" in|Custom locator .+) .*\b(?:not found|was not found)\b/i, /^element \(.+\) .+ after \d+(?:\.\d+)? sec(?:\n|\.|$)/i, /^Text ".+" was not found on page after \d+(?:\.\d+)? sec\.?$/i, /^Expected \d+ tabs are not met after \d+(?:\.\d+)? sec\.?$/i, /^Cookie .+ is not found after \d+(?:\.\d+)?s$/i];
22
+ var isKnownCodeceptVerificationError = error => {
23
+ var message = error.message ? (0, _sdk.stripAnsi)(error.message) : "";
24
+ if (!message) {
25
+ return false;
26
+ }
27
+ return knownCodeceptVerificationErrorPatterns.some(pattern => pattern.test(message));
28
+ };
29
+ var getCodeceptStatusFromError = (error, hookName) => {
30
+ var status = (0, _sdk.getStatusFromError)(error);
31
+ if (status === _allureJsCommons.Status.FAILED || hookName) {
32
+ return status;
33
+ }
34
+ return isKnownCodeceptVerificationError(error) ? _allureJsCommons.Status.FAILED : _allureJsCommons.Status.BROKEN;
35
+ };
36
+ var isErrorInstance = value => {
37
+ var _constructor;
38
+ return value instanceof Error || typeof value === "object" && value !== null && ((_constructor = value.constructor) === null || _constructor === void 0 ? void 0 : _constructor.name) === "Error";
39
+ };
40
+ var isTryToSession = () => {
41
+ var _recorder$getCurrentS;
42
+ return ((_recorder$getCurrentS = _codeceptjs.recorder.getCurrentSessionId) === null || _recorder$getCurrentS === void 0 ? void 0 : _recorder$getCurrentS.call(_codeceptjs.recorder)) === TRY_TO_SESSION;
43
+ };
44
+ var getRecorderPromise = () => {
45
+ var _recorder$promise;
46
+ return (_recorder$promise = _codeceptjs.recorder.promise) === null || _recorder$promise === void 0 ? void 0 : _recorder$promise.call(_codeceptjs.recorder);
47
+ };
19
48
  class AllureCodeceptJsReporter extends _allureMocha.default {
20
49
  constructor(runner, opts, isInWorker) {
21
50
  super(runner, opts, isInWorker);
22
51
  _defineProperty(this, "currentBddStep", void 0);
23
52
  _defineProperty(this, "metaStepStack", []);
24
53
  _defineProperty(this, "currentLeafStep", void 0);
54
+ _defineProperty(this, "currentTestHookName", void 0);
25
55
  _defineProperty(this, "getFrameworkName", () => "codeceptjs");
26
56
  _defineProperty(this, "getWorkerId", () => undefined);
27
57
  this.registerEvents();
58
+ runner.on("fail", this.mochaTestFailed.bind(this));
28
59
  }
29
60
  registerEvents() {
30
61
  // Test
@@ -43,6 +74,7 @@ class AllureCodeceptJsReporter extends _allureMocha.default {
43
74
  if (!this.currentTest) {
44
75
  return;
45
76
  }
77
+ this.currentTestHookName = undefined;
46
78
  var tags = test.tags || [];
47
79
  var extraTagLabels = tags.filter(tag => tag && !(0, _sdk.isMetadataTag)(tag)).map(tag => tag.startsWith("@") ? tag.substring(1) : tag).map(tag => tag.trim()).filter(tag => tag.length > 0).map(tag => ({
48
80
  name: _allureJsCommons.LabelName.TAG,
@@ -52,11 +84,16 @@ class AllureCodeceptJsReporter extends _allureMocha.default {
52
84
  tr.labels.push(...extraTagLabels);
53
85
  });
54
86
  }
55
- testFailed(_, error) {
56
- var status = (0, _sdk.getStatusFromError)({
57
- message: error.message
58
- });
87
+ testFailed(_, error, hookName) {
88
+ this.currentTestHookName = hookName;
89
+ var status = getCodeceptStatusFromError(error, hookName);
59
90
  var statusDetails = (0, _sdk.getMessageAndTraceFromError)(error);
91
+ if (this.currentTest) {
92
+ this.runtime.updateTest(this.currentTest, result => {
93
+ result.status = status;
94
+ result.statusDetails = _objectSpread(_objectSpread({}, result.statusDetails), statusDetails);
95
+ });
96
+ }
60
97
  if (this.currentBddStep) {
61
98
  this.stopCurrentStep(result => {
62
99
  result.stage = _allureJsCommons.Stage.FINISHED;
@@ -84,6 +121,7 @@ class AllureCodeceptJsReporter extends _allureMocha.default {
84
121
  this.metaStepStack = [];
85
122
  }
86
123
  testFinished() {
124
+ this.currentTestHookName = undefined;
87
125
  if (this.currentBddStep) {
88
126
  this.runtime.updateStep(this.currentBddStep, result => {
89
127
  result.status = _allureJsCommons.Status.PASSED;
@@ -169,25 +207,41 @@ class AllureCodeceptJsReporter extends _allureMocha.default {
169
207
  });
170
208
  }
171
209
 
172
- // according to the docs, codeceptjs supposed to report the error,
173
- // but actually it's never reported
210
+ // Step errors are usually reported directly, but some paths still require
211
+ // reading the recorder rejection to populate the final step status/details.
174
212
  stepFailed(_, error) {
175
213
  if (!this.currentLeafStep) {
176
214
  return;
177
215
  }
178
- this.runtime.updateStep(this.currentLeafStep, result => {
216
+ var currentLeafStep = this.currentLeafStep;
217
+ this.runtime.updateStep(currentLeafStep, result => {
179
218
  result.stage = _allureJsCommons.Stage.FINISHED;
180
219
  if (error) {
181
220
  if (!error.message && typeof error.inspect === "function") {
182
221
  error.message = error.inspect();
183
222
  }
184
- result.status = (0, _sdk.getStatusFromError)(error);
223
+ result.status = isTryToSession() ? _allureJsCommons.Status.BROKEN : getCodeceptStatusFromError(error);
185
224
  result.statusDetails = (0, _sdk.getMessageAndTraceFromError)(error);
186
225
  } else {
187
- result.status = _nodeProcess.env.TRY_TO === "true" ? _allureJsCommons.Status.BROKEN : _allureJsCommons.Status.FAILED;
226
+ var promise = getRecorderPromise();
227
+ if (promise) {
228
+ promise.catch(err => {
229
+ if (!err.message && typeof err.inspect === "function") {
230
+ err.message = err.inspect();
231
+ }
232
+ if (isErrorInstance(err)) {
233
+ this.runtime.updateStep(currentLeafStep, step => {
234
+ step.status = isTryToSession() ? _allureJsCommons.Status.BROKEN : getCodeceptStatusFromError(err);
235
+ step.statusDetails = (0, _sdk.getMessageAndTraceFromError)(err);
236
+ });
237
+ }
238
+ return Promise.reject(err);
239
+ });
240
+ }
241
+ result.status = _allureJsCommons.Status.BROKEN;
188
242
  }
189
243
  });
190
- this.runtime.stopStep(this.currentLeafStep);
244
+ this.runtime.stopStep(currentLeafStep);
191
245
  this.currentLeafStep = undefined;
192
246
  }
193
247
  stepComment() {
@@ -226,17 +280,16 @@ class AllureCodeceptJsReporter extends _allureMocha.default {
226
280
  if (!currentStep) {
227
281
  return;
228
282
  }
229
- var promise = _codeceptjs.recorder.promise();
230
- // @ts-ignore
283
+ var promise = getRecorderPromise();
231
284
  if (promise) {
232
285
  promise.catch(err => {
233
286
  if (!err.message && typeof err.inspect === "function") {
234
287
  // AssertionFailedError doesn't set message attribute
235
288
  err.message = err.inspect();
236
289
  }
237
- if (err instanceof Error || err.constructor.name === "Error") {
290
+ if (isErrorInstance(err)) {
238
291
  this.runtime.updateStep(currentStep, step => {
239
- step.status = (0, _sdk.getStatusFromError)(err);
292
+ step.status = isTryToSession() ? _allureJsCommons.Status.BROKEN : getCodeceptStatusFromError(err);
240
293
  step.statusDetails = _objectSpread(_objectSpread({}, step.statusDetails), (0, _sdk.getMessageAndTraceFromError)(err));
241
294
  });
242
295
  }
@@ -246,6 +299,15 @@ class AllureCodeceptJsReporter extends _allureMocha.default {
246
299
  this.runtime.updateStep(currentStep, updateFunc);
247
300
  this.runtime.stopStep(currentStep);
248
301
  }
302
+ mochaTestFailed(_, error) {
303
+ if (!this.currentTest) {
304
+ return;
305
+ }
306
+ this.runtime.updateTest(this.currentTest, result => {
307
+ result.status = getCodeceptStatusFromError(error, this.currentTestHookName);
308
+ result.statusDetails = _objectSpread(_objectSpread({}, result.statusDetails), (0, _sdk.getMessageAndTraceFromError)(error));
309
+ });
310
+ }
249
311
  }
250
312
  exports.AllureCodeceptJsReporter = AllureCodeceptJsReporter;
251
313
  //# sourceMappingURL=reporter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.js","names":["_codeceptjs","require","_nodeProcess","_allureJsCommons","_sdk","_allureMocha","_interopRequireDefault","e","__esModule","default","ownKeys","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","MAX_META_STEP_NESTING","AllureCodeceptJsReporter","AllureMochaReporter","constructor","runner","opts","isInWorker","undefined","registerEvents","event","dispatcher","on","test","before","testStarted","bind","failed","testFailed","finished","testFinished","step","started","stepStarted","passed","stepPassed","stepFailed","comment","stepComment","bddStep","bddStepStarted","after","currentTest","tags","extraTagLabels","tag","isMetadataTag","map","startsWith","substring","trim","name","LabelName","TAG","runtime","updateTest","tr","labels","_","error","status","getStatusFromError","message","statusDetails","getMessageAndTraceFromError","currentBddStep","stopCurrentStep","result","stage","Stage","FINISHED","Status","BROKEN","id","metaStepStack","updateStep","stopStep","PASSED","currentLeafStep","_this$currentHook","_this$metaStepStack$i2","_this$metaStepStack2","root","currentHook","stepPath","current","metaStep","isBDD","_current$toString","unshift","stripAnsi","toString","index","Math","min","s","slice","_this$metaStepStack$i","_this$metaStepStack","parentId","startStep","parent","_this$currentHook2","keyword","text","inspect","env","TRY_TO","FAILED","updateFunc","_this$currentHook3","currentStep","stopStepById","promise","recorder","catch","err","Error","Promise","reject","exports"],"sources":["../../src/reporter.ts"],"sourcesContent":["import { event, recorder } from \"codeceptjs\";\nimport type * as Mocha from \"mocha\";\nimport { env } from \"node:process\";\nimport { LabelName, Stage, Status, type StepResult } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError, getStatusFromError, isMetadataTag, stripAnsi } from \"allure-js-commons/sdk\";\nimport AllureMochaReporter from \"allure-mocha\";\nimport type { CodeceptBddStep, CodeceptError, CodeceptStep } from \"./model.js\";\n\ninterface MetaStep {\n name: string;\n id: string;\n}\n\nconst MAX_META_STEP_NESTING = 10;\n\nexport class AllureCodeceptJsReporter extends AllureMochaReporter {\n protected currentBddStep?: string;\n protected metaStepStack: MetaStep[] = [];\n protected currentLeafStep?: string;\n\n constructor(runner: Mocha.Runner, opts: Mocha.MochaOptions, isInWorker: boolean) {\n super(runner, opts, isInWorker);\n this.registerEvents();\n }\n\n registerEvents() {\n // Test\n event.dispatcher.on(event.test.before, this.testStarted.bind(this));\n event.dispatcher.on(event.test.failed, this.testFailed.bind(this));\n event.dispatcher.on(event.test.finished, this.testFinished.bind(this));\n // Step\n event.dispatcher.on(event.step.started, this.stepStarted.bind(this));\n event.dispatcher.on(event.step.passed, this.stepPassed.bind(this));\n event.dispatcher.on(event.step.failed, this.stepFailed.bind(this));\n event.dispatcher.on(event.step.comment, this.stepComment.bind(this));\n\n event.dispatcher.on(event.bddStep.before, this.bddStepStarted.bind(this));\n event.dispatcher.on(event.bddStep.after, this.stepPassed.bind(this));\n }\n\n testStarted(test: { tags?: string[] }) {\n if (!this.currentTest) {\n return;\n }\n\n const tags = test.tags || [];\n const extraTagLabels = tags\n .filter((tag) => tag && !isMetadataTag(tag))\n .map((tag) => (tag.startsWith(\"@\") ? tag.substring(1) : tag))\n .map((tag) => tag.trim())\n .filter((tag) => tag.length > 0)\n .map((tag) => ({ name: LabelName.TAG, value: tag }));\n\n this.runtime.updateTest(this.currentTest, (tr) => {\n tr.labels.push(...extraTagLabels);\n });\n }\n\n testFailed(_: {}, error: Error) {\n const status = getStatusFromError({ message: error.message } as Error);\n const statusDetails = getMessageAndTraceFromError(error);\n if (this.currentBddStep) {\n this.stopCurrentStep((result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.BROKEN;\n if (error) {\n result.status = status;\n result.statusDetails = { ...statusDetails };\n }\n });\n }\n this.currentBddStep = undefined;\n\n for (const { id } of this.metaStepStack) {\n this.runtime.updateStep(id, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.BROKEN;\n if (error) {\n result.status = status;\n result.statusDetails = { ...statusDetails };\n }\n });\n this.runtime.stopStep(id);\n }\n this.metaStepStack = [];\n }\n\n testFinished() {\n if (this.currentBddStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n }\n this.currentBddStep = undefined;\n\n for (const { id } of this.metaStepStack) {\n this.runtime.updateStep(id, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(id);\n }\n\n this.metaStepStack = [];\n this.currentLeafStep = undefined;\n }\n\n stepStarted(step: CodeceptStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n\n const stepPath: string[] = [];\n let current = step.metaStep;\n while (current && !current.isBDD() && stepPath.length < MAX_META_STEP_NESTING) {\n stepPath.unshift(stripAnsi(current.toString() ?? \"\").trim());\n current = current.metaStep;\n }\n\n let index = 0;\n while (\n index < Math.min(this.metaStepStack.length, stepPath.length) &&\n this.metaStepStack[index].name === stepPath[index]\n ) {\n index++;\n }\n\n for (let i = this.metaStepStack.length - 1; i >= index; i--) {\n const { id } = this.metaStepStack[i];\n this.runtime.updateStep(id, (s) => {\n s.status = Status.PASSED;\n s.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(id);\n }\n this.metaStepStack = this.metaStepStack.slice(0, index);\n\n for (let i = index; i < stepPath.length; i++) {\n const name = stepPath[i];\n const parentId = this.metaStepStack[i - 1]?.id ?? root;\n const id = this.runtime.startStep(parentId, undefined, {\n name,\n });\n if (id) {\n this.metaStepStack.push({ name, id });\n }\n }\n\n const parent = this.metaStepStack[this.metaStepStack.length - 1]?.id ?? root;\n this.currentLeafStep = this.runtime.startStep(parent, undefined, {\n name: step.toString().trim(),\n });\n }\n\n bddStepStarted(step: CodeceptBddStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n if (this.currentBddStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n }\n this.currentBddStep = this.runtime.startStep(root, undefined, {\n name: step.keyword + step.text,\n });\n }\n\n // according to the docs, codeceptjs supposed to report the error,\n // but actually it's never reported\n stepFailed(_: CodeceptJS.Step, error?: CodeceptError) {\n if (!this.currentLeafStep) {\n return;\n }\n\n this.runtime.updateStep(this.currentLeafStep, (result) => {\n result.stage = Stage.FINISHED;\n if (error) {\n if (!error.message && typeof error.inspect === \"function\") {\n error.message = error.inspect();\n }\n result.status = getStatusFromError(error as unknown as Error);\n result.statusDetails = getMessageAndTraceFromError(error as unknown as Error);\n } else {\n result.status = env.TRY_TO === \"true\" ? Status.BROKEN : Status.FAILED;\n }\n });\n this.runtime.stopStep(this.currentLeafStep);\n this.currentLeafStep = undefined;\n }\n\n stepComment() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n }\n\n stepPassed() {\n if (this.currentBddStep && !this.currentLeafStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n this.currentBddStep = undefined;\n return;\n }\n\n if (!this.currentLeafStep) {\n return;\n }\n\n this.runtime.updateStep(this.currentLeafStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentLeafStep);\n this.currentLeafStep = undefined;\n }\n\n stopCurrentStep(updateFunc: (result: StepResult) => void) {\n const root = this.currentHook ?? this.currentTest;\n const currentStep = root ? this.runtime.currentStep(root) : undefined;\n\n this.stopStepById(currentStep, updateFunc);\n }\n\n stopStepById(currentStep: string | undefined, updateFunc: (result: StepResult) => void) {\n if (!currentStep) {\n return;\n }\n const promise = recorder.promise();\n // @ts-ignore\n if (promise) {\n promise.catch((err) => {\n if (!err.message && typeof err.inspect === \"function\") {\n // AssertionFailedError doesn't set message attribute\n err.message = err.inspect();\n }\n if (err instanceof Error || err.constructor.name === \"Error\") {\n this.runtime.updateStep(currentStep, (step) => {\n step.status = getStatusFromError(err as Error);\n step.statusDetails = { ...step.statusDetails, ...getMessageAndTraceFromError(err as Error) };\n });\n }\n return Promise.reject(err);\n });\n }\n\n this.runtime.updateStep(currentStep, updateFunc);\n this.runtime.stopStep(currentStep);\n }\n\n protected getFrameworkName = () => \"codeceptjs\";\n\n protected getWorkerId = () => undefined;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AAA+C,SAAAK,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAP,CAAA,OAAAM,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAR,CAAA,GAAAI,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAX,CAAA,EAAAI,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAA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_allureMocha","_interopRequireDefault","_codeceptjs","e","__esModule","default","ownKeys","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","MAX_META_STEP_NESTING","TRY_TO_SESSION","knownCodeceptVerificationErrorPatterns","isKnownCodeceptVerificationError","error","message","stripAnsi","some","pattern","test","getCodeceptStatusFromError","hookName","status","getStatusFromError","Status","FAILED","BROKEN","isErrorInstance","_constructor","Error","constructor","name","isTryToSession","_recorder$getCurrentS","recorder","getCurrentSessionId","getRecorderPromise","_recorder$promise","promise","AllureCodeceptJsReporter","AllureMochaReporter","runner","opts","isInWorker","undefined","registerEvents","on","mochaTestFailed","bind","event","dispatcher","before","testStarted","failed","testFailed","finished","testFinished","step","started","stepStarted","passed","stepPassed","stepFailed","comment","stepComment","bddStep","bddStepStarted","after","currentTest","currentTestHookName","tags","extraTagLabels","tag","isMetadataTag","map","startsWith","substring","trim","LabelName","TAG","runtime","updateTest","tr","labels","_","statusDetails","getMessageAndTraceFromError","result","currentBddStep","stopCurrentStep","stage","Stage","FINISHED","id","metaStepStack","updateStep","stopStep","PASSED","currentLeafStep","_this$currentHook","_this$metaStepStack$i2","_this$metaStepStack2","root","currentHook","stepPath","current","metaStep","isBDD","_current$toString","unshift","toString","index","Math","min","s","slice","_this$metaStepStack$i","_this$metaStepStack","parentId","startStep","parent","_this$currentHook2","keyword","text","inspect","catch","err","Promise","reject","updateFunc","_this$currentHook3","currentStep","stopStepById","exports"],"sources":["../../src/reporter.ts"],"sourcesContent":["import { LabelName, Stage, Status, type StepResult } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError, getStatusFromError, isMetadataTag, stripAnsi } from \"allure-js-commons/sdk\";\nimport AllureMochaReporter from \"allure-mocha\";\nimport { event, recorder } from \"codeceptjs\";\nimport type * as Mocha from \"mocha\";\n\nimport type { CodeceptBddStep, CodeceptError, CodeceptStep } from \"./model.js\";\n\ninterface MetaStep {\n name: string;\n id: string;\n}\n\nconst MAX_META_STEP_NESTING = 10;\n// CodeceptJS tryTo() uses a dedicated \"tryTo\" recorder session.\n// Docs: https://codecept.io/effects.html\nconst TRY_TO_SESSION = \"tryTo\";\n\nconst knownCodeceptVerificationErrorPatterns = [\n /^Element \".+\" is (?:not visible on page|still visible on page|not seen in DOM|still seen in DOM)\\.?$/i,\n /^(?:Element|Clickable element|Context element|Frame|Option \".+\" in|Custom locator .+) .*\\b(?:not found|was not found)\\b/i,\n /^element \\(.+\\) .+ after \\d+(?:\\.\\d+)? sec(?:\\n|\\.|$)/i,\n /^Text \".+\" was not found on page after \\d+(?:\\.\\d+)? sec\\.?$/i,\n /^Expected \\d+ tabs are not met after \\d+(?:\\.\\d+)? sec\\.?$/i,\n /^Cookie .+ is not found after \\d+(?:\\.\\d+)?s$/i,\n] as const;\n\nconst isKnownCodeceptVerificationError = (error: Partial<Error>): boolean => {\n const message = error.message ? stripAnsi(error.message) : \"\";\n\n if (!message) {\n return false;\n }\n\n return knownCodeceptVerificationErrorPatterns.some((pattern) => pattern.test(message));\n};\n\nconst getCodeceptStatusFromError = (error: Partial<Error>, hookName?: string): Status => {\n const status = getStatusFromError(error);\n\n if (status === Status.FAILED || hookName) {\n return status;\n }\n\n return isKnownCodeceptVerificationError(error) ? Status.FAILED : Status.BROKEN;\n};\n\nconst isErrorInstance = (value: unknown): value is Error =>\n value instanceof Error ||\n (typeof value === \"object\" &&\n value !== null &&\n (value as { constructor?: { name?: unknown } }).constructor?.name === \"Error\");\n\nconst isTryToSession = () => recorder.getCurrentSessionId?.() === TRY_TO_SESSION;\nconst getRecorderPromise = (): Promise<unknown> | undefined =>\n (recorder.promise as (() => Promise<unknown> | undefined) | undefined)?.();\n\nexport class AllureCodeceptJsReporter extends AllureMochaReporter {\n protected currentBddStep?: string;\n protected metaStepStack: MetaStep[] = [];\n protected currentLeafStep?: string;\n protected currentTestHookName?: string;\n\n constructor(runner: Mocha.Runner, opts: Mocha.MochaOptions, isInWorker: boolean) {\n super(runner, opts, isInWorker);\n this.registerEvents();\n runner.on(\"fail\", this.mochaTestFailed.bind(this));\n }\n\n registerEvents() {\n // Test\n event.dispatcher.on(event.test.before, this.testStarted.bind(this));\n event.dispatcher.on(event.test.failed, this.testFailed.bind(this));\n event.dispatcher.on(event.test.finished, this.testFinished.bind(this));\n // Step\n event.dispatcher.on(event.step.started, this.stepStarted.bind(this));\n event.dispatcher.on(event.step.passed, this.stepPassed.bind(this));\n event.dispatcher.on(event.step.failed, this.stepFailed.bind(this));\n event.dispatcher.on(event.step.comment, this.stepComment.bind(this));\n\n event.dispatcher.on(event.bddStep.before, this.bddStepStarted.bind(this));\n event.dispatcher.on(event.bddStep.after, this.stepPassed.bind(this));\n }\n\n testStarted(test: { tags?: string[] }) {\n if (!this.currentTest) {\n return;\n }\n\n this.currentTestHookName = undefined;\n\n const tags = test.tags || [];\n const extraTagLabels = tags\n .filter((tag) => tag && !isMetadataTag(tag))\n .map((tag) => (tag.startsWith(\"@\") ? tag.substring(1) : tag))\n .map((tag) => tag.trim())\n .filter((tag) => tag.length > 0)\n .map((tag) => ({ name: LabelName.TAG, value: tag }));\n\n this.runtime.updateTest(this.currentTest, (tr) => {\n tr.labels.push(...extraTagLabels);\n });\n }\n\n testFailed(_: {}, error: Error, hookName?: string) {\n this.currentTestHookName = hookName;\n const status = getCodeceptStatusFromError(error, hookName);\n const statusDetails = getMessageAndTraceFromError(error);\n\n if (this.currentTest) {\n this.runtime.updateTest(this.currentTest, (result) => {\n result.status = status;\n result.statusDetails = {\n ...result.statusDetails,\n ...statusDetails,\n };\n });\n }\n\n if (this.currentBddStep) {\n this.stopCurrentStep((result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.BROKEN;\n if (error) {\n result.status = status;\n result.statusDetails = { ...statusDetails };\n }\n });\n }\n this.currentBddStep = undefined;\n\n for (const { id } of this.metaStepStack) {\n this.runtime.updateStep(id, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.BROKEN;\n if (error) {\n result.status = status;\n result.statusDetails = { ...statusDetails };\n }\n });\n this.runtime.stopStep(id);\n }\n this.metaStepStack = [];\n }\n\n testFinished() {\n this.currentTestHookName = undefined;\n if (this.currentBddStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n }\n this.currentBddStep = undefined;\n\n for (const { id } of this.metaStepStack) {\n this.runtime.updateStep(id, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(id);\n }\n\n this.metaStepStack = [];\n this.currentLeafStep = undefined;\n }\n\n stepStarted(step: CodeceptStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n\n const stepPath: string[] = [];\n let current = step.metaStep;\n while (current && !current.isBDD() && stepPath.length < MAX_META_STEP_NESTING) {\n stepPath.unshift(stripAnsi(current.toString() ?? \"\").trim());\n current = current.metaStep;\n }\n\n let index = 0;\n while (\n index < Math.min(this.metaStepStack.length, stepPath.length) &&\n this.metaStepStack[index].name === stepPath[index]\n ) {\n index++;\n }\n\n for (let i = this.metaStepStack.length - 1; i >= index; i--) {\n const { id } = this.metaStepStack[i];\n this.runtime.updateStep(id, (s) => {\n s.status = Status.PASSED;\n s.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(id);\n }\n this.metaStepStack = this.metaStepStack.slice(0, index);\n\n for (let i = index; i < stepPath.length; i++) {\n const name = stepPath[i];\n const parentId = this.metaStepStack[i - 1]?.id ?? root;\n const id = this.runtime.startStep(parentId, undefined, {\n name,\n });\n if (id) {\n this.metaStepStack.push({ name, id });\n }\n }\n\n const parent = this.metaStepStack[this.metaStepStack.length - 1]?.id ?? root;\n this.currentLeafStep = this.runtime.startStep(parent, undefined, {\n name: step.toString().trim(),\n });\n }\n\n bddStepStarted(step: CodeceptBddStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n if (this.currentBddStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n }\n this.currentBddStep = this.runtime.startStep(root, undefined, {\n name: step.keyword + step.text,\n });\n }\n\n // Step errors are usually reported directly, but some paths still require\n // reading the recorder rejection to populate the final step status/details.\n stepFailed(_: CodeceptJS.Step, error?: CodeceptError) {\n if (!this.currentLeafStep) {\n return;\n }\n\n const currentLeafStep = this.currentLeafStep;\n\n this.runtime.updateStep(currentLeafStep, (result) => {\n result.stage = Stage.FINISHED;\n if (error) {\n if (!error.message && typeof error.inspect === \"function\") {\n error.message = error.inspect();\n }\n result.status = isTryToSession() ? Status.BROKEN : getCodeceptStatusFromError(error as unknown as Error);\n result.statusDetails = getMessageAndTraceFromError(error as unknown as Error);\n } else {\n const promise = getRecorderPromise();\n if (promise) {\n promise.catch((err) => {\n if (!err.message && typeof err.inspect === \"function\") {\n err.message = err.inspect();\n }\n if (isErrorInstance(err)) {\n this.runtime.updateStep(currentLeafStep, (step) => {\n step.status = isTryToSession() ? Status.BROKEN : getCodeceptStatusFromError(err as Error);\n step.statusDetails = getMessageAndTraceFromError(err as Error);\n });\n }\n return Promise.reject(err);\n });\n }\n\n result.status = Status.BROKEN;\n }\n });\n this.runtime.stopStep(currentLeafStep);\n this.currentLeafStep = undefined;\n }\n\n stepComment() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n }\n\n stepPassed() {\n if (this.currentBddStep && !this.currentLeafStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n this.currentBddStep = undefined;\n return;\n }\n\n if (!this.currentLeafStep) {\n return;\n }\n\n this.runtime.updateStep(this.currentLeafStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentLeafStep);\n this.currentLeafStep = undefined;\n }\n\n stopCurrentStep(updateFunc: (result: StepResult) => void) {\n const root = this.currentHook ?? this.currentTest;\n const currentStep = root ? this.runtime.currentStep(root) : undefined;\n\n this.stopStepById(currentStep, updateFunc);\n }\n\n stopStepById(currentStep: string | undefined, updateFunc: (result: StepResult) => void) {\n if (!currentStep) {\n return;\n }\n const promise = getRecorderPromise();\n if (promise) {\n promise.catch((err) => {\n if (!err.message && typeof err.inspect === \"function\") {\n // AssertionFailedError doesn't set message attribute\n err.message = err.inspect();\n }\n if (isErrorInstance(err)) {\n this.runtime.updateStep(currentStep, (step) => {\n step.status = isTryToSession() ? Status.BROKEN : getCodeceptStatusFromError(err as Error);\n step.statusDetails = { ...step.statusDetails, ...getMessageAndTraceFromError(err as Error) };\n });\n }\n return Promise.reject(err);\n });\n }\n\n this.runtime.updateStep(currentStep, updateFunc);\n this.runtime.stopStep(currentStep);\n }\n\n mochaTestFailed(_: Mocha.Test, error: Error) {\n if (!this.currentTest) {\n return;\n }\n\n this.runtime.updateTest(this.currentTest, (result) => {\n result.status = getCodeceptStatusFromError(error, this.currentTestHookName);\n result.statusDetails = {\n ...result.statusDetails,\n ...getMessageAndTraceFromError(error),\n };\n });\n }\n\n protected getFrameworkName = () => \"codeceptjs\";\n\n protected getWorkerId = () => undefined;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAA6C,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MA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GAAY,CAAC;YACzFrE,IAAI,CAAC4B,aAAa,GAAA/F,aAAA,CAAAA,aAAA,KAAQmE,IAAI,CAAC4B,aAAa,GAAK,IAAAC,gCAA2B,EAACwC,GAAY,CAAC,CAAE;UAC9F,CAAC,CAAC;QACJ;QACA,OAAOC,OAAO,CAACC,MAAM,CAACF,GAAG,CAAC;MAC5B,CAAC,CAAC;IACJ;IAEA,IAAI,CAAC9C,OAAO,CAACe,UAAU,CAACoC,WAAW,EAAEF,UAAU,CAAC;IAChD,IAAI,CAACjD,OAAO,CAACgB,QAAQ,CAACmC,WAAW,CAAC;EACpC;EAEApF,eAAeA,CAACqC,CAAa,EAAEtE,KAAY,EAAE;IAC3C,IAAI,CAAC,IAAI,CAACsD,WAAW,EAAE;MACrB;IACF;IAEA,IAAI,CAACY,OAAO,CAACC,UAAU,CAAC,IAAI,CAACb,WAAW,EAAGmB,MAAM,IAAK;MACpDA,MAAM,CAACjE,MAAM,GAAGF,0BAA0B,CAACN,KAAK,EAAE,IAAI,CAACuD,mBAAmB,CAAC;MAC3EkB,MAAM,CAACF,aAAa,GAAA/F,aAAA,CAAAA,aAAA,KACfiG,MAAM,CAACF,aAAa,GACpB,IAAAC,gCAA2B,EAACxE,KAAK,CAAC,CACtC;IACH,CAAC,CAAC;EACJ;AAKF;AAACuH,OAAA,CAAA9F,wBAAA,GAAAA,wBAAA","ignoreList":[]}
package/dist/esm/index.js CHANGED
@@ -3,8 +3,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3
3
  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; }
4
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
5
  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); }
6
- import { container } from "codeceptjs";
7
6
  import { attachment } from "allure-js-commons";
7
+ import { container } from "codeceptjs";
8
8
  import { allureCodeceptJsLegacyApi } from "./legacy.js";
9
9
  import { AllureCodeceptJsReporter } from "./reporter.js";
10
10
  var allurePlugin = config => {
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"file":"index.js","names":["attachment","container","allureCodeceptJsLegacyApi","AllureCodeceptJsReporter","allurePlugin","config","mocha","currentReporter","_reporter","reporter","prototype","constructor","_objectSpread","extraReporters","options","reporterOptions","addAttachment","name","content","contentType"],"sources":["../../src/index.ts"],"sourcesContent":["import { attachment } from \"allure-js-commons\";\nimport type { ReporterConfig } from \"allure-js-commons/sdk/reporter\";\nimport { container } from \"codeceptjs\";\n\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,UAAU,QAAQ,mBAAmB;AAE9C,SAASC,SAAS,QAAQ,YAAY;AAEtC,SAASC,yBAAyB,QAAQ,aAAa;AACvD,SAASC,wBAAwB,QAAQ,eAAe;AAExD,IAAMC,YAAY,GAAIC,MAAsB,IAAK;EAC/C,IAAMC,KAAK,GAAGL,SAAS,CAACK,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;MACAnB,UAAU,CAACiB,IAAI,EAAEC,OAAO,EAAEC,WAAW,CAAC;IACxC;EAAC;AAEL,CAAC;AAED,eAAef,YAAY","ignoreList":[]}
@@ -3,21 +3,52 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3
3
  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; }
4
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
5
  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); }
6
- import { event, recorder } from "codeceptjs";
7
- import { env } from "node:process";
8
6
  import { LabelName, Stage, Status } from "allure-js-commons";
9
7
  import { getMessageAndTraceFromError, getStatusFromError, isMetadataTag, stripAnsi } from "allure-js-commons/sdk";
10
8
  import AllureMochaReporter from "allure-mocha";
9
+ import { event, recorder } from "codeceptjs";
11
10
  var MAX_META_STEP_NESTING = 10;
11
+ // CodeceptJS tryTo() uses a dedicated "tryTo" recorder session.
12
+ // Docs: https://codecept.io/effects.html
13
+ var TRY_TO_SESSION = "tryTo";
14
+ var knownCodeceptVerificationErrorPatterns = [/^Element ".+" is (?:not visible on page|still visible on page|not seen in DOM|still seen in DOM)\.?$/i, /^(?:Element|Clickable element|Context element|Frame|Option ".+" in|Custom locator .+) .*\b(?:not found|was not found)\b/i, /^element \(.+\) .+ after \d+(?:\.\d+)? sec(?:\n|\.|$)/i, /^Text ".+" was not found on page after \d+(?:\.\d+)? sec\.?$/i, /^Expected \d+ tabs are not met after \d+(?:\.\d+)? sec\.?$/i, /^Cookie .+ is not found after \d+(?:\.\d+)?s$/i];
15
+ var isKnownCodeceptVerificationError = error => {
16
+ var message = error.message ? stripAnsi(error.message) : "";
17
+ if (!message) {
18
+ return false;
19
+ }
20
+ return knownCodeceptVerificationErrorPatterns.some(pattern => pattern.test(message));
21
+ };
22
+ var getCodeceptStatusFromError = (error, hookName) => {
23
+ var status = getStatusFromError(error);
24
+ if (status === Status.FAILED || hookName) {
25
+ return status;
26
+ }
27
+ return isKnownCodeceptVerificationError(error) ? Status.FAILED : Status.BROKEN;
28
+ };
29
+ var isErrorInstance = value => {
30
+ var _constructor;
31
+ return value instanceof Error || typeof value === "object" && value !== null && ((_constructor = value.constructor) === null || _constructor === void 0 ? void 0 : _constructor.name) === "Error";
32
+ };
33
+ var isTryToSession = () => {
34
+ var _recorder$getCurrentS;
35
+ return ((_recorder$getCurrentS = recorder.getCurrentSessionId) === null || _recorder$getCurrentS === void 0 ? void 0 : _recorder$getCurrentS.call(recorder)) === TRY_TO_SESSION;
36
+ };
37
+ var getRecorderPromise = () => {
38
+ var _recorder$promise;
39
+ return (_recorder$promise = recorder.promise) === null || _recorder$promise === void 0 ? void 0 : _recorder$promise.call(recorder);
40
+ };
12
41
  export class AllureCodeceptJsReporter extends AllureMochaReporter {
13
42
  constructor(runner, opts, isInWorker) {
14
43
  super(runner, opts, isInWorker);
15
44
  _defineProperty(this, "currentBddStep", void 0);
16
45
  _defineProperty(this, "metaStepStack", []);
17
46
  _defineProperty(this, "currentLeafStep", void 0);
47
+ _defineProperty(this, "currentTestHookName", void 0);
18
48
  _defineProperty(this, "getFrameworkName", () => "codeceptjs");
19
49
  _defineProperty(this, "getWorkerId", () => undefined);
20
50
  this.registerEvents();
51
+ runner.on("fail", this.mochaTestFailed.bind(this));
21
52
  }
22
53
  registerEvents() {
23
54
  // Test
@@ -36,6 +67,7 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter {
36
67
  if (!this.currentTest) {
37
68
  return;
38
69
  }
70
+ this.currentTestHookName = undefined;
39
71
  var tags = test.tags || [];
40
72
  var extraTagLabels = tags.filter(tag => tag && !isMetadataTag(tag)).map(tag => tag.startsWith("@") ? tag.substring(1) : tag).map(tag => tag.trim()).filter(tag => tag.length > 0).map(tag => ({
41
73
  name: LabelName.TAG,
@@ -45,11 +77,16 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter {
45
77
  tr.labels.push(...extraTagLabels);
46
78
  });
47
79
  }
48
- testFailed(_, error) {
49
- var status = getStatusFromError({
50
- message: error.message
51
- });
80
+ testFailed(_, error, hookName) {
81
+ this.currentTestHookName = hookName;
82
+ var status = getCodeceptStatusFromError(error, hookName);
52
83
  var statusDetails = getMessageAndTraceFromError(error);
84
+ if (this.currentTest) {
85
+ this.runtime.updateTest(this.currentTest, result => {
86
+ result.status = status;
87
+ result.statusDetails = _objectSpread(_objectSpread({}, result.statusDetails), statusDetails);
88
+ });
89
+ }
53
90
  if (this.currentBddStep) {
54
91
  this.stopCurrentStep(result => {
55
92
  result.stage = Stage.FINISHED;
@@ -77,6 +114,7 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter {
77
114
  this.metaStepStack = [];
78
115
  }
79
116
  testFinished() {
117
+ this.currentTestHookName = undefined;
80
118
  if (this.currentBddStep) {
81
119
  this.runtime.updateStep(this.currentBddStep, result => {
82
120
  result.status = Status.PASSED;
@@ -162,25 +200,41 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter {
162
200
  });
163
201
  }
164
202
 
165
- // according to the docs, codeceptjs supposed to report the error,
166
- // but actually it's never reported
203
+ // Step errors are usually reported directly, but some paths still require
204
+ // reading the recorder rejection to populate the final step status/details.
167
205
  stepFailed(_, error) {
168
206
  if (!this.currentLeafStep) {
169
207
  return;
170
208
  }
171
- this.runtime.updateStep(this.currentLeafStep, result => {
209
+ var currentLeafStep = this.currentLeafStep;
210
+ this.runtime.updateStep(currentLeafStep, result => {
172
211
  result.stage = Stage.FINISHED;
173
212
  if (error) {
174
213
  if (!error.message && typeof error.inspect === "function") {
175
214
  error.message = error.inspect();
176
215
  }
177
- result.status = getStatusFromError(error);
216
+ result.status = isTryToSession() ? Status.BROKEN : getCodeceptStatusFromError(error);
178
217
  result.statusDetails = getMessageAndTraceFromError(error);
179
218
  } else {
180
- result.status = env.TRY_TO === "true" ? Status.BROKEN : Status.FAILED;
219
+ var promise = getRecorderPromise();
220
+ if (promise) {
221
+ promise.catch(err => {
222
+ if (!err.message && typeof err.inspect === "function") {
223
+ err.message = err.inspect();
224
+ }
225
+ if (isErrorInstance(err)) {
226
+ this.runtime.updateStep(currentLeafStep, step => {
227
+ step.status = isTryToSession() ? Status.BROKEN : getCodeceptStatusFromError(err);
228
+ step.statusDetails = getMessageAndTraceFromError(err);
229
+ });
230
+ }
231
+ return Promise.reject(err);
232
+ });
233
+ }
234
+ result.status = Status.BROKEN;
181
235
  }
182
236
  });
183
- this.runtime.stopStep(this.currentLeafStep);
237
+ this.runtime.stopStep(currentLeafStep);
184
238
  this.currentLeafStep = undefined;
185
239
  }
186
240
  stepComment() {
@@ -219,17 +273,16 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter {
219
273
  if (!currentStep) {
220
274
  return;
221
275
  }
222
- var promise = recorder.promise();
223
- // @ts-ignore
276
+ var promise = getRecorderPromise();
224
277
  if (promise) {
225
278
  promise.catch(err => {
226
279
  if (!err.message && typeof err.inspect === "function") {
227
280
  // AssertionFailedError doesn't set message attribute
228
281
  err.message = err.inspect();
229
282
  }
230
- if (err instanceof Error || err.constructor.name === "Error") {
283
+ if (isErrorInstance(err)) {
231
284
  this.runtime.updateStep(currentStep, step => {
232
- step.status = getStatusFromError(err);
285
+ step.status = isTryToSession() ? Status.BROKEN : getCodeceptStatusFromError(err);
233
286
  step.statusDetails = _objectSpread(_objectSpread({}, step.statusDetails), getMessageAndTraceFromError(err));
234
287
  });
235
288
  }
@@ -239,5 +292,14 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter {
239
292
  this.runtime.updateStep(currentStep, updateFunc);
240
293
  this.runtime.stopStep(currentStep);
241
294
  }
295
+ mochaTestFailed(_, error) {
296
+ if (!this.currentTest) {
297
+ return;
298
+ }
299
+ this.runtime.updateTest(this.currentTest, result => {
300
+ result.status = getCodeceptStatusFromError(error, this.currentTestHookName);
301
+ result.statusDetails = _objectSpread(_objectSpread({}, result.statusDetails), getMessageAndTraceFromError(error));
302
+ });
303
+ }
242
304
  }
243
305
  //# sourceMappingURL=reporter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.js","names":["event","recorder","env","LabelName","Stage","Status","getMessageAndTraceFromError","getStatusFromError","isMetadataTag","stripAnsi","AllureMochaReporter","MAX_META_STEP_NESTING","AllureCodeceptJsReporter","constructor","runner","opts","isInWorker","_defineProperty","undefined","registerEvents","dispatcher","on","test","before","testStarted","bind","failed","testFailed","finished","testFinished","step","started","stepStarted","passed","stepPassed","stepFailed","comment","stepComment","bddStep","bddStepStarted","after","currentTest","tags","extraTagLabels","filter","tag","map","startsWith","substring","trim","length","name","TAG","value","runtime","updateTest","tr","labels","push","_","error","status","message","statusDetails","currentBddStep","stopCurrentStep","result","stage","FINISHED","BROKEN","_objectSpread","id","metaStepStack","updateStep","stopStep","PASSED","currentLeafStep","_this$currentHook","_this$metaStepStack$i2","_this$metaStepStack2","root","currentHook","stepPath","current","metaStep","isBDD","_current$toString","unshift","toString","index","Math","min","i","s","slice","_this$metaStepStack$i","_this$metaStepStack","parentId","startStep","parent","_this$currentHook2","keyword","text","inspect","TRY_TO","FAILED","updateFunc","_this$currentHook3","currentStep","stopStepById","promise","catch","err","Error","Promise","reject"],"sources":["../../src/reporter.ts"],"sourcesContent":["import { event, recorder } from \"codeceptjs\";\nimport type * as Mocha from \"mocha\";\nimport { env } from \"node:process\";\nimport { LabelName, Stage, Status, type StepResult } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError, getStatusFromError, isMetadataTag, stripAnsi } from \"allure-js-commons/sdk\";\nimport AllureMochaReporter from \"allure-mocha\";\nimport type { CodeceptBddStep, CodeceptError, CodeceptStep } from \"./model.js\";\n\ninterface MetaStep {\n name: string;\n id: string;\n}\n\nconst MAX_META_STEP_NESTING = 10;\n\nexport class AllureCodeceptJsReporter extends AllureMochaReporter {\n protected currentBddStep?: string;\n protected metaStepStack: MetaStep[] = [];\n protected currentLeafStep?: string;\n\n constructor(runner: Mocha.Runner, opts: Mocha.MochaOptions, isInWorker: boolean) {\n super(runner, opts, isInWorker);\n this.registerEvents();\n }\n\n registerEvents() {\n // Test\n event.dispatcher.on(event.test.before, this.testStarted.bind(this));\n event.dispatcher.on(event.test.failed, this.testFailed.bind(this));\n event.dispatcher.on(event.test.finished, this.testFinished.bind(this));\n // Step\n event.dispatcher.on(event.step.started, this.stepStarted.bind(this));\n event.dispatcher.on(event.step.passed, this.stepPassed.bind(this));\n event.dispatcher.on(event.step.failed, this.stepFailed.bind(this));\n event.dispatcher.on(event.step.comment, this.stepComment.bind(this));\n\n event.dispatcher.on(event.bddStep.before, this.bddStepStarted.bind(this));\n event.dispatcher.on(event.bddStep.after, this.stepPassed.bind(this));\n }\n\n testStarted(test: { tags?: string[] }) {\n if (!this.currentTest) {\n return;\n }\n\n const tags = test.tags || [];\n const extraTagLabels = tags\n .filter((tag) => tag && !isMetadataTag(tag))\n .map((tag) => (tag.startsWith(\"@\") ? tag.substring(1) : tag))\n .map((tag) => tag.trim())\n .filter((tag) => tag.length > 0)\n .map((tag) => ({ name: LabelName.TAG, value: tag }));\n\n this.runtime.updateTest(this.currentTest, (tr) => {\n tr.labels.push(...extraTagLabels);\n });\n }\n\n testFailed(_: {}, error: Error) {\n const status = getStatusFromError({ message: error.message } as Error);\n const statusDetails = getMessageAndTraceFromError(error);\n if (this.currentBddStep) {\n this.stopCurrentStep((result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.BROKEN;\n if (error) {\n result.status = status;\n result.statusDetails = { ...statusDetails };\n }\n });\n }\n this.currentBddStep = undefined;\n\n for (const { id } of this.metaStepStack) {\n this.runtime.updateStep(id, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.BROKEN;\n if (error) {\n result.status = status;\n result.statusDetails = { ...statusDetails };\n }\n });\n this.runtime.stopStep(id);\n }\n this.metaStepStack = [];\n }\n\n testFinished() {\n if (this.currentBddStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n }\n this.currentBddStep = undefined;\n\n for (const { id } of this.metaStepStack) {\n this.runtime.updateStep(id, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(id);\n }\n\n this.metaStepStack = [];\n this.currentLeafStep = undefined;\n }\n\n stepStarted(step: CodeceptStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n\n const stepPath: string[] = [];\n let current = step.metaStep;\n while (current && !current.isBDD() && stepPath.length < MAX_META_STEP_NESTING) {\n stepPath.unshift(stripAnsi(current.toString() ?? \"\").trim());\n current = current.metaStep;\n }\n\n let index = 0;\n while (\n index < Math.min(this.metaStepStack.length, stepPath.length) &&\n this.metaStepStack[index].name === stepPath[index]\n ) {\n index++;\n }\n\n for (let i = this.metaStepStack.length - 1; i >= index; i--) {\n const { id } = this.metaStepStack[i];\n this.runtime.updateStep(id, (s) => {\n s.status = Status.PASSED;\n s.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(id);\n }\n this.metaStepStack = this.metaStepStack.slice(0, index);\n\n for (let i = index; i < stepPath.length; i++) {\n const name = stepPath[i];\n const parentId = this.metaStepStack[i - 1]?.id ?? root;\n const id = this.runtime.startStep(parentId, undefined, {\n name,\n });\n if (id) {\n this.metaStepStack.push({ name, id });\n }\n }\n\n const parent = this.metaStepStack[this.metaStepStack.length - 1]?.id ?? root;\n this.currentLeafStep = this.runtime.startStep(parent, undefined, {\n name: step.toString().trim(),\n });\n }\n\n bddStepStarted(step: CodeceptBddStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n if (this.currentBddStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n }\n this.currentBddStep = this.runtime.startStep(root, undefined, {\n name: step.keyword + step.text,\n });\n }\n\n // according to the docs, codeceptjs supposed to report the error,\n // but actually it's never reported\n stepFailed(_: CodeceptJS.Step, error?: CodeceptError) {\n if (!this.currentLeafStep) {\n return;\n }\n\n this.runtime.updateStep(this.currentLeafStep, (result) => {\n result.stage = Stage.FINISHED;\n if (error) {\n if (!error.message && typeof error.inspect === \"function\") {\n error.message = error.inspect();\n }\n result.status = getStatusFromError(error as unknown as Error);\n result.statusDetails = getMessageAndTraceFromError(error as unknown as Error);\n } else {\n result.status = env.TRY_TO === \"true\" ? Status.BROKEN : Status.FAILED;\n }\n });\n this.runtime.stopStep(this.currentLeafStep);\n this.currentLeafStep = undefined;\n }\n\n stepComment() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n }\n\n stepPassed() {\n if (this.currentBddStep && !this.currentLeafStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n this.currentBddStep = undefined;\n return;\n }\n\n if (!this.currentLeafStep) {\n return;\n }\n\n this.runtime.updateStep(this.currentLeafStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentLeafStep);\n this.currentLeafStep = undefined;\n }\n\n stopCurrentStep(updateFunc: (result: StepResult) => void) {\n const root = this.currentHook ?? this.currentTest;\n const currentStep = root ? this.runtime.currentStep(root) : undefined;\n\n this.stopStepById(currentStep, updateFunc);\n }\n\n stopStepById(currentStep: string | undefined, updateFunc: (result: StepResult) => void) {\n if (!currentStep) {\n return;\n }\n const promise = recorder.promise();\n // @ts-ignore\n if (promise) {\n promise.catch((err) => {\n if (!err.message && typeof err.inspect === \"function\") {\n // AssertionFailedError doesn't set message attribute\n err.message = err.inspect();\n }\n if (err instanceof Error || err.constructor.name === \"Error\") {\n this.runtime.updateStep(currentStep, (step) => {\n step.status = getStatusFromError(err as Error);\n step.statusDetails = { ...step.statusDetails, ...getMessageAndTraceFromError(err as Error) };\n });\n }\n return Promise.reject(err);\n });\n }\n\n this.runtime.updateStep(currentStep, updateFunc);\n this.runtime.stopStep(currentStep);\n }\n\n protected getFrameworkName = () => \"codeceptjs\";\n\n protected getWorkerId = () => undefined;\n}\n"],"mappings":";;;;;AAAA,SAASA,KAAK,EAAEC,QAAQ,QAAQ,YAAY;AAE5C,SAASC,GAAG,QAAQ,cAAc;AAClC,SAASC,SAAS,EAAEC,KAAK,EAAEC,MAAM,QAAyB,mBAAmB;AAC7E,SAASC,2BAA2B,EAAEC,kBAAkB,EAAEC,aAAa,EAAEC,SAAS,QAAQ,uBAAuB;AACjH,OAAOC,mBAAmB,MAAM,cAAc;AAQ9C,IAAMC,qBAAqB,GAAG,EAAE;AAEhC,OAAO,MAAMC,wBAAwB,SAASF,mBAAmB,CAAC;EAKhEG,WAAWA,CAACC,MAAoB,EAAEC,IAAwB,EAAEC,UAAmB,EAAE;IAC/E,KAAK,CAACF,MAAM,EAAEC,IAAI,EAAEC,UAAU,CAAC;IAACC,eAAA;IAAAA,eAAA,wBAJI,EAAE;IAAAA,eAAA;IAAAA,eAAA,2BAmPX,MAAM,YAAY;IAAAA,eAAA,sBAEvB,MAAMC,SAAS;IAhPrC,IAAI,CAACC,cAAc,CAAC,CAAC;EACvB;EAEAA,cAAcA,CAAA,EAAG;IACf;IACAnB,KAAK,CAACoB,UAAU,CAACC,EAAE,CAACrB,KAAK,CAACsB,IAAI,CAACC,MAAM,EAAE,IAAI,CAACC,WAAW,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnEzB,KAAK,CAACoB,UAAU,CAACC,EAAE,CAACrB,KAAK,CAACsB,IAAI,CAACI,MAAM,EAAE,IAAI,CAACC,UAAU,CAACF,IAAI,CAAC,IAAI,CAAC,CAAC;IAClEzB,KAAK,CAACoB,UAAU,CAACC,EAAE,CAACrB,KAAK,CAACsB,IAAI,CAACM,QAAQ,EAAE,IAAI,CAACC,YAAY,CAACJ,IAAI,CAAC,IAAI,CAAC,CAAC;IACtE;IACAzB,KAAK,CAACoB,UAAU,CAACC,EAAE,CAACrB,KAAK,CAAC8B,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CAAC;IAChD,IAAI,CAACpD,OAAO,CAACoB,QAAQ,CAACkC,WAAW,CAAC;EACpC;AAKF","ignoreList":[]}
1
+ {"version":3,"file":"reporter.js","names":["LabelName","Stage","Status","getMessageAndTraceFromError","getStatusFromError","isMetadataTag","stripAnsi","AllureMochaReporter","event","recorder","MAX_META_STEP_NESTING","TRY_TO_SESSION","knownCodeceptVerificationErrorPatterns","isKnownCodeceptVerificationError","error","message","some","pattern","test","getCodeceptStatusFromError","hookName","status","FAILED","BROKEN","isErrorInstance","value","_constructor","Error","constructor","name","isTryToSession","_recorder$getCurrentS","getCurrentSessionId","call","getRecorderPromise","_recorder$promise","promise","AllureCodeceptJsReporter","runner","opts","isInWorker","_defineProperty","undefined","registerEvents","on","mochaTestFailed","bind","dispatcher","before","testStarted","failed","testFailed","finished","testFinished","step","started","stepStarted","passed","stepPassed","stepFailed","comment","stepComment","bddStep","bddStepStarted","after","currentTest","currentTestHookName","tags","extraTagLabels","filter","tag","map","startsWith","substring","trim","length","TAG","runtime","updateTest","tr","labels","push","_","statusDetails","result","_objectSpread","currentBddStep","stopCurrentStep","stage","FINISHED","id","metaStepStack","updateStep","stopStep","PASSED","currentLeafStep","_this$currentHook","_this$metaStepStack$i2","_this$metaStepStack2","root","currentHook","stepPath","current","metaStep","isBDD","_current$toString","unshift","toString","index","Math","min","i","s","slice","_this$metaStepStack$i","_this$metaStepStack","parentId","startStep","parent","_this$currentHook2","keyword","text","inspect","catch","err","Promise","reject","updateFunc","_this$currentHook3","currentStep","stopStepById"],"sources":["../../src/reporter.ts"],"sourcesContent":["import { LabelName, Stage, Status, type StepResult } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError, getStatusFromError, isMetadataTag, stripAnsi } from \"allure-js-commons/sdk\";\nimport AllureMochaReporter from \"allure-mocha\";\nimport { event, recorder } from \"codeceptjs\";\nimport type * as Mocha from \"mocha\";\n\nimport type { CodeceptBddStep, CodeceptError, CodeceptStep } from \"./model.js\";\n\ninterface MetaStep {\n name: string;\n id: string;\n}\n\nconst MAX_META_STEP_NESTING = 10;\n// CodeceptJS tryTo() uses a dedicated \"tryTo\" recorder session.\n// Docs: https://codecept.io/effects.html\nconst TRY_TO_SESSION = \"tryTo\";\n\nconst knownCodeceptVerificationErrorPatterns = [\n /^Element \".+\" is (?:not visible on page|still visible on page|not seen in DOM|still seen in DOM)\\.?$/i,\n /^(?:Element|Clickable element|Context element|Frame|Option \".+\" in|Custom locator .+) .*\\b(?:not found|was not found)\\b/i,\n /^element \\(.+\\) .+ after \\d+(?:\\.\\d+)? sec(?:\\n|\\.|$)/i,\n /^Text \".+\" was not found on page after \\d+(?:\\.\\d+)? sec\\.?$/i,\n /^Expected \\d+ tabs are not met after \\d+(?:\\.\\d+)? sec\\.?$/i,\n /^Cookie .+ is not found after \\d+(?:\\.\\d+)?s$/i,\n] as const;\n\nconst isKnownCodeceptVerificationError = (error: Partial<Error>): boolean => {\n const message = error.message ? stripAnsi(error.message) : \"\";\n\n if (!message) {\n return false;\n }\n\n return knownCodeceptVerificationErrorPatterns.some((pattern) => pattern.test(message));\n};\n\nconst getCodeceptStatusFromError = (error: Partial<Error>, hookName?: string): Status => {\n const status = getStatusFromError(error);\n\n if (status === Status.FAILED || hookName) {\n return status;\n }\n\n return isKnownCodeceptVerificationError(error) ? Status.FAILED : Status.BROKEN;\n};\n\nconst isErrorInstance = (value: unknown): value is Error =>\n value instanceof Error ||\n (typeof value === \"object\" &&\n value !== null &&\n (value as { constructor?: { name?: unknown } }).constructor?.name === \"Error\");\n\nconst isTryToSession = () => recorder.getCurrentSessionId?.() === TRY_TO_SESSION;\nconst getRecorderPromise = (): Promise<unknown> | undefined =>\n (recorder.promise as (() => Promise<unknown> | undefined) | undefined)?.();\n\nexport class AllureCodeceptJsReporter extends AllureMochaReporter {\n protected currentBddStep?: string;\n protected metaStepStack: MetaStep[] = [];\n protected currentLeafStep?: string;\n protected currentTestHookName?: string;\n\n constructor(runner: Mocha.Runner, opts: Mocha.MochaOptions, isInWorker: boolean) {\n super(runner, opts, isInWorker);\n this.registerEvents();\n runner.on(\"fail\", this.mochaTestFailed.bind(this));\n }\n\n registerEvents() {\n // Test\n event.dispatcher.on(event.test.before, this.testStarted.bind(this));\n event.dispatcher.on(event.test.failed, this.testFailed.bind(this));\n event.dispatcher.on(event.test.finished, this.testFinished.bind(this));\n // Step\n event.dispatcher.on(event.step.started, this.stepStarted.bind(this));\n event.dispatcher.on(event.step.passed, this.stepPassed.bind(this));\n event.dispatcher.on(event.step.failed, this.stepFailed.bind(this));\n event.dispatcher.on(event.step.comment, this.stepComment.bind(this));\n\n event.dispatcher.on(event.bddStep.before, this.bddStepStarted.bind(this));\n event.dispatcher.on(event.bddStep.after, this.stepPassed.bind(this));\n }\n\n testStarted(test: { tags?: string[] }) {\n if (!this.currentTest) {\n return;\n }\n\n this.currentTestHookName = undefined;\n\n const tags = test.tags || [];\n const extraTagLabels = tags\n .filter((tag) => tag && !isMetadataTag(tag))\n .map((tag) => (tag.startsWith(\"@\") ? tag.substring(1) : tag))\n .map((tag) => tag.trim())\n .filter((tag) => tag.length > 0)\n .map((tag) => ({ name: LabelName.TAG, value: tag }));\n\n this.runtime.updateTest(this.currentTest, (tr) => {\n tr.labels.push(...extraTagLabels);\n });\n }\n\n testFailed(_: {}, error: Error, hookName?: string) {\n this.currentTestHookName = hookName;\n const status = getCodeceptStatusFromError(error, hookName);\n const statusDetails = getMessageAndTraceFromError(error);\n\n if (this.currentTest) {\n this.runtime.updateTest(this.currentTest, (result) => {\n result.status = status;\n result.statusDetails = {\n ...result.statusDetails,\n ...statusDetails,\n };\n });\n }\n\n if (this.currentBddStep) {\n this.stopCurrentStep((result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.BROKEN;\n if (error) {\n result.status = status;\n result.statusDetails = { ...statusDetails };\n }\n });\n }\n this.currentBddStep = undefined;\n\n for (const { id } of this.metaStepStack) {\n this.runtime.updateStep(id, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.BROKEN;\n if (error) {\n result.status = status;\n result.statusDetails = { ...statusDetails };\n }\n });\n this.runtime.stopStep(id);\n }\n this.metaStepStack = [];\n }\n\n testFinished() {\n this.currentTestHookName = undefined;\n if (this.currentBddStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n }\n this.currentBddStep = undefined;\n\n for (const { id } of this.metaStepStack) {\n this.runtime.updateStep(id, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(id);\n }\n\n this.metaStepStack = [];\n this.currentLeafStep = undefined;\n }\n\n stepStarted(step: CodeceptStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n\n const stepPath: string[] = [];\n let current = step.metaStep;\n while (current && !current.isBDD() && stepPath.length < MAX_META_STEP_NESTING) {\n stepPath.unshift(stripAnsi(current.toString() ?? \"\").trim());\n current = current.metaStep;\n }\n\n let index = 0;\n while (\n index < Math.min(this.metaStepStack.length, stepPath.length) &&\n this.metaStepStack[index].name === stepPath[index]\n ) {\n index++;\n }\n\n for (let i = this.metaStepStack.length - 1; i >= index; i--) {\n const { id } = this.metaStepStack[i];\n this.runtime.updateStep(id, (s) => {\n s.status = Status.PASSED;\n s.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(id);\n }\n this.metaStepStack = this.metaStepStack.slice(0, index);\n\n for (let i = index; i < stepPath.length; i++) {\n const name = stepPath[i];\n const parentId = this.metaStepStack[i - 1]?.id ?? root;\n const id = this.runtime.startStep(parentId, undefined, {\n name,\n });\n if (id) {\n this.metaStepStack.push({ name, id });\n }\n }\n\n const parent = this.metaStepStack[this.metaStepStack.length - 1]?.id ?? root;\n this.currentLeafStep = this.runtime.startStep(parent, undefined, {\n name: step.toString().trim(),\n });\n }\n\n bddStepStarted(step: CodeceptBddStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n if (this.currentBddStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n }\n this.currentBddStep = this.runtime.startStep(root, undefined, {\n name: step.keyword + step.text,\n });\n }\n\n // Step errors are usually reported directly, but some paths still require\n // reading the recorder rejection to populate the final step status/details.\n stepFailed(_: CodeceptJS.Step, error?: CodeceptError) {\n if (!this.currentLeafStep) {\n return;\n }\n\n const currentLeafStep = this.currentLeafStep;\n\n this.runtime.updateStep(currentLeafStep, (result) => {\n result.stage = Stage.FINISHED;\n if (error) {\n if (!error.message && typeof error.inspect === \"function\") {\n error.message = error.inspect();\n }\n result.status = isTryToSession() ? Status.BROKEN : getCodeceptStatusFromError(error as unknown as Error);\n result.statusDetails = getMessageAndTraceFromError(error as unknown as Error);\n } else {\n const promise = getRecorderPromise();\n if (promise) {\n promise.catch((err) => {\n if (!err.message && typeof err.inspect === \"function\") {\n err.message = err.inspect();\n }\n if (isErrorInstance(err)) {\n this.runtime.updateStep(currentLeafStep, (step) => {\n step.status = isTryToSession() ? Status.BROKEN : getCodeceptStatusFromError(err as Error);\n step.statusDetails = getMessageAndTraceFromError(err as Error);\n });\n }\n return Promise.reject(err);\n });\n }\n\n result.status = Status.BROKEN;\n }\n });\n this.runtime.stopStep(currentLeafStep);\n this.currentLeafStep = undefined;\n }\n\n stepComment() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n }\n\n stepPassed() {\n if (this.currentBddStep && !this.currentLeafStep) {\n this.runtime.updateStep(this.currentBddStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentBddStep);\n this.currentBddStep = undefined;\n return;\n }\n\n if (!this.currentLeafStep) {\n return;\n }\n\n this.runtime.updateStep(this.currentLeafStep, (result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n this.runtime.stopStep(this.currentLeafStep);\n this.currentLeafStep = undefined;\n }\n\n stopCurrentStep(updateFunc: (result: StepResult) => void) {\n const root = this.currentHook ?? this.currentTest;\n const currentStep = root ? this.runtime.currentStep(root) : undefined;\n\n this.stopStepById(currentStep, updateFunc);\n }\n\n stopStepById(currentStep: string | undefined, updateFunc: (result: StepResult) => void) {\n if (!currentStep) {\n return;\n }\n const promise = getRecorderPromise();\n if (promise) {\n promise.catch((err) => {\n if (!err.message && typeof err.inspect === \"function\") {\n // AssertionFailedError doesn't set message attribute\n err.message = err.inspect();\n }\n if (isErrorInstance(err)) {\n this.runtime.updateStep(currentStep, (step) => {\n step.status = isTryToSession() ? Status.BROKEN : getCodeceptStatusFromError(err as Error);\n step.statusDetails = { ...step.statusDetails, ...getMessageAndTraceFromError(err as Error) };\n });\n }\n return Promise.reject(err);\n });\n }\n\n this.runtime.updateStep(currentStep, updateFunc);\n this.runtime.stopStep(currentStep);\n }\n\n mochaTestFailed(_: Mocha.Test, error: Error) {\n if (!this.currentTest) {\n return;\n }\n\n this.runtime.updateTest(this.currentTest, (result) => {\n result.status = getCodeceptStatusFromError(error, this.currentTestHookName);\n result.statusDetails = {\n ...result.statusDetails,\n ...getMessageAndTraceFromError(error),\n };\n });\n }\n\n protected getFrameworkName = () => \"codeceptjs\";\n\n protected getWorkerId = () => undefined;\n}\n"],"mappings":";;;;;AAAA,SAASA,SAAS,EAAEC,KAAK,EAAEC,MAAM,QAAyB,mBAAmB;AAC7E,SAASC,2BAA2B,EAAEC,kBAAkB,EAAEC,aAAa,EAAEC,SAAS,QAAQ,uBAAuB;AACjH,OAAOC,mBAAmB,MAAM,cAAc;AAC9C,SAASC,KAAK,EAAEC,QAAQ,QAAQ,YAAY;AAU5C,IAAMC,qBAAqB,GAAG,EAAE;AAChC;AACA;AACA,IAAMC,cAAc,GAAG,OAAO;AAE9B,IAAMC,sCAAsC,GAAG,CAC7C,uGAAuG,EACvG,0HAA0H,EAC1H,wDAAwD,EACxD,+DAA+D,EAC/D,6DAA6D,E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EkB,MAAM,CAACD,aAAa,GAAAE,aAAA,CAAAA,aAAA,KACfD,MAAM,CAACD,aAAa,GACpBhF,2BAA2B,CAACW,KAAK,CAAC,CACtC;IACH,CAAC,CAAC;EACJ;AAKF","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import type { ReporterConfig } from "allure-js-commons/sdk/reporter";
3
4
  declare const allurePlugin: (config: ReporterConfig) => {
4
5
  addAttachment: (name: string, content: Buffer | string, contentType: string) => void;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  /**
3
4
  * @deprecated please use api exported by "allure-js-commons" instead.
4
5
  */
@@ -1,6 +1,6 @@
1
- import type * as Mocha from "mocha";
2
1
  import { type StepResult } from "allure-js-commons";
3
2
  import AllureMochaReporter from "allure-mocha";
3
+ import type * as Mocha from "mocha";
4
4
  import type { CodeceptBddStep, CodeceptError, CodeceptStep } from "./model.js";
5
5
  interface MetaStep {
6
6
  name: string;
@@ -10,12 +10,13 @@ export declare class AllureCodeceptJsReporter extends AllureMochaReporter {
10
10
  protected currentBddStep?: string;
11
11
  protected metaStepStack: MetaStep[];
12
12
  protected currentLeafStep?: string;
13
+ protected currentTestHookName?: string;
13
14
  constructor(runner: Mocha.Runner, opts: Mocha.MochaOptions, isInWorker: boolean);
14
15
  registerEvents(): void;
15
16
  testStarted(test: {
16
17
  tags?: string[];
17
18
  }): void;
18
- testFailed(_: {}, error: Error): void;
19
+ testFailed(_: {}, error: Error, hookName?: string): void;
19
20
  testFinished(): void;
20
21
  stepStarted(step: CodeceptStep): void;
21
22
  bddStepStarted(step: CodeceptBddStep): void;
@@ -24,6 +25,7 @@ export declare class AllureCodeceptJsReporter extends AllureMochaReporter {
24
25
  stepPassed(): void;
25
26
  stopCurrentStep(updateFunc: (result: StepResult) => void): void;
26
27
  stopStepById(currentStep: string | undefined, updateFunc: (result: StepResult) => void): void;
28
+ mochaTestFailed(_: Mocha.Test, error: Error): void;
27
29
  protected getFrameworkName: () => string;
28
30
  protected getWorkerId: () => undefined;
29
31
  }
package/package.json CHANGED
@@ -1,24 +1,30 @@
1
1
  {
2
2
  "name": "allure-codeceptjs",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "Allure codeceptjs integration",
5
5
  "keywords": [
6
6
  "allure",
7
7
  "codeceptjs",
8
8
  "html",
9
- "test",
10
9
  "report",
11
10
  "reporter",
11
+ "test",
12
12
  "testing",
13
13
  "testops"
14
14
  ],
15
15
  "homepage": "https://allurereport.org/",
16
+ "license": "Apache-2.0",
16
17
  "repository": {
17
18
  "type": "git",
18
19
  "url": "https://github.com/allure-framework/allure-js.git",
19
20
  "directory": "packages/allure-codeceptjs"
20
21
  },
21
- "license": "Apache-2.0",
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "main": "./dist/cjs/index.js",
26
+ "module": "./dist/esm/index.js",
27
+ "types": "./dist/types/index.d.ts",
22
28
  "exports": {
23
29
  ".": {
24
30
  "types": "./dist/types/index.d.ts",
@@ -26,12 +32,6 @@
26
32
  "require": "./dist/cjs/index.js"
27
33
  }
28
34
  },
29
- "main": "./dist/cjs/index.js",
30
- "module": "./dist/esm/index.js",
31
- "types": "./dist/types/index.d.ts",
32
- "files": [
33
- "dist"
34
- ],
35
35
  "scripts": {
36
36
  "allure-report": "allure serve ./out/allure-results",
37
37
  "clean": "rimraf ./dist ./out ./test-results",
@@ -41,13 +41,13 @@
41
41
  "compile:types": "tsc",
42
42
  "compile:fixup": "node ./scripts/fixup.mjs",
43
43
  "generate-report": "allure generate ./out/allure-results -o ./out/allure-report --clean",
44
- "lint": "eslint ./src ./test --ext .ts",
45
- "lint:fix": "eslint ./src ./test --ext .ts --fix",
44
+ "lint": "oxlint --import-plugin src test",
45
+ "lint:fix": "oxlint --import-plugin --fix src test",
46
46
  "test": "vitest run"
47
47
  },
48
48
  "dependencies": {
49
- "allure-js-commons": "3.6.0",
50
- "allure-mocha": "3.6.0"
49
+ "allure-js-commons": "3.7.0",
50
+ "allure-mocha": "3.7.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@babel/cli": "^7.28.0",
@@ -57,26 +57,15 @@
57
57
  "@babel/preset-typescript": "^7.27.1",
58
58
  "@codeceptjs/configure": "^1.0.0",
59
59
  "@codeceptjs/helper": "^2.0.4",
60
- "@stylistic/eslint-plugin": "^2.6.1",
61
60
  "@types/babel__core": "^7.20.5",
62
61
  "@types/babel__preset-env": "^7.10.0",
63
- "@types/eslint": "^8.56.11",
64
62
  "@types/jasmine": "^5.1.4",
65
- "@types/node": "^20.14.2",
66
- "@typescript-eslint/eslint-plugin": "^8.0.0",
67
- "@typescript-eslint/parser": "^8.0.0",
63
+ "@types/node": "^20.19.0",
68
64
  "allure-commandline": "^2.29.0",
69
- "allure-vitest": "3.6.0",
65
+ "allure-vitest": "3.7.0",
70
66
  "babel-plugin-add-module-exports": "^1.0.4",
71
67
  "codeceptjs": "^3.7.6-beta.1",
72
68
  "codeceptjs-expect": "^1.0.3",
73
- "eslint": "^8.57.0",
74
- "eslint-config-prettier": "^10.0.0",
75
- "eslint-plugin-import": "^2.29.1",
76
- "eslint-plugin-jsdoc": "^54.0.0",
77
- "eslint-plugin-n": "^17.10.1",
78
- "eslint-plugin-no-null": "^1.0.2",
79
- "eslint-plugin-prefer-arrow": "^1.2.3",
80
69
  "npm-run-all2": "^8.0.0",
81
70
  "rimraf": "^6.0.0",
82
71
  "typescript": "^5.2.2",