allure-codeceptjs 3.0.8 → 3.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","names":[],"sources":["../../src/model.ts"],"sourcesContent":["export interface CodeceptError {\n params: any;\n template: string;\n showDiff: boolean;\n actual: string;\n expected: string;\n cliMessage: () => string;\n message: string;\n inspect: () => string;\n}\n\nexport interface CodeceptStep {\n actor: string;\n name: string;\n helperMethod: string;\n suffix: string;\n prefix: string;\n comment: string;\n args: string[];\n status: string;\n metaStep: CodeceptStep;\n toString: () => string;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"model.js","names":[],"sources":["../../src/model.ts"],"sourcesContent":["export interface CodeceptError {\n params: any;\n template: string;\n showDiff: boolean;\n actual: string;\n expected: string;\n cliMessage: () => string;\n message: string;\n inspect: () => string;\n}\n\nexport interface CodeceptStep {\n actor: string;\n name: string;\n helperMethod: string;\n suffix: string;\n prefix: string;\n comment: string;\n args: string[];\n status: string;\n metaStep: CodeceptStep;\n toString: () => string;\n}\n\nexport interface CodeceptBddStep {\n id: string;\n keyword: string;\n keywordType: string;\n text: string;\n startTime: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -18,6 +18,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
18
18
  class AllureCodeceptJsReporter extends _allureMocha.default {
19
19
  constructor(runner, opts, isInWorker) {
20
20
  super(runner, opts, isInWorker);
21
+ _defineProperty(this, "currentBddStep", void 0);
21
22
  _defineProperty(this, "getFrameworkName", () => "codeceptjs");
22
23
  _defineProperty(this, "getWorkerId", () => undefined);
23
24
  this.registerEvents();
@@ -25,11 +26,14 @@ class AllureCodeceptJsReporter extends _allureMocha.default {
25
26
  registerEvents() {
26
27
  // Test
27
28
  _codeceptjs.event.dispatcher.on(_codeceptjs.event.test.before, this.testStarted.bind(this));
29
+ _codeceptjs.event.dispatcher.on(_codeceptjs.event.test.failed, this.testFailed.bind(this));
28
30
  // Step
29
31
  _codeceptjs.event.dispatcher.on(_codeceptjs.event.step.started, this.stepStarted.bind(this));
30
32
  _codeceptjs.event.dispatcher.on(_codeceptjs.event.step.passed, this.stepPassed.bind(this));
31
33
  _codeceptjs.event.dispatcher.on(_codeceptjs.event.step.failed, this.stepFailed.bind(this));
32
34
  _codeceptjs.event.dispatcher.on(_codeceptjs.event.step.comment, this.stepComment.bind(this));
35
+ _codeceptjs.event.dispatcher.on(_codeceptjs.event.bddStep.before, this.bddStepStarted.bind(this));
36
+ _codeceptjs.event.dispatcher.on(_codeceptjs.event.bddStep.after, this.stepPassed.bind(this));
33
37
  }
34
38
  testStarted(test) {
35
39
  if (!this.currentTest) {
@@ -44,6 +48,21 @@ class AllureCodeceptJsReporter extends _allureMocha.default {
44
48
  tr.labels.push(...extraTagLabels);
45
49
  });
46
50
  }
51
+ testFailed(_, error) {
52
+ if (this.currentBddStep) {
53
+ this.stopCurrentStep(result => {
54
+ result.stage = _allureJsCommons.Stage.FINISHED;
55
+ result.status = _allureJsCommons.Status.BROKEN;
56
+ if (error) {
57
+ result.status = (0, _sdk.getStatusFromError)({
58
+ message: error.message
59
+ });
60
+ result.statusDetails = (0, _sdk.getMessageAndTraceFromError)(error);
61
+ }
62
+ });
63
+ }
64
+ this.currentBddStep = undefined;
65
+ }
47
66
  stepStarted(step) {
48
67
  var _this$currentHook;
49
68
  var root = (_this$currentHook = this.currentHook) !== null && _this$currentHook !== void 0 ? _this$currentHook : this.currentTest;
@@ -54,6 +73,16 @@ class AllureCodeceptJsReporter extends _allureMocha.default {
54
73
  name: step.toString().trim()
55
74
  });
56
75
  }
76
+ bddStepStarted(step) {
77
+ var _this$currentHook2;
78
+ var root = (_this$currentHook2 = this.currentHook) !== null && _this$currentHook2 !== void 0 ? _this$currentHook2 : this.currentTest;
79
+ if (!root) {
80
+ return;
81
+ }
82
+ this.currentBddStep = this.runtime.startStep(root, undefined, {
83
+ name: step.keyword + step.text
84
+ });
85
+ }
57
86
 
58
87
  // according to the docs, codeceptjs supposed to report the error,
59
88
  // but actually it's never reported
@@ -83,8 +112,8 @@ class AllureCodeceptJsReporter extends _allureMocha.default {
83
112
  });
84
113
  }
85
114
  stopCurrentStep(updateFunc) {
86
- var _this$currentHook2;
87
- var root = (_this$currentHook2 = this.currentHook) !== null && _this$currentHook2 !== void 0 ? _this$currentHook2 : this.currentTest;
115
+ var _this$currentHook3;
116
+ var root = (_this$currentHook3 = this.currentHook) !== null && _this$currentHook3 !== void 0 ? _this$currentHook3 : this.currentTest;
88
117
  var currentStep = root ? this.runtime.currentStep(root) : undefined;
89
118
  if (!currentStep) {
90
119
  return;
@@ -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","AllureCodeceptJsReporter","AllureMochaReporter","constructor","runner","opts","isInWorker","undefined","registerEvents","event","dispatcher","on","test","before","testStarted","bind","step","started","stepStarted","passed","stepPassed","failed","stepFailed","comment","stepComment","currentTest","tags","extraTagLabels","tag","isMetadataTag","map","startsWith","substring","trim","name","LabelName","TAG","runtime","updateTest","tr","labels","_this$currentHook","root","currentHook","startStep","toString","_","error","stopCurrentStep","result","stage","Stage","FINISHED","status","getStatusFromError","message","statusDetails","getMessageAndTraceFromError","env","TRY_TO","Status","BROKEN","FAILED","PASSED","updateFunc","_this$currentHook2","currentStep","promise","recorder","catch","err","inspect","Error","updateStep","Promise","reject","stopStep","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 } from \"allure-js-commons/sdk\";\nimport AllureMochaReporter from \"allure-mocha\";\nimport type { CodeceptError, CodeceptStep } from \"./model.js\";\n\nexport class AllureCodeceptJsReporter extends AllureMochaReporter {\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 // 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\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 stepStarted(step: CodeceptStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n this.runtime.startStep(root, undefined, {\n name: step.toString().trim(),\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 this.stopCurrentStep((result) => {\n result.stage = Stage.FINISHED;\n if (error) {\n result.status = getStatusFromError({ message: error.message } as Error);\n result.statusDetails = getMessageAndTraceFromError(error);\n } else {\n result.status = env.TRY_TO === \"true\" ? Status.BROKEN : Status.FAILED;\n }\n });\n }\n\n stepComment() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n }\n\n stepPassed() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\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 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,UA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,OAAO,CAAC,CAAC;IAClC;IACA,IAAIA,OAAO,EAAE;MACXA,OAAO,CAACE,KAAK,CAAEC,GAAG,IAAK;QACrB,IAAI,CAACA,GAAG,CAACf,OAAO,IAAI,OAAOe,GAAG,CAACC,OAAO,KAAK,UAAU,EAAE;UACrD;UACAD,GAAG,CAACf,OAAO,GAAGe,GAAG,CAACC,OAAO,CAAC,CAAC;QAC7B;QACA,IAAID,GAAG,YAAYE,KAAK,IAAIF,GAAG,CAACnE,WAAW,CAAC+B,IAAI,KAAK,OAAO,EAAE;UAC5D,IAAI,CAACG,OAAO,CAACoC,UAAU,CAACP,WAAW,EAAGlD,IAAI,IAAK;YAC7CA,IAAI,CAACqC,MAAM,GAAG,IAAAC,uBAAkB,EAACgB,GAAY,CAAC;YAC9CtD,IAAI,CAACwC,aAAa,GAAA3E,aAAA,CAAAA,aAAA,KAAQmC,IAAI,CAACwC,aAAa,GAAK,IAAAC,gCAA2B,EAACa,GAAY,CAAC,CAAE;UAC9F,CAAC,CAAC;QACJ;QACA,OAAOI,OAAO,CAACC,MAAM,CAACL,GAAG,CAAC;MAC5B,CAAC,CAAC;IACJ;IAEA,IAAI,CAACjC,OAAO,CAACoC,UAAU,CAACP,WAAW,EAAEF,UAAU,CAAC;IAChD,IAAI,CAAC3B,OAAO,CAACuC,QAAQ,CAACV,WAAW,CAAC;EACpC;AAKF;AAACW,OAAA,CAAA5E,wBAAA,GAAAA,wBAAA","ignoreList":[]}
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","AllureCodeceptJsReporter","AllureMochaReporter","constructor","runner","opts","isInWorker","undefined","registerEvents","event","dispatcher","on","test","before","testStarted","bind","failed","testFailed","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","currentBddStep","stopCurrentStep","result","stage","Stage","FINISHED","status","Status","BROKEN","getStatusFromError","message","statusDetails","getMessageAndTraceFromError","_this$currentHook","root","currentHook","startStep","toString","_this$currentHook2","keyword","text","env","TRY_TO","FAILED","PASSED","updateFunc","_this$currentHook3","currentStep","promise","recorder","catch","err","inspect","Error","updateStep","Promise","reject","stopStep","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 } from \"allure-js-commons/sdk\";\nimport AllureMochaReporter from \"allure-mocha\";\nimport type { CodeceptBddStep, CodeceptError, CodeceptStep } from \"./model.js\";\n\nexport class AllureCodeceptJsReporter extends AllureMochaReporter {\n protected currentBddStep?: 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 // 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 if (this.currentBddStep) {\n this.stopCurrentStep((result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.BROKEN;\n if (error) {\n result.status = getStatusFromError({ message: error.message } as Error);\n result.statusDetails = getMessageAndTraceFromError(error);\n }\n });\n }\n this.currentBddStep = undefined;\n }\n\n stepStarted(step: CodeceptStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n this.runtime.startStep(root, 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 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 this.stopCurrentStep((result) => {\n result.stage = Stage.FINISHED;\n if (error) {\n result.status = getStatusFromError({ message: error.message } as Error);\n result.statusDetails = getMessageAndTraceFromError(error);\n } else {\n result.status = env.TRY_TO === \"true\" ? Status.BROKEN : Status.FAILED;\n }\n });\n }\n\n stepComment() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n }\n\n stepPassed() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\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 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,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAf,CAAA,aAAAI,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAA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,OAAOqB,GAAG,CAACC,OAAO,KAAK,UAAU,EAAE;UACrD;UACAD,GAAG,CAACrB,OAAO,GAAGqB,GAAG,CAACC,OAAO,CAAC,CAAC;QAC7B;QACA,IAAID,GAAG,YAAYE,KAAK,IAAIF,GAAG,CAAC3E,WAAW,CAACmC,IAAI,KAAK,OAAO,EAAE;UAC5D,IAAI,CAACG,OAAO,CAACwC,UAAU,CAACP,WAAW,EAAGxD,IAAI,IAAK;YAC7CA,IAAI,CAACmC,MAAM,GAAG,IAAAG,uBAAkB,EAACsB,GAAY,CAAC;YAC9C5D,IAAI,CAACwC,aAAa,GAAA7E,aAAA,CAAAA,aAAA,KAAQqC,IAAI,CAACwC,aAAa,GAAK,IAAAC,gCAA2B,EAACmB,GAAY,CAAC,CAAE;UAC9F,CAAC,CAAC;QACJ;QACA,OAAOI,OAAO,CAACC,MAAM,CAACL,GAAG,CAAC;MAC5B,CAAC,CAAC;IACJ;IAEA,IAAI,CAACrC,OAAO,CAACwC,UAAU,CAACP,WAAW,EAAEF,UAAU,CAAC;IAChD,IAAI,CAAC/B,OAAO,CAAC2C,QAAQ,CAACV,WAAW,CAAC;EACpC;AAKF;AAACW,OAAA,CAAApF,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","names":[],"sources":["../../src/model.ts"],"sourcesContent":["export interface CodeceptError {\n params: any;\n template: string;\n showDiff: boolean;\n actual: string;\n expected: string;\n cliMessage: () => string;\n message: string;\n inspect: () => string;\n}\n\nexport interface CodeceptStep {\n actor: string;\n name: string;\n helperMethod: string;\n suffix: string;\n prefix: string;\n comment: string;\n args: string[];\n status: string;\n metaStep: CodeceptStep;\n toString: () => string;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"model.js","names":[],"sources":["../../src/model.ts"],"sourcesContent":["export interface CodeceptError {\n params: any;\n template: string;\n showDiff: boolean;\n actual: string;\n expected: string;\n cliMessage: () => string;\n message: string;\n inspect: () => string;\n}\n\nexport interface CodeceptStep {\n actor: string;\n name: string;\n helperMethod: string;\n suffix: string;\n prefix: string;\n comment: string;\n args: string[];\n status: string;\n metaStep: CodeceptStep;\n toString: () => string;\n}\n\nexport interface CodeceptBddStep {\n id: string;\n keyword: string;\n keywordType: string;\n text: string;\n startTime: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -11,6 +11,7 @@ import AllureMochaReporter from "allure-mocha";
11
11
  export class AllureCodeceptJsReporter extends AllureMochaReporter {
12
12
  constructor(runner, opts, isInWorker) {
13
13
  super(runner, opts, isInWorker);
14
+ _defineProperty(this, "currentBddStep", void 0);
14
15
  _defineProperty(this, "getFrameworkName", () => "codeceptjs");
15
16
  _defineProperty(this, "getWorkerId", () => undefined);
16
17
  this.registerEvents();
@@ -18,11 +19,14 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter {
18
19
  registerEvents() {
19
20
  // Test
20
21
  event.dispatcher.on(event.test.before, this.testStarted.bind(this));
22
+ event.dispatcher.on(event.test.failed, this.testFailed.bind(this));
21
23
  // Step
22
24
  event.dispatcher.on(event.step.started, this.stepStarted.bind(this));
23
25
  event.dispatcher.on(event.step.passed, this.stepPassed.bind(this));
24
26
  event.dispatcher.on(event.step.failed, this.stepFailed.bind(this));
25
27
  event.dispatcher.on(event.step.comment, this.stepComment.bind(this));
28
+ event.dispatcher.on(event.bddStep.before, this.bddStepStarted.bind(this));
29
+ event.dispatcher.on(event.bddStep.after, this.stepPassed.bind(this));
26
30
  }
27
31
  testStarted(test) {
28
32
  if (!this.currentTest) {
@@ -37,6 +41,21 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter {
37
41
  tr.labels.push(...extraTagLabels);
38
42
  });
39
43
  }
44
+ testFailed(_, error) {
45
+ if (this.currentBddStep) {
46
+ this.stopCurrentStep(result => {
47
+ result.stage = Stage.FINISHED;
48
+ result.status = Status.BROKEN;
49
+ if (error) {
50
+ result.status = getStatusFromError({
51
+ message: error.message
52
+ });
53
+ result.statusDetails = getMessageAndTraceFromError(error);
54
+ }
55
+ });
56
+ }
57
+ this.currentBddStep = undefined;
58
+ }
40
59
  stepStarted(step) {
41
60
  var _this$currentHook;
42
61
  var root = (_this$currentHook = this.currentHook) !== null && _this$currentHook !== void 0 ? _this$currentHook : this.currentTest;
@@ -47,6 +66,16 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter {
47
66
  name: step.toString().trim()
48
67
  });
49
68
  }
69
+ bddStepStarted(step) {
70
+ var _this$currentHook2;
71
+ var root = (_this$currentHook2 = this.currentHook) !== null && _this$currentHook2 !== void 0 ? _this$currentHook2 : this.currentTest;
72
+ if (!root) {
73
+ return;
74
+ }
75
+ this.currentBddStep = this.runtime.startStep(root, undefined, {
76
+ name: step.keyword + step.text
77
+ });
78
+ }
50
79
 
51
80
  // according to the docs, codeceptjs supposed to report the error,
52
81
  // but actually it's never reported
@@ -76,8 +105,8 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter {
76
105
  });
77
106
  }
78
107
  stopCurrentStep(updateFunc) {
79
- var _this$currentHook2;
80
- var root = (_this$currentHook2 = this.currentHook) !== null && _this$currentHook2 !== void 0 ? _this$currentHook2 : this.currentTest;
108
+ var _this$currentHook3;
109
+ var root = (_this$currentHook3 = this.currentHook) !== null && _this$currentHook3 !== void 0 ? _this$currentHook3 : this.currentTest;
81
110
  var currentStep = root ? this.runtime.currentStep(root) : undefined;
82
111
  if (!currentStep) {
83
112
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.js","names":["event","recorder","env","LabelName","Stage","Status","getMessageAndTraceFromError","getStatusFromError","isMetadataTag","AllureMochaReporter","AllureCodeceptJsReporter","constructor","runner","opts","isInWorker","_defineProperty","undefined","registerEvents","dispatcher","on","test","before","testStarted","bind","step","started","stepStarted","passed","stepPassed","failed","stepFailed","comment","stepComment","currentTest","tags","extraTagLabels","filter","tag","map","startsWith","substring","trim","length","name","TAG","value","runtime","updateTest","tr","labels","push","_this$currentHook","root","currentHook","startStep","toString","_","error","stopCurrentStep","result","stage","FINISHED","status","message","statusDetails","TRY_TO","BROKEN","FAILED","PASSED","updateFunc","_this$currentHook2","currentStep","promise","catch","err","inspect","Error","updateStep","_objectSpread","Promise","reject","stopStep"],"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 } from \"allure-js-commons/sdk\";\nimport AllureMochaReporter from \"allure-mocha\";\nimport type { CodeceptError, CodeceptStep } from \"./model.js\";\n\nexport class AllureCodeceptJsReporter extends AllureMochaReporter {\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 // 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\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 stepStarted(step: CodeceptStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n this.runtime.startStep(root, undefined, {\n name: step.toString().trim(),\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 this.stopCurrentStep((result) => {\n result.stage = Stage.FINISHED;\n if (error) {\n result.status = getStatusFromError({ message: error.message } as Error);\n result.statusDetails = getMessageAndTraceFromError(error);\n } else {\n result.status = env.TRY_TO === \"true\" ? Status.BROKEN : Status.FAILED;\n }\n });\n }\n\n stepComment() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n }\n\n stepPassed() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\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 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,QAAQ,uBAAuB;AACtG,OAAOC,mBAAmB,MAAM,cAAc;AAG9C,OAAO,MAAMC,wBAAwB,SAASD,mBAAmB,CAAC;EAChEE,WAAWA,CAACC,MAAoB,EAAEC,IAAwB,EAAEC,UAAmB,EAAE;IAC/E,KAAK,CA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,IAAI,KAAK,OAAO,EAAE;UAC5D,IAAI,CAACG,OAAO,CAAC+B,UAAU,CAACN,WAAW,EAAG/C,IAAI,IAAK;YAC7CA,IAAI,CAACsC,MAAM,GAAGvD,kBAAkB,CAACmE,GAAY,CAAC;YAC9ClD,IAAI,CAACwC,aAAa,GAAAc,aAAA,CAAAA,aAAA,KAAQtD,IAAI,CAACwC,aAAa,GAAK1D,2BAA2B,CAACoE,GAAY,CAAC,CAAE;UAC9F,CAAC,CAAC;QACJ;QACA,OAAOK,OAAO,CAACC,MAAM,CAACN,GAAG,CAAC;MAC5B,CAAC,CAAC;IACJ;IAEA,IAAI,CAAC5B,OAAO,CAAC+B,UAAU,CAACN,WAAW,EAAEF,UAAU,CAAC;IAChD,IAAI,CAACvB,OAAO,CAACmC,QAAQ,CAACV,WAAW,CAAC;EACpC;AAKF","ignoreList":[]}
1
+ {"version":3,"file":"reporter.js","names":["event","recorder","env","LabelName","Stage","Status","getMessageAndTraceFromError","getStatusFromError","isMetadataTag","AllureMochaReporter","AllureCodeceptJsReporter","constructor","runner","opts","isInWorker","_defineProperty","undefined","registerEvents","dispatcher","on","test","before","testStarted","bind","failed","testFailed","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","currentBddStep","stopCurrentStep","result","stage","FINISHED","status","BROKEN","message","statusDetails","_this$currentHook","root","currentHook","startStep","toString","_this$currentHook2","keyword","text","TRY_TO","FAILED","PASSED","updateFunc","_this$currentHook3","currentStep","promise","catch","err","inspect","Error","updateStep","_objectSpread","Promise","reject","stopStep"],"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 } from \"allure-js-commons/sdk\";\nimport AllureMochaReporter from \"allure-mocha\";\nimport type { CodeceptBddStep, CodeceptError, CodeceptStep } from \"./model.js\";\n\nexport class AllureCodeceptJsReporter extends AllureMochaReporter {\n protected currentBddStep?: 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 // 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 if (this.currentBddStep) {\n this.stopCurrentStep((result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.BROKEN;\n if (error) {\n result.status = getStatusFromError({ message: error.message } as Error);\n result.statusDetails = getMessageAndTraceFromError(error);\n }\n });\n }\n this.currentBddStep = undefined;\n }\n\n stepStarted(step: CodeceptStep) {\n const root = this.currentHook ?? this.currentTest;\n if (!root) {\n return;\n }\n this.runtime.startStep(root, 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 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 this.stopCurrentStep((result) => {\n result.stage = Stage.FINISHED;\n if (error) {\n result.status = getStatusFromError({ message: error.message } as Error);\n result.statusDetails = getMessageAndTraceFromError(error);\n } else {\n result.status = env.TRY_TO === \"true\" ? Status.BROKEN : Status.FAILED;\n }\n });\n }\n\n stepComment() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\n }\n\n stepPassed() {\n this.stopCurrentStep((result) => {\n result.status = Status.PASSED;\n result.stage = Stage.FINISHED;\n });\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 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,Q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OAAO,EAAE;MACXA,OAAO,CAACC,KAAK,CAAEC,GAAG,IAAK;QACrB,IAAI,CAACA,GAAG,CAAClB,OAAO,IAAI,OAAOkB,GAAG,CAACC,OAAO,KAAK,UAAU,EAAE;UACrD;UACAD,GAAG,CAAClB,OAAO,GAAGkB,GAAG,CAACC,OAAO,CAAC,CAAC;QAC7B;QACA,IAAID,GAAG,YAAYE,KAAK,IAAIF,GAAG,CAACvE,WAAW,CAACoC,IAAI,KAAK,OAAO,EAAE;UAC5D,IAAI,CAACG,OAAO,CAACmC,UAAU,CAACN,WAAW,EAAGrD,IAAI,IAAK;YAC7CA,IAAI,CAACoC,MAAM,GAAGvD,kBAAkB,CAAC2E,GAAY,CAAC;YAC9CxD,IAAI,CAACuC,aAAa,GAAAqB,aAAA,CAAAA,aAAA,KAAQ5D,IAAI,CAACuC,aAAa,GAAK3D,2BAA2B,CAAC4E,GAAY,CAAC,CAAE;UAC9F,CAAC,CAAC;QACJ;QACA,OAAOK,OAAO,CAACC,MAAM,CAACN,GAAG,CAAC;MAC5B,CAAC,CAAC;IACJ;IAEA,IAAI,CAAChC,OAAO,CAACmC,UAAU,CAACN,WAAW,EAAEF,UAAU,CAAC;IAChD,IAAI,CAAC3B,OAAO,CAACuC,QAAQ,CAACV,WAAW,CAAC;EACpC;AAKF","ignoreList":[]}
@@ -20,3 +20,10 @@ export interface CodeceptStep {
20
20
  metaStep: CodeceptStep;
21
21
  toString: () => string;
22
22
  }
23
+ export interface CodeceptBddStep {
24
+ id: string;
25
+ keyword: string;
26
+ keywordType: string;
27
+ text: string;
28
+ startTime: number;
29
+ }
@@ -1,14 +1,17 @@
1
1
  import type * as Mocha from "mocha";
2
2
  import { type StepResult } from "allure-js-commons";
3
3
  import AllureMochaReporter from "allure-mocha";
4
- import type { CodeceptError, CodeceptStep } from "./model.js";
4
+ import type { CodeceptBddStep, CodeceptError, CodeceptStep } from "./model.js";
5
5
  export declare class AllureCodeceptJsReporter extends AllureMochaReporter {
6
+ protected currentBddStep?: string;
6
7
  constructor(runner: Mocha.Runner, opts: Mocha.MochaOptions, isInWorker: boolean);
7
8
  registerEvents(): void;
8
9
  testStarted(test: {
9
10
  tags?: string[];
10
11
  }): void;
12
+ testFailed(_: {}, error: Error): void;
11
13
  stepStarted(step: CodeceptStep): void;
14
+ bddStepStarted(step: CodeceptBddStep): void;
12
15
  stepFailed(_: CodeceptJS.Step, error?: CodeceptError): void;
13
16
  stepComment(): void;
14
17
  stepPassed(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allure-codeceptjs",
3
- "version": "3.0.8",
3
+ "version": "3.1.0",
4
4
  "description": "Allure codeceptjs integration",
5
5
  "keywords": [
6
6
  "allure",
@@ -46,8 +46,8 @@
46
46
  "test": "vitest run"
47
47
  },
48
48
  "dependencies": {
49
- "allure-js-commons": "3.0.8",
50
- "allure-mocha": "3.0.8"
49
+ "allure-js-commons": "3.1.0",
50
+ "allure-mocha": "3.1.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@babel/cli": "^7.24.6",
@@ -66,7 +66,7 @@
66
66
  "@typescript-eslint/eslint-plugin": "^8.0.0",
67
67
  "@typescript-eslint/parser": "^8.0.0",
68
68
  "allure-commandline": "^2.29.0",
69
- "allure-vitest": "3.0.8",
69
+ "allure-vitest": "3.1.0",
70
70
  "babel-plugin-add-module-exports": "^1.0.4",
71
71
  "codeceptjs": "^3.6.10",
72
72
  "eslint": "^8.57.0",
@@ -79,7 +79,7 @@
79
79
  "npm-run-all2": "^7.0.0",
80
80
  "rimraf": "^6.0.0",
81
81
  "typescript": "^5.2.2",
82
- "vitest": "^2.1.5"
82
+ "vitest": "^2.1.8"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "codeceptjs": ">=2.3.6"