allure-jest 3.7.1 → 3.8.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
@@ -78,7 +78,7 @@ When the test run completes, the result files will be generated in the `./allure
78
78
 
79
79
  You may select another location, or further customize the behavior of Allure Jest with [the configuration options](https://allurereport.org/docs/jest-configuration/).
80
80
 
81
- ### View the report
81
+ ## View the report
82
82
 
83
83
  Use Allure Report 2:
84
84
 
@@ -145,6 +145,20 @@ describe("signing in with a password", () => {
145
145
 
146
146
  More details about the API are available at [https://allurereport.org/docs/jest-reference/](https://allurereport.org/docs/jest-reference/).
147
147
 
148
+ ### Sync API
149
+
150
+ When your test code uses synchronous helpers or matcher integrations, you can use the sync facade from `allure-js-commons/sync`.
151
+
152
+ ```js
153
+ import * as allure from "allure-js-commons/sync";
154
+
155
+ allure.step("check result", () => {
156
+ allure.parameter("mode", "sync");
157
+ });
158
+ ```
159
+
160
+ The sync facade is strict-sync only: `allure.step()` must finish synchronously and must not return a `Promise`.
161
+
148
162
  ## Using Allure-Jest with custom environment
149
163
 
150
164
  To use Allure-Jest with custom environments, you can use the `createJestEnvironment` helper function:
@@ -14,10 +14,13 @@ class AllureJestTestRuntime extends _runtime.MessageTestRuntime {
14
14
  this.context = context;
15
15
  context.allureTestRuntime = () => this;
16
16
  }
17
+ sendMessageSync(message) {
18
+ this.jestEnvironment.handleAllureRuntimeMessage(message);
19
+ }
17
20
  sendMessage(message) {
18
21
  var _this = this;
19
22
  return _asyncToGenerator(function* () {
20
- _this.jestEnvironment.handleAllureRuntimeMessage(message);
23
+ _this.sendMessageSync(message);
21
24
  yield Promise.resolve();
22
25
  })();
23
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AllureJestTestRuntime.js","names":["_runtime","require","asyncGeneratorStep","n","t","e","r","o","a","c","i","u","value","done","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","AllureJestTestRuntime","MessageTestRuntime","constructor","jestEnvironment","context","allureTestRuntime","sendMessage","message","_this","handleAllureRuntimeMessage","exports"],"sources":["../../src/AllureJestTestRuntime.ts"],"sourcesContent":["import type { Global } from \"@jest/types\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\nimport { MessageTestRuntime } from \"allure-js-commons/sdk/runtime\";\n\nimport type { AllureJestEnvironment } from \"./model.js\";\n\nexport class AllureJestTestRuntime extends MessageTestRuntime {\n constructor(\n private readonly jestEnvironment: AllureJestEnvironment,\n private readonly context: Global.Global,\n ) {\n super();\n context.allureTestRuntime = () => this;\n }\n\n async sendMessage(message: RuntimeMessage) {\n this.jestEnvironment.handleAllureRuntimeMessage(message);\n\n await Promise.resolve();\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAAmE,SAAAC,mBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,cAAAC,CAAA,GAAAP,CAAA,CAAAK,CAAA,EAAAC,CAAA,GAAAE,CAAA,GAAAD,CAAA,CAAAE,KAAA,WAAAT,CAAA,gBAAAE,CAAA,CAAAF,CAAA,KAAAO,CAAA,CAAAG,IAAA,GAAAT,CAAA,CAAAO,CAAA,IAAAG,OAAA,CAAAC,OAAA,CAAAJ,CAAA,EAAAK,IAAA,CAAAV,CAAA,EAAAC,CAAA;AAAA,SAAAU,kBAAAd,CAAA,6BAAAC,CAAA,SAAAC,CAAA,GAAAa,SAAA,aAAAJ,OAAA,WAAAR,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAL,CAAA,CAAAgB,KAAA,CAAAf,CAAA,EAAAC,CAAA,YAAAe,MAAAjB,CAAA,IAAAD,kBAAA,CAAAM,CAAA,EAAAF,CAAA,EAAAC,CAAA,EAAAa,KAAA,EAAAC,MAAA,UAAAlB,CAAA,cAAAkB,OAAAlB,CAAA,IAAAD,kBAAA,CAAAM,CAAA,EAAAF,CAAA,EAAAC,CAAA,EAAAa,KAAA,EAAAC,MAAA,WAAAlB,CAAA,KAAAiB,KAAA;AAI5D,MAAME,qBAAqB,SAASC,2BAAkB,CAAC;EAC5DC,WAAWA,CACQC,eAAsC,EACtCC,OAAsB,EACvC;IACA,KAAK,CAAC,CAAC;IAAC,KAHSD,eAAsC,GAAtCA,eAAsC;IAAA,KACtCC,OAAsB,GAAtBA,OAAsB;IAGvCA,OAAO,CAACC,iBAAiB,GAAG,MAAM,IAAI;EACxC;EAEMC,WAAWA,CAACC,OAAuB,EAAE;IAAA,IAAAC,KAAA;IAAA,OAAAb,iBAAA;MACzCa,KAAI,CAACL,eAAe,CAACM,0BAA0B,CAACF,OAAO,CAAC;MAExD,MAAMf,OAAO,CAACC,OAAO,CAAC,CAAC;IAAC;EAC1B;AACF;AAACiB,OAAA,CAAAV,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"file":"AllureJestTestRuntime.js","names":["_runtime","require","asyncGeneratorStep","n","t","e","r","o","a","c","i","u","value","done","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","AllureJestTestRuntime","MessageTestRuntime","constructor","jestEnvironment","context","allureTestRuntime","sendMessageSync","message","handleAllureRuntimeMessage","sendMessage","_this","exports"],"sources":["../../src/AllureJestTestRuntime.ts"],"sourcesContent":["import type { Global } from \"@jest/types\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\nimport { MessageTestRuntime } from \"allure-js-commons/sdk/runtime\";\n\nimport type { AllureJestEnvironment } from \"./model.js\";\n\nexport class AllureJestTestRuntime extends MessageTestRuntime {\n constructor(\n private readonly jestEnvironment: AllureJestEnvironment,\n private readonly context: Global.Global,\n ) {\n super();\n context.allureTestRuntime = () => this;\n }\n\n sendMessageSync(message: RuntimeMessage) {\n this.jestEnvironment.handleAllureRuntimeMessage(message);\n }\n\n async sendMessage(message: RuntimeMessage) {\n this.sendMessageSync(message);\n await Promise.resolve();\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,Q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zCe,KAAI,CAACJ,eAAe,CAACC,OAAO,CAAC;MAC7B,MAAMf,OAAO,CAACC,OAAO,CAAC,CAAC;IAAC;EAC1B;AACF;AAACkB,OAAA,CAAAX,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -32,6 +32,7 @@ var createJestEnvironment = Base => {
32
32
  // config is AllureJestConfig in Jest v28 or greater. In older versions
33
33
  // it's AllureJestProjectConfig. See https://github.com/jestjs/jest/pull/12461
34
34
  constructor(config, context) {
35
+ var _this$handleTestEvent;
35
36
  super(config, context);
36
37
  _classPrivateMethodInitSpec(this, _Class_brand);
37
38
  _defineProperty(this, "testPath", void 0);
@@ -43,51 +44,25 @@ var createJestEnvironment = Base => {
43
44
  scopes: [],
44
45
  skippedTestsFullNamesByTestPlan: []
45
46
  });
46
- _defineProperty(this, "handleTestEvent", event => {
47
- switch (event.name) {
48
- case "hook_start":
49
- _assertClassBrand(_Class_brand, this, _handleHookStart).call(this, event.hook);
50
- break;
51
- case "hook_success":
52
- _assertClassBrand(_Class_brand, this, _handleHookPass).call(this, event.hook);
53
- break;
54
- case "hook_failure":
55
- _assertClassBrand(_Class_brand, this, _handleHookFail).call(this, event.hook, event.error);
56
- break;
57
- case "run_describe_start":
58
- _assertClassBrand(_Class_brand, this, _handleSuiteStart).call(this);
59
- break;
60
- case "run_describe_finish":
61
- _assertClassBrand(_Class_brand, this, _handleSuiteEnd).call(this);
62
- break;
63
- case "test_start":
64
- _assertClassBrand(_Class_brand, this, _handleTestScopeStart).call(this);
65
- break;
66
- case "test_fn_start":
67
- _assertClassBrand(_Class_brand, this, _handleTestStart).call(this, event.test);
68
- break;
69
- case "test_fn_success":
70
- _assertClassBrand(_Class_brand, this, _handleTestPass).call(this, event.test);
71
- break;
72
- case "test_fn_failure":
73
- _assertClassBrand(_Class_brand, this, _handleTestFail).call(this, event.test);
74
- break;
75
- case "test_done":
76
- _assertClassBrand(_Class_brand, this, _handleTestScopeStop).call(this, event.test);
77
- break;
78
- case "test_skip":
79
- _assertClassBrand(_Class_brand, this, _handleTestSkip).call(this, event.test);
80
- break;
81
- case "test_todo":
82
- _assertClassBrand(_Class_brand, this, _handleTestTodo).call(this, event.test);
83
- break;
84
- case "run_finish":
85
- _assertClassBrand(_Class_brand, this, _handleRunFinish).call(this);
86
- break;
87
- default:
88
- break;
47
+ var handleTestEvent = (_this$handleTestEvent = this.handleTestEvent) === null || _this$handleTestEvent === void 0 ? void 0 : _this$handleTestEvent.bind(this);
48
+
49
+ // Preserve any event handler defined by the base or custom environment.
50
+ this.handleTestEvent = (event, state) => {
51
+ var handleAllureEvent = () => _assertClassBrand(_Class_brand, this, _handleTestEvent).call(this, event, state);
52
+
53
+ // Keep Allure's lifecycle in sync even if the custom environment fails,
54
+ // then rethrow the original error so Jest keeps its native behavior.
55
+ try {
56
+ var result = handleTestEvent === null || handleTestEvent === void 0 ? void 0 : handleTestEvent(event, state);
57
+ if ((0, _sdk.isPromise)(result)) {
58
+ return Promise.resolve(result).finally(handleAllureEvent);
59
+ }
60
+ } catch (error) {
61
+ handleAllureEvent();
62
+ throw error;
89
63
  }
90
- });
64
+ handleAllureEvent();
65
+ };
91
66
  var projectConfig = "projectConfig" in config ? config.projectConfig : config;
92
67
  var _ref = (projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.testEnvironmentOptions) || {},
93
68
  {
@@ -124,6 +99,51 @@ var createJestEnvironment = Base => {
124
99
  }
125
100
  }
126
101
  };
102
+ function _handleTestEvent(event, state) {
103
+ switch (event.name) {
104
+ case "hook_start":
105
+ _assertClassBrand(_Class_brand, this, _handleHookStart).call(this, event.hook);
106
+ break;
107
+ case "hook_success":
108
+ _assertClassBrand(_Class_brand, this, _handleHookPass).call(this, event.hook);
109
+ break;
110
+ case "hook_failure":
111
+ _assertClassBrand(_Class_brand, this, _handleHookFail).call(this, event.hook, event.error);
112
+ break;
113
+ case "run_describe_start":
114
+ _assertClassBrand(_Class_brand, this, _handleSuiteStart).call(this);
115
+ break;
116
+ case "run_describe_finish":
117
+ _assertClassBrand(_Class_brand, this, _handleSuiteEnd).call(this);
118
+ break;
119
+ case "test_start":
120
+ _assertClassBrand(_Class_brand, this, _handleTestScopeStart).call(this);
121
+ break;
122
+ case "test_fn_start":
123
+ _assertClassBrand(_Class_brand, this, _handleTestStart).call(this, event.test);
124
+ break;
125
+ case "test_fn_success":
126
+ _assertClassBrand(_Class_brand, this, _handleTestPass).call(this, event.test);
127
+ break;
128
+ case "test_fn_failure":
129
+ _assertClassBrand(_Class_brand, this, _handleTestFail).call(this, event.test);
130
+ break;
131
+ case "test_done":
132
+ _assertClassBrand(_Class_brand, this, _handleTestScopeStop).call(this, event.test);
133
+ break;
134
+ case "test_skip":
135
+ _assertClassBrand(_Class_brand, this, _handleTestSkip).call(this, event.test);
136
+ break;
137
+ case "test_todo":
138
+ _assertClassBrand(_Class_brand, this, _handleTestTodo).call(this, event.test);
139
+ break;
140
+ case "run_finish":
141
+ _assertClassBrand(_Class_brand, this, _handleRunFinish).call(this);
142
+ break;
143
+ default:
144
+ break;
145
+ }
146
+ }
127
147
  function _getTestFullName(test) {
128
148
  var testTitle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : test.name;
129
149
  var newTestSuitePath = (0, _utils.getTestPath)(test.parent);
@@ -185,7 +205,10 @@ var createJestEnvironment = Base => {
185
205
  links
186
206
  } = (0, _sdk.extractMetadataFromString)(test.name);
187
207
  var newTestFullName = _assertClassBrand(_Class_brand, this, _getTestFullName).call(this, test, cleanTitle);
188
- if (this.testPlan && !(0, _utils.isTestPresentInTestPlan)(newTestFullName, this.testPlan)) {
208
+ if (this.testPlan && !(0, _reporter.includedInTestPlan)(this.testPlan, {
209
+ fullName: newTestFullName,
210
+ tags: [test.name]
211
+ })) {
189
212
  test.mode = "skip";
190
213
  this.runContext.skippedTestsFullNamesByTestPlan.push(newTestFullName);
191
214
  return;
@@ -210,17 +233,18 @@ var createJestEnvironment = Base => {
210
233
  if (testUuid) {
211
234
  var _tr, _tr2;
212
235
  var {
236
+ status,
213
237
  details
214
238
  } = _assertClassBrand(_Class_brand, this, _statusAndDetails).call(this, test.errors);
215
239
  var tr;
216
240
  this.runtime.updateTest(testUuid, result => {
217
241
  tr = result;
218
242
  });
219
- // hook failure, finish as skipped
243
+ // hook failure, finish with the status reported by Jest
220
244
  if (((_tr = tr) === null || _tr === void 0 ? void 0 : _tr.status) === undefined && ((_tr2 = tr) === null || _tr2 === void 0 ? void 0 : _tr2.stage) === _allureJsCommons.Stage.RUNNING) {
221
245
  this.runtime.updateTest(testUuid, result => {
222
246
  result.stage = _allureJsCommons.Stage.FINISHED;
223
- result.status = _allureJsCommons.Status.SKIPPED;
247
+ result.status = status;
224
248
  result.statusDetails = _objectSpread(_objectSpread({}, result.statusDetails), details);
225
249
  });
226
250
  }
@@ -1 +1 @@
1
- {"version":3,"file":"environmentFactory.js","names":["_nodePath","require","_nodeProcess","_allureJsCommons","_interopRequireWildcard","allure","_sdk","_reporter","_runtime","_AllureJestTestRuntime","_utils","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_objectWithoutProperties","_objectWithoutPropertiesLoose","indexOf","propertyIsEnumerable","_classPrivateMethodInitSpec","a","_checkPrivateRedeclaration","add","TypeError","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","String","Number","_assertClassBrand","createJestEnvironment","Base","_Class_brand","WeakSet","constructor","config","context","executables","steps","scopes","skippedTestsFullNamesByTestPlan","event","name","_handleHookStart","hook","_handleHookPass","_handleHookFail","error","_handleSuiteStart","_handleSuiteEnd","_handleTestScopeStart","_handleTestStart","test","_handleTestPass","_handleTestFail","_handleTestScopeStop","_handleTestSkip","_handleTestTodo","_handleRunFinish","projectConfig","_ref","testEnvironmentOptions","resultsDir","restConfig","runtime","ReporterRuntime","writer","createDefaultWriter","testPath","relative","rootDir","testPlan","parseTestPlan","testRuntime","AllureJestTestRuntime","global","setGlobalTestRuntime","setup","teardown","handleAllureRuntimeMessage","message","executableUuid","last","runContext","applyRuntimeMessages","applyGlobalRuntimeMessages","_getTestFullName","testTitle","undefined","newTestSuitePath","getTestPath","parent","newTestPath","concat","newTestId","getTestId","getPosixPath","_startScope","_stopScope","shouldHookBeSkipped","scopeUuid","fixtureUuid","startFixture","type","pop","updateFixture","status","Status","PASSED","stage","Stage","FINISHED","stopFixture","BROKEN","getStatusFromError","statusDetails","trace","stack","_test$startedAt","fsPath","split","sep","titlePath","cleanTitle","labels","links","extractMetadataFromString","newTestFullName","isTestPresentInTestPlan","mode","testUuid","startTest","fullName","start","startedAt","RUNNING","getLanguageLabel","getFrameworkLabel","getPackageLabel","getHostLabel","getThreadLabel","env","JEST_WORKER_ID","getEnvironmentLabels","getSuiteLabels","_tr","_tr2","details","_statusAndDetails","errors","tr","updateTest","result","SKIPPED","writeTest","startScope","writeScope","_test$duration","_currentExecutable","suppressedErrors","expect","getState","statusAndDetails","stopTest","duration","_test$duration2","includes","writeEnvironmentInfo","writeCategoriesDefinitions","hasMultipleErrors","Array","isArray","exception","firstError","_convertToError","secondError","getMessageAndTraceFromError","serialize","exports"],"sources":["../../src/environmentFactory.ts"],"sourcesContent":["import { relative, sep } from \"node:path\";\nimport { env } from \"node:process\";\n\nimport type { EnvironmentContext, JestEnvironment, JestEnvironmentConfig } from \"@jest/environment\";\nimport type { Circus } from \"@jest/types\";\nimport * as allure from \"allure-js-commons\";\nimport { Stage, Status, type StatusDetails, type TestResult } from \"allure-js-commons\";\nimport { type RuntimeMessage, type TestPlanV1, serialize } from \"allure-js-commons/sdk\";\nimport { extractMetadataFromString, getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\nimport {\n ReporterRuntime,\n createDefaultWriter,\n getEnvironmentLabels,\n getFrameworkLabel,\n getHostLabel,\n getLanguageLabel,\n getPackageLabel,\n getPosixPath,\n getSuiteLabels,\n getThreadLabel,\n parseTestPlan,\n} from \"allure-js-commons/sdk/reporter\";\nimport { setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\n\nimport { AllureJestTestRuntime } from \"./AllureJestTestRuntime.js\";\nimport type { AllureJestConfig, AllureJestEnvironment, AllureJestProjectConfig, RunContext } from \"./model.js\";\nimport { getTestId, getTestPath, isTestPresentInTestPlan, last, shouldHookBeSkipped } from \"./utils.js\";\n\nconst createJestEnvironment = <T extends typeof JestEnvironment>(Base: T): T => {\n // @ts-expect-error (ts(2545)) Incorrect assumption about a mixin class: https://github.com/microsoft/TypeScript/issues/37142\n return class extends Base {\n testPath: string;\n testPlan?: TestPlanV1;\n runtime: ReporterRuntime;\n runContext: RunContext = {\n executables: [],\n steps: [],\n scopes: [],\n skippedTestsFullNamesByTestPlan: [],\n };\n\n // config is AllureJestConfig in Jest v28 or greater. In older versions\n // it's AllureJestProjectConfig. See https://github.com/jestjs/jest/pull/12461\n constructor(config: AllureJestConfig | AllureJestProjectConfig, context: EnvironmentContext) {\n super(config as JestEnvironmentConfig, context);\n\n const projectConfig = \"projectConfig\" in config ? config.projectConfig : config;\n const { resultsDir, ...restConfig } = projectConfig?.testEnvironmentOptions || {};\n\n this.runtime = new ReporterRuntime({\n ...restConfig,\n writer: createDefaultWriter({ resultsDir }),\n });\n this.testPath = relative(projectConfig.rootDir, context.testPath);\n this.testPlan = parseTestPlan();\n\n // @ts-ignore\n const testRuntime = new AllureJestTestRuntime(this as AllureJestEnvironment, this.global);\n\n // @ts-ignore\n this.global.allure = allure;\n\n setGlobalTestRuntime(testRuntime);\n }\n\n setup() {\n return super.setup();\n }\n\n teardown() {\n return super.teardown();\n }\n\n handleAllureRuntimeMessage(message: RuntimeMessage) {\n const executableUuid = last(this.runContext.executables);\n if (executableUuid) {\n this.runtime.applyRuntimeMessages(executableUuid, [message]);\n } else {\n this.runtime.applyGlobalRuntimeMessages([message]);\n }\n }\n\n handleTestEvent = (event: Circus.Event) => {\n switch (event.name) {\n case \"hook_start\":\n this.#handleHookStart(event.hook);\n break;\n case \"hook_success\":\n this.#handleHookPass(event.hook);\n break;\n case \"hook_failure\":\n this.#handleHookFail(event.hook, event.error);\n break;\n case \"run_describe_start\":\n this.#handleSuiteStart();\n break;\n case \"run_describe_finish\":\n this.#handleSuiteEnd();\n break;\n case \"test_start\":\n this.#handleTestScopeStart();\n break;\n case \"test_fn_start\":\n this.#handleTestStart(event.test);\n break;\n case \"test_fn_success\":\n this.#handleTestPass(event.test);\n break;\n case \"test_fn_failure\":\n this.#handleTestFail(event.test);\n break;\n case \"test_done\":\n this.#handleTestScopeStop(event.test);\n break;\n case \"test_skip\":\n this.#handleTestSkip(event.test);\n break;\n case \"test_todo\":\n this.#handleTestTodo(event.test);\n break;\n case \"run_finish\":\n this.#handleRunFinish();\n break;\n default:\n break;\n }\n };\n\n #getTestFullName(test: Circus.TestEntry, testTitle: string = test.name) {\n const newTestSuitePath = getTestPath(test.parent);\n const newTestPath = newTestSuitePath.concat(testTitle);\n const newTestId = getTestId(newTestPath);\n\n return `${getPosixPath(this.testPath)}#${newTestId}`;\n }\n\n #handleSuiteStart() {\n this.#startScope();\n }\n\n #handleSuiteEnd() {\n this.#stopScope();\n }\n\n #handleHookStart(hook: Circus.Hook) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const scopeUuid = last(this.runContext.scopes);\n const fixtureUuid = this.runtime.startFixture(scopeUuid, /after/i.test(hook.type) ? \"after\" : \"before\", {\n name: hook.type,\n })!;\n\n this.runContext.executables.push(fixtureUuid);\n }\n\n #handleHookPass(hook: Circus.Hook) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const fixtureUuid = this.runContext.executables.pop()!;\n\n this.runtime.updateFixture(fixtureUuid, (r) => {\n r.status = Status.PASSED;\n r.stage = Stage.FINISHED;\n });\n this.runtime.stopFixture(fixtureUuid);\n }\n\n #handleHookFail(hook: Circus.Hook, error: string | Circus.Exception) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const fixtureUuid = this.runContext.executables.pop()!;\n const status = typeof error === \"string\" ? Status.BROKEN : getStatusFromError(error as Error);\n\n this.runtime.updateFixture(fixtureUuid, (r) => {\n r.status = status;\n r.statusDetails = {\n message: typeof error === \"string\" ? error : error.message,\n trace: typeof error === \"string\" ? undefined : error.stack,\n };\n r.stage = Stage.FINISHED;\n });\n this.runtime.stopFixture(fixtureUuid);\n }\n\n #handleTestStart(test: Circus.TestEntry) {\n const fsPath = this.testPath.split(sep);\n const newTestSuitePath = getTestPath(test.parent);\n const titlePath = fsPath.concat(newTestSuitePath);\n const { cleanTitle, labels, links } = extractMetadataFromString(test.name);\n const newTestFullName = this.#getTestFullName(test, cleanTitle);\n\n if (this.testPlan && !isTestPresentInTestPlan(newTestFullName, this.testPlan)) {\n test.mode = \"skip\";\n this.runContext.skippedTestsFullNamesByTestPlan.push(newTestFullName);\n return;\n }\n\n const testUuid = this.runtime.startTest(\n {\n name: cleanTitle,\n fullName: newTestFullName,\n start: test.startedAt ?? undefined,\n stage: Stage.RUNNING,\n labels: [\n getLanguageLabel(),\n getFrameworkLabel(\"jest\"),\n getPackageLabel(this.testPath),\n getHostLabel(),\n getThreadLabel(env.JEST_WORKER_ID),\n ...getEnvironmentLabels(),\n ...getSuiteLabels(newTestSuitePath),\n ...labels,\n ],\n titlePath,\n links,\n },\n this.runContext.scopes,\n );\n\n this.runContext.executables.push(testUuid);\n\n return testUuid;\n }\n\n #handleTestScopeStart() {\n this.#startScope();\n }\n\n #handleTestScopeStop(test: Circus.TestEntry) {\n const testUuid = this.runContext.executables.pop();\n\n if (testUuid) {\n const { details } = this.#statusAndDetails(test.errors);\n let tr: TestResult | undefined;\n this.runtime.updateTest(testUuid, (result) => {\n tr = result;\n });\n // hook failure, finish as skipped\n if (tr?.status === undefined && tr?.stage === Stage.RUNNING) {\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.SKIPPED;\n result.statusDetails = {\n ...result.statusDetails,\n ...details,\n };\n });\n }\n\n this.runtime.writeTest(testUuid);\n }\n\n this.#stopScope();\n }\n\n #startScope() {\n const scopeUuid = this.runtime.startScope();\n\n this.runContext.scopes.push(scopeUuid);\n }\n\n #stopScope() {\n const scopeUuid = this.runContext.scopes.pop();\n if (!scopeUuid) {\n return;\n }\n\n this.runtime.writeScope(scopeUuid);\n }\n\n #handleTestPass(test: Circus.TestEntry) {\n const testUuid = this.#currentExecutable();\n\n if (!testUuid) {\n return;\n }\n // @ts-ignore\n const { suppressedErrors = [] } = this.global.expect.getState();\n const statusAndDetails = this.#statusAndDetails(suppressedErrors as Circus.TestError[]);\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = statusAndDetails.status;\n result.statusDetails = {\n ...result.statusDetails,\n ...statusAndDetails.details,\n };\n });\n\n this.runtime.stopTest(testUuid, { duration: test.duration ?? 0 });\n }\n\n #handleTestFail(test: Circus.TestEntry) {\n const testUuid = this.#currentExecutable();\n\n if (!testUuid) {\n return;\n }\n\n const { status, details } = this.#statusAndDetails(test.errors);\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = status;\n result.statusDetails = {\n ...result.statusDetails,\n ...details,\n };\n });\n this.runtime.stopTest(testUuid, { duration: test.duration ?? 0 });\n }\n\n #handleTestSkip(test: Circus.TestEntry) {\n const newTestFullName = this.#getTestFullName(test);\n\n if (this.runContext.skippedTestsFullNamesByTestPlan.includes(newTestFullName)) {\n return;\n }\n\n // noinspection JSPotentiallyInvalidUsageOfThis\n const testUuid = this.#handleTestStart(test);\n\n if (!testUuid) {\n return;\n }\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.SKIPPED;\n });\n // noinspection JSPotentiallyInvalidUsageOfThis\n this.#handleTestScopeStop(test);\n }\n\n #handleTestTodo(test: Circus.TestEntry) {\n // noinspection JSPotentiallyInvalidUsageOfThis\n const testUuid = this.#handleTestStart(test);\n if (!testUuid) {\n return;\n }\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.SKIPPED;\n result.statusDetails = {\n message: \"TODO\",\n };\n });\n // noinspection JSPotentiallyInvalidUsageOfThis\n this.#handleTestScopeStop(test);\n }\n\n #handleRunFinish() {\n this.runtime.writeEnvironmentInfo();\n this.runtime.writeCategoriesDefinitions();\n }\n\n #currentExecutable() {\n if (this.runContext.executables.length === 0) {\n return undefined;\n }\n return this.runContext.executables[this.runContext.executables.length - 1];\n }\n\n #statusAndDetails(errors: Circus.TestError[]): { status: Status; details: Partial<StatusDetails> } {\n if (errors.length === 0) {\n return {\n status: Status.PASSED,\n details: {},\n };\n }\n\n // jest collects all errors, but we need to report the first one because it's a reason why the test has been failed\n const [error] = errors;\n const hasMultipleErrors = Array.isArray(error);\n const exception: Circus.Exception = hasMultipleErrors ? error[0] : error;\n const firstError = this.#convertToError(exception);\n\n // in case user throws non-Error type, the first exception is the user-thrown object,\n // while the second one is provided by jest and has correct stack trace\n if (hasMultipleErrors && error.length > 1) {\n const secondError = this.#convertToError(error[1]);\n\n if (!firstError.message) {\n firstError.message = secondError.message;\n }\n\n if (!firstError.stack) {\n firstError.stack = secondError.stack;\n }\n }\n\n const details = getMessageAndTraceFromError(firstError);\n const status = getStatusFromError(firstError);\n\n return { status, details };\n }\n\n #convertToError(exception: Circus.Exception):\n | Error\n | {\n message?: string;\n stack?: string;\n } {\n if (!exception) {\n return {};\n }\n\n // user may throw an object as well\n if (typeof exception !== \"object\" || !(\"stack\" in exception)) {\n return {\n message: serialize(exception),\n };\n }\n\n return exception;\n }\n };\n};\n\nexport { createJestEnvironment };\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,gBAAA,GAAAC,uBAAA,CAAAH,OAAA;AAA4C,IAAAI,MAAA,GAAAF,gBA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BmL,SAAS,CAAC;;IAElD;IACA;IACA,IAAIH,iBAAiB,IAAI1H,KAAK,CAACzC,MAAM,GAAG,CAAC,EAAE;MACzC,IAAMyK,WAAW,GAAGlJ,iBAAA,CAAAG,YAAA,MAAI,EAAC8I,eAAc,CAAC,CAAArL,IAAA,CAApB,IAAI,EAAiBsD,KAAK,CAAC,CAAC,CAAC,CAAC;MAElD,IAAI,CAAC8H,UAAU,CAAC7F,OAAO,EAAE;QACvB6F,UAAU,CAAC7F,OAAO,GAAG+F,WAAW,CAAC/F,OAAO;MAC1C;MAEA,IAAI,CAAC6F,UAAU,CAACxD,KAAK,EAAE;QACrBwD,UAAU,CAACxD,KAAK,GAAG0D,WAAW,CAAC1D,KAAK;MACtC;IACF;IAEA,IAAM8B,OAAO,GAAG,IAAA6B,gCAA2B,EAACH,UAAU,CAAC;IACvD,IAAMnE,MAAM,GAAG,IAAAQ,uBAAkB,EAAC2D,UAAU,CAAC;IAE7C,OAAO;MAAEnE,MAAM;MAAEyC;IAAQ,CAAC;EAC5B;EAAC,SAAA2B,gBAEeF,SAA2B,EAKrC;IACJ,IAAI,CAACA,SAAS,EAAE;MACd,OAAO,CAAC,CAAC;IACX;;IAEA;IACA,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,EAAE,OAAO,IAAIA,SAAS,CAAC,EAAE;MAC5D,OAAO;QACL5F,OAAO,EAAE,IAAAiG,cAAS,EAACL,SAAS;MAC9B,CAAC;IACH;IAEA,OAAOA,SAAS;EAClB;AAEJ,CAAC;AAACM,OAAA,CAAApJ,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"file":"environmentFactory.js","names":["_nodePath","require","_nodeProcess","_allureJsCommons","_interopRequireWildcard","allure","_sdk","_reporter","_runtime","_AllureJestTestRuntime","_utils","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_objectWithoutProperties","_objectWithoutPropertiesLoose","indexOf","propertyIsEnumerable","_classPrivateMethodInitSpec","a","_checkPrivateRedeclaration","add","TypeError","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","String","Number","_assertClassBrand","createJestEnvironment","Base","_Class_brand","WeakSet","constructor","config","context","_this$handleTestEvent","executables","steps","scopes","skippedTestsFullNamesByTestPlan","handleTestEvent","bind","event","state","handleAllureEvent","_handleTestEvent","result","isPromise","Promise","resolve","finally","error","projectConfig","_ref","testEnvironmentOptions","resultsDir","restConfig","runtime","ReporterRuntime","writer","createDefaultWriter","testPath","relative","rootDir","testPlan","parseTestPlan","testRuntime","AllureJestTestRuntime","global","setGlobalTestRuntime","setup","teardown","handleAllureRuntimeMessage","message","executableUuid","last","runContext","applyRuntimeMessages","applyGlobalRuntimeMessages","name","_handleHookStart","hook","_handleHookPass","_handleHookFail","_handleSuiteStart","_handleSuiteEnd","_handleTestScopeStart","_handleTestStart","test","_handleTestPass","_handleTestFail","_handleTestScopeStop","_handleTestSkip","_handleTestTodo","_handleRunFinish","_getTestFullName","testTitle","undefined","newTestSuitePath","getTestPath","parent","newTestPath","concat","newTestId","getTestId","getPosixPath","_startScope","_stopScope","shouldHookBeSkipped","scopeUuid","fixtureUuid","startFixture","type","pop","updateFixture","status","Status","PASSED","stage","Stage","FINISHED","stopFixture","BROKEN","getStatusFromError","statusDetails","trace","stack","_test$startedAt","fsPath","split","sep","titlePath","cleanTitle","labels","links","extractMetadataFromString","newTestFullName","includedInTestPlan","fullName","tags","mode","testUuid","startTest","start","startedAt","RUNNING","getLanguageLabel","getFrameworkLabel","getPackageLabel","getHostLabel","getThreadLabel","env","JEST_WORKER_ID","getEnvironmentLabels","getSuiteLabels","_tr","_tr2","details","_statusAndDetails","errors","tr","updateTest","writeTest","startScope","writeScope","_test$duration","_currentExecutable","suppressedErrors","expect","getState","statusAndDetails","stopTest","duration","_test$duration2","includes","SKIPPED","writeEnvironmentInfo","writeCategoriesDefinitions","hasMultipleErrors","Array","isArray","exception","firstError","_convertToError","secondError","getMessageAndTraceFromError","serialize","exports"],"sources":["../../src/environmentFactory.ts"],"sourcesContent":["import { relative, sep } from \"node:path\";\nimport { env } from \"node:process\";\n\nimport type { EnvironmentContext, JestEnvironment, JestEnvironmentConfig } from \"@jest/environment\";\nimport type { Circus } from \"@jest/types\";\nimport * as allure from \"allure-js-commons\";\nimport { Stage, Status, type StatusDetails, type TestResult } from \"allure-js-commons\";\nimport { type RuntimeMessage, type TestPlanV1, serialize } from \"allure-js-commons/sdk\";\nimport {\n extractMetadataFromString,\n getMessageAndTraceFromError,\n getStatusFromError,\n isPromise,\n} from \"allure-js-commons/sdk\";\nimport {\n ReporterRuntime,\n createDefaultWriter,\n getEnvironmentLabels,\n getFrameworkLabel,\n getHostLabel,\n getLanguageLabel,\n getPackageLabel,\n getPosixPath,\n getSuiteLabels,\n getThreadLabel,\n includedInTestPlan,\n parseTestPlan,\n} from \"allure-js-commons/sdk/reporter\";\nimport { setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\n\nimport { AllureJestTestRuntime } from \"./AllureJestTestRuntime.js\";\nimport type { AllureJestConfig, AllureJestEnvironment, AllureJestProjectConfig, RunContext } from \"./model.js\";\nimport { getTestId, getTestPath, last, shouldHookBeSkipped } from \"./utils.js\";\n\nconst createJestEnvironment = <T extends typeof JestEnvironment>(Base: T): T => {\n // @ts-expect-error (ts(2545)) Incorrect assumption about a mixin class: https://github.com/microsoft/TypeScript/issues/37142\n return class extends Base {\n testPath: string;\n testPlan?: TestPlanV1;\n runtime: ReporterRuntime;\n runContext: RunContext = {\n executables: [],\n steps: [],\n scopes: [],\n skippedTestsFullNamesByTestPlan: [],\n };\n\n // config is AllureJestConfig in Jest v28 or greater. In older versions\n // it's AllureJestProjectConfig. See https://github.com/jestjs/jest/pull/12461\n constructor(config: AllureJestConfig | AllureJestProjectConfig, context: EnvironmentContext) {\n super(config as JestEnvironmentConfig, context);\n\n const handleTestEvent = this.handleTestEvent?.bind(this) as\n | ((event: Circus.Event, state: Circus.State) => void | PromiseLike<void>)\n | undefined;\n\n // Preserve any event handler defined by the base or custom environment.\n this.handleTestEvent = (event: Circus.Event, state: Circus.State) => {\n const handleAllureEvent = () => this.#handleTestEvent(event, state);\n\n // Keep Allure's lifecycle in sync even if the custom environment fails,\n // then rethrow the original error so Jest keeps its native behavior.\n try {\n const result = handleTestEvent?.(event, state);\n\n if (isPromise(result)) {\n return Promise.resolve(result).finally(handleAllureEvent);\n }\n } catch (error) {\n handleAllureEvent();\n throw error;\n }\n\n handleAllureEvent();\n };\n\n const projectConfig = \"projectConfig\" in config ? config.projectConfig : config;\n const { resultsDir, ...restConfig } = projectConfig?.testEnvironmentOptions || {};\n\n this.runtime = new ReporterRuntime({\n ...restConfig,\n writer: createDefaultWriter({ resultsDir }),\n });\n this.testPath = relative(projectConfig.rootDir, context.testPath);\n this.testPlan = parseTestPlan();\n\n // @ts-ignore\n const testRuntime = new AllureJestTestRuntime(this as AllureJestEnvironment, this.global);\n\n // @ts-ignore\n this.global.allure = allure;\n\n setGlobalTestRuntime(testRuntime);\n }\n\n setup() {\n return super.setup();\n }\n\n teardown() {\n return super.teardown();\n }\n\n handleAllureRuntimeMessage(message: RuntimeMessage) {\n const executableUuid = last(this.runContext.executables);\n if (executableUuid) {\n this.runtime.applyRuntimeMessages(executableUuid, [message]);\n } else {\n this.runtime.applyGlobalRuntimeMessages([message]);\n }\n }\n\n #handleTestEvent(event: Circus.Event, state: Circus.State) {\n switch (event.name) {\n case \"hook_start\":\n this.#handleHookStart(event.hook);\n break;\n case \"hook_success\":\n this.#handleHookPass(event.hook);\n break;\n case \"hook_failure\":\n this.#handleHookFail(event.hook, event.error);\n break;\n case \"run_describe_start\":\n this.#handleSuiteStart();\n break;\n case \"run_describe_finish\":\n this.#handleSuiteEnd();\n break;\n case \"test_start\":\n this.#handleTestScopeStart();\n break;\n case \"test_fn_start\":\n this.#handleTestStart(event.test);\n break;\n case \"test_fn_success\":\n this.#handleTestPass(event.test);\n break;\n case \"test_fn_failure\":\n this.#handleTestFail(event.test);\n break;\n case \"test_done\":\n this.#handleTestScopeStop(event.test);\n break;\n case \"test_skip\":\n this.#handleTestSkip(event.test);\n break;\n case \"test_todo\":\n this.#handleTestTodo(event.test);\n break;\n case \"run_finish\":\n this.#handleRunFinish();\n break;\n default:\n break;\n }\n }\n\n #getTestFullName(test: Circus.TestEntry, testTitle: string = test.name) {\n const newTestSuitePath = getTestPath(test.parent);\n const newTestPath = newTestSuitePath.concat(testTitle);\n const newTestId = getTestId(newTestPath);\n\n return `${getPosixPath(this.testPath)}#${newTestId}`;\n }\n\n #handleSuiteStart() {\n this.#startScope();\n }\n\n #handleSuiteEnd() {\n this.#stopScope();\n }\n\n #handleHookStart(hook: Circus.Hook) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const scopeUuid = last(this.runContext.scopes);\n const fixtureUuid = this.runtime.startFixture(scopeUuid, /after/i.test(hook.type) ? \"after\" : \"before\", {\n name: hook.type,\n })!;\n\n this.runContext.executables.push(fixtureUuid);\n }\n\n #handleHookPass(hook: Circus.Hook) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const fixtureUuid = this.runContext.executables.pop()!;\n\n this.runtime.updateFixture(fixtureUuid, (r) => {\n r.status = Status.PASSED;\n r.stage = Stage.FINISHED;\n });\n this.runtime.stopFixture(fixtureUuid);\n }\n\n #handleHookFail(hook: Circus.Hook, error: string | Circus.Exception) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const fixtureUuid = this.runContext.executables.pop()!;\n const status = typeof error === \"string\" ? Status.BROKEN : getStatusFromError(error as Error);\n\n this.runtime.updateFixture(fixtureUuid, (r) => {\n r.status = status;\n r.statusDetails = {\n message: typeof error === \"string\" ? error : error.message,\n trace: typeof error === \"string\" ? undefined : error.stack,\n };\n r.stage = Stage.FINISHED;\n });\n this.runtime.stopFixture(fixtureUuid);\n }\n\n #handleTestStart(test: Circus.TestEntry) {\n const fsPath = this.testPath.split(sep);\n const newTestSuitePath = getTestPath(test.parent);\n const titlePath = fsPath.concat(newTestSuitePath);\n const { cleanTitle, labels, links } = extractMetadataFromString(test.name);\n const newTestFullName = this.#getTestFullName(test, cleanTitle);\n\n if (this.testPlan && !includedInTestPlan(this.testPlan, { fullName: newTestFullName, tags: [test.name] })) {\n test.mode = \"skip\";\n this.runContext.skippedTestsFullNamesByTestPlan.push(newTestFullName);\n return;\n }\n\n const testUuid = this.runtime.startTest(\n {\n name: cleanTitle,\n fullName: newTestFullName,\n start: test.startedAt ?? undefined,\n stage: Stage.RUNNING,\n labels: [\n getLanguageLabel(),\n getFrameworkLabel(\"jest\"),\n getPackageLabel(this.testPath),\n getHostLabel(),\n getThreadLabel(env.JEST_WORKER_ID),\n ...getEnvironmentLabels(),\n ...getSuiteLabels(newTestSuitePath),\n ...labels,\n ],\n titlePath,\n links,\n },\n this.runContext.scopes,\n );\n\n this.runContext.executables.push(testUuid);\n\n return testUuid;\n }\n\n #handleTestScopeStart() {\n this.#startScope();\n }\n\n #handleTestScopeStop(test: Circus.TestEntry) {\n const testUuid = this.runContext.executables.pop();\n\n if (testUuid) {\n const { status, details } = this.#statusAndDetails(test.errors);\n let tr: TestResult | undefined;\n this.runtime.updateTest(testUuid, (result) => {\n tr = result;\n });\n // hook failure, finish with the status reported by Jest\n if (tr?.status === undefined && tr?.stage === Stage.RUNNING) {\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = status;\n result.statusDetails = {\n ...result.statusDetails,\n ...details,\n };\n });\n }\n\n this.runtime.writeTest(testUuid);\n }\n\n this.#stopScope();\n }\n\n #startScope() {\n const scopeUuid = this.runtime.startScope();\n\n this.runContext.scopes.push(scopeUuid);\n }\n\n #stopScope() {\n const scopeUuid = this.runContext.scopes.pop();\n if (!scopeUuid) {\n return;\n }\n\n this.runtime.writeScope(scopeUuid);\n }\n\n #handleTestPass(test: Circus.TestEntry) {\n const testUuid = this.#currentExecutable();\n\n if (!testUuid) {\n return;\n }\n // @ts-ignore\n const { suppressedErrors = [] } = this.global.expect.getState();\n const statusAndDetails = this.#statusAndDetails(suppressedErrors as Circus.TestError[]);\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = statusAndDetails.status;\n result.statusDetails = {\n ...result.statusDetails,\n ...statusAndDetails.details,\n };\n });\n\n this.runtime.stopTest(testUuid, { duration: test.duration ?? 0 });\n }\n\n #handleTestFail(test: Circus.TestEntry) {\n const testUuid = this.#currentExecutable();\n\n if (!testUuid) {\n return;\n }\n\n const { status, details } = this.#statusAndDetails(test.errors);\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = status;\n result.statusDetails = {\n ...result.statusDetails,\n ...details,\n };\n });\n this.runtime.stopTest(testUuid, { duration: test.duration ?? 0 });\n }\n\n #handleTestSkip(test: Circus.TestEntry) {\n const newTestFullName = this.#getTestFullName(test);\n\n if (this.runContext.skippedTestsFullNamesByTestPlan.includes(newTestFullName)) {\n return;\n }\n\n // noinspection JSPotentiallyInvalidUsageOfThis\n const testUuid = this.#handleTestStart(test);\n\n if (!testUuid) {\n return;\n }\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.SKIPPED;\n });\n // noinspection JSPotentiallyInvalidUsageOfThis\n this.#handleTestScopeStop(test);\n }\n\n #handleTestTodo(test: Circus.TestEntry) {\n // noinspection JSPotentiallyInvalidUsageOfThis\n const testUuid = this.#handleTestStart(test);\n if (!testUuid) {\n return;\n }\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.SKIPPED;\n result.statusDetails = {\n message: \"TODO\",\n };\n });\n // noinspection JSPotentiallyInvalidUsageOfThis\n this.#handleTestScopeStop(test);\n }\n\n #handleRunFinish() {\n this.runtime.writeEnvironmentInfo();\n this.runtime.writeCategoriesDefinitions();\n }\n\n #currentExecutable() {\n if (this.runContext.executables.length === 0) {\n return undefined;\n }\n return this.runContext.executables[this.runContext.executables.length - 1];\n }\n\n #statusAndDetails(errors: Circus.TestError[]): { status: Status; details: Partial<StatusDetails> } {\n if (errors.length === 0) {\n return {\n status: Status.PASSED,\n details: {},\n };\n }\n\n // jest collects all errors, but we need to report the first one because it's a reason why the test has been failed\n const [error] = errors;\n const hasMultipleErrors = Array.isArray(error);\n const exception: Circus.Exception = hasMultipleErrors ? error[0] : error;\n const firstError = this.#convertToError(exception);\n\n // in case user throws non-Error type, the first exception is the user-thrown object,\n // while the second one is provided by jest and has correct stack trace\n if (hasMultipleErrors && error.length > 1) {\n const secondError = this.#convertToError(error[1]);\n\n if (!firstError.message) {\n firstError.message = secondError.message;\n }\n\n if (!firstError.stack) {\n firstError.stack = secondError.stack;\n }\n }\n\n const details = getMessageAndTraceFromError(firstError);\n const status = getStatusFromError(firstError);\n\n return { status, details };\n }\n\n #convertToError(exception: Circus.Exception):\n | Error\n | {\n message?: string;\n stack?: string;\n } {\n if (!exception) {\n return {};\n }\n\n // user may throw an object as well\n if (typeof exception !== \"object\" || !(\"stack\" in exception)) {\n return {\n message: serialize(exception),\n };\n }\n\n return exception;\n }\n };\n};\n\nexport { createJestEnvironment };\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,gBAAA,GAAAC,uBAAA,CAAAH,OAAA;AAA4C,IAAAI,MAAA,GAAAF,gBAAA;AAE5C,IAAAG,IAAA,GAAAL,OAAA;AAOA,IAAAM,SAAA,GAAAN,OAAA;AAcA,IAAAO,QAAA,GAAAP,OAAA;AAEA,IAAAQ,sBAAA,GAAAR,OAAA;AAEA,IAAAS,MAAA,GAAAT,OAAA;AAA+E,IAAAU,SAAA;AAAA,SAAAP,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,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IAAQ,CAAC;EAC5B;EAAC,SAAA0B,gBAEeF,SAA2B,EAKrC;IACJ,IAAI,CAACA,SAAS,EAAE;MACd,OAAO,CAAC,CAAC;IACX;;IAEA;IACA,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,EAAE,OAAO,IAAIA,SAAS,CAAC,EAAE;MAC5D,OAAO;QACL5G,OAAO,EAAE,IAAAiH,cAAS,EAACL,SAAS;MAC9B,CAAC;IACH;IAEA,OAAOA,SAAS;EAClB;AAEJ,CAAC;AAACM,OAAA,CAAA/J,qBAAA,GAAAA,qBAAA","ignoreList":[]}
package/dist/cjs/utils.js CHANGED
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.shouldHookBeSkipped = exports.last = exports.isTestPresentInTestPlan = exports.getTestPath = exports.getTestId = exports.getTestFullName = void 0;
7
- var _allureJsCommons = require("allure-js-commons");
8
- var _sdk = require("allure-js-commons/sdk");
6
+ exports.shouldHookBeSkipped = exports.last = exports.getTestPath = exports.getTestId = exports.getTestFullName = void 0;
9
7
  /**
10
8
  * Returns array of names which represents full test hierarchy
11
9
  * Omits ROOT_DESCRIBE_BLOCK because it shouldn't be reported
@@ -32,7 +30,7 @@ var getTestPath = test => {
32
30
  /**
33
31
  * Returns starndartized test name what can be used as test Id
34
32
  *
35
- * @doc https://github.com/jestjs/jest/blob/25a8785584c9d54a05887001ee7f498d489a5441/packages/jest-circus/src/utils.ts#L410
33
+ * @see https://github.com/jestjs/jest/blob/25a8785584c9d54a05887001ee7f498d489a5441/packages/jest-circus/src/utils.ts#L410
36
34
  * @param path Path memebers
37
35
  * @returns
38
36
  */
@@ -62,25 +60,4 @@ var shouldHookBeSkipped = hook => {
62
60
  exports.shouldHookBeSkipped = shouldHookBeSkipped;
63
61
  var last = array => array[array.length - 1];
64
62
  exports.last = last;
65
- var isTestPresentInTestPlan = (testFullName, testPlan) => {
66
- var {
67
- labels
68
- } = (0, _sdk.extractMetadataFromString)(testFullName);
69
- var allureIdLabel = labels.find(_ref => {
70
- var {
71
- name
72
- } = _ref;
73
- return name === _allureJsCommons.LabelName.ALLURE_ID;
74
- });
75
- return testPlan.tests.some(_ref2 => {
76
- var {
77
- id,
78
- selector = ""
79
- } = _ref2;
80
- var idMatched = id ? String(id) === (allureIdLabel === null || allureIdLabel === void 0 ? void 0 : allureIdLabel.value) : false;
81
- var selectorMatched = selector === testFullName;
82
- return idMatched || selectorMatched;
83
- });
84
- };
85
- exports.isTestPresentInTestPlan = isTestPresentInTestPlan;
86
63
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["_allureJsCommons","require","_sdk","getTestPath","test","path","currentUnit","name","unshift","parent","slice","exports","getTestId","join","getTestFullName","jestHookPattern","jestHookLegacyPattern","shouldHookBeSkipped","hook","_stack$split","stackOrError","asyncError","stack","errorFirstLine","split","trim","last","array","length","isTestPresentInTestPlan","testFullName","testPlan","labels","extractMetadataFromString","allureIdLabel","find","_ref","LabelName","ALLURE_ID","tests","some","_ref2","id","selector","idMatched","String","value","selectorMatched"],"sources":["../../src/utils.ts"],"sourcesContent":["import type { Circus } from \"@jest/types\";\nimport { LabelName } from \"allure-js-commons\";\nimport { extractMetadataFromString } from \"allure-js-commons/sdk\";\nimport type { TestPlanV1 } from \"allure-js-commons/sdk\";\n\n/**\n * Returns array of names which represents full test hierarchy\n * Omits ROOT_DESCRIBE_BLOCK because it shouldn't be reported\n *\n * @param test Test or describe block\n * @returns\n */\nexport const getTestPath = (test: Circus.TestEntry | Circus.DescribeBlock): string[] => {\n const path = [];\n let currentUnit: Circus.DescribeBlock | Circus.TestEntry | undefined = test;\n\n while (currentUnit) {\n if (currentUnit.name) {\n path.unshift(currentUnit.name);\n }\n\n currentUnit = currentUnit.parent;\n }\n\n // debugger\n\n // first element is always ROOT_DESCRIBE_BLOCK, which shouldn't be reported\n return path.slice(1);\n};\n\n/**\n * Returns starndartized test name what can be used as test Id\n *\n * @doc https://github.com/jestjs/jest/blob/25a8785584c9d54a05887001ee7f498d489a5441/packages/jest-circus/src/utils.ts#L410\n * @param path Path memebers\n * @returns\n */\nexport const getTestId = (path: string[]): string => path.join(\" \");\n\n/**\n * Returns test full name (test hierarchy joined by \" > \")\n *\n * @param path Path memebers\n * @returns\n */\nexport const getTestFullName = (path: string[]): string => path.join(\" > \");\n\nconst jestHookPattern = /^at jestAdapter/i;\n// A slightly different reference should be used to identify jestAdapter's global hook in some older versions of Jest.\nconst jestHookLegacyPattern = /jest-circus\\/build\\/legacy-code-todo-rewrite\\/jestAdapter.js:\\d+:\\d+$/;\n\nexport const shouldHookBeSkipped = (hook: Circus.Hook): boolean => {\n // In older versions of Jest the hook's stack is direcrly in asyncError. In newer ones - in asyncError.stack.\n const stackOrError: string | Error | undefined = hook?.asyncError;\n const stack = typeof stackOrError === \"string\" ? stackOrError : stackOrError?.stack;\n const errorFirstLine = stack?.split(\"\\n\")?.[1]?.trim() || \"\";\n\n return jestHookPattern.test(errorFirstLine) || jestHookLegacyPattern.test(errorFirstLine);\n};\n\nexport const last = <T>(array: T[]): T => array[array.length - 1];\n\nexport const isTestPresentInTestPlan = (testFullName: string, testPlan: TestPlanV1) => {\n const { labels } = extractMetadataFromString(testFullName);\n const allureIdLabel = labels.find(({ name }) => name === LabelName.ALLURE_ID);\n\n return testPlan.tests.some(({ id, selector = \"\" }) => {\n const idMatched = id ? String(id) === allureIdLabel?.value : false;\n const selectorMatched = selector === testFullName;\n\n return idMatched || selectorMatched;\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAME,WAAW,GAAIC,IAA6C,IAAe;EACtF,IAAMC,IAAI,GAAG,EAAE;EACf,IAAIC,WAAgE,GAAGF,IAAI;EAE3E,OAAOE,WAAW,EAAE;IAClB,IAAIA,WAAW,CAACC,IAAI,EAAE;MAC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AAAA,mBAAA;AAEK,IAAMS,IAAI,GAAOC,KAAU,IAAQA,KAAK,CAACA,KAAK,CAACC,MAAM,GAAG,CAAC,CAAC;AAACjB,OAAA,CAAAe,IAAA,GAAAA,IAAA;AAE3D,IAAMG,uBAAuB,GAAGA,CAACC,YAAoB,EAAEC,QAAoB,KAAK;EACrF,IAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,8BAAyB,EAACH,YAAY,CAAC;EAC1D,IAAMI,aAAa,GAAGF,MAAM,CAACG,IAAI,CAACC,IAAA;IAAA,IAAC;MAAE7B;IAAK,CAAC,GAAA6B,IAAA;IAAA,OAAK7B,IAAI,KAAK8B,0BAAS,CAACC,SAAS;EAAA,EAAC;EAE7E,OAAOP,QAAQ,CAACQ,KAAK,CAACC,IAAI,CAACC,KAAA,IAA2B;IAAA,IAA1B;MAAEC,EAAE;MAAEC,QAAQ,GAAG;IAAG,CAAC,GAAAF,KAAA;IAC/C,IAAMG,SAAS,GAAGF,EAAE,GAAGG,MAAM,CAACH,EAAE,CAAC,MAAKR,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEY,KAAK,IAAG,KAAK;IAClE,IAAMC,eAAe,GAAGJ,QAAQ,KAAKb,YAAY;IAEjD,OAAOc,SAAS,IAAIG,eAAe;EACrC,CAAC,CAAC;AACJ,CAAC;AAACpC,OAAA,CAAAkB,uBAAA,GAAAA,uBAAA","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":["getTestPath","test","path","currentUnit","name","unshift","parent","slice","exports","getTestId","join","getTestFullName","jestHookPattern","jestHookLegacyPattern","shouldHookBeSkipped","hook","_stack$split","stackOrError","asyncError","stack","errorFirstLine","split","trim","last","array","length"],"sources":["../../src/utils.ts"],"sourcesContent":["import type { Circus } from \"@jest/types\";\n\n/**\n * Returns array of names which represents full test hierarchy\n * Omits ROOT_DESCRIBE_BLOCK because it shouldn't be reported\n *\n * @param test Test or describe block\n * @returns\n */\nexport const getTestPath = (test: Circus.TestEntry | Circus.DescribeBlock): string[] => {\n const path = [];\n let currentUnit: Circus.DescribeBlock | Circus.TestEntry | undefined = test;\n\n while (currentUnit) {\n if (currentUnit.name) {\n path.unshift(currentUnit.name);\n }\n\n currentUnit = currentUnit.parent;\n }\n\n // debugger\n\n // first element is always ROOT_DESCRIBE_BLOCK, which shouldn't be reported\n return path.slice(1);\n};\n\n/**\n * Returns starndartized test name what can be used as test Id\n *\n * @see https://github.com/jestjs/jest/blob/25a8785584c9d54a05887001ee7f498d489a5441/packages/jest-circus/src/utils.ts#L410\n * @param path Path memebers\n * @returns\n */\nexport const getTestId = (path: string[]): string => path.join(\" \");\n\n/**\n * Returns test full name (test hierarchy joined by \" > \")\n *\n * @param path Path memebers\n * @returns\n */\nexport const getTestFullName = (path: string[]): string => path.join(\" > \");\n\nconst jestHookPattern = /^at jestAdapter/i;\n// A slightly different reference should be used to identify jestAdapter's global hook in some older versions of Jest.\nconst jestHookLegacyPattern = /jest-circus\\/build\\/legacy-code-todo-rewrite\\/jestAdapter.js:\\d+:\\d+$/;\n\nexport const shouldHookBeSkipped = (hook: Circus.Hook): boolean => {\n // In older versions of Jest the hook's stack is direcrly in asyncError. In newer ones - in asyncError.stack.\n const stackOrError: string | Error | undefined = hook?.asyncError;\n const stack = typeof stackOrError === \"string\" ? stackOrError : stackOrError?.stack;\n const errorFirstLine = stack?.split(\"\\n\")?.[1]?.trim() || \"\";\n\n return jestHookPattern.test(errorFirstLine) || jestHookLegacyPattern.test(errorFirstLine);\n};\n\nexport const last = <T>(array: T[]): T => array[array.length - 1];\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,WAAW,GAAIC,IAA6C,IAAe;EACtF,IAAMC,IAAI,GAAG,EAAE;EACf,IAAIC,WAAgE,GAAGF,IAAI;EAE3E,OAAOE,WAAW,EAAE;IAClB,IAAIA,WAAW,CAACC,IAAI,EAAE;MACpBF,IAAI,CAACG,OAAO,CAACF,WAAW,CAACC,IAAI,CAAC;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KAAK,CAACA,KAAK,CAACC,MAAM,GAAG,CAAC,CAAC;AAACjB,OAAA,CAAAe,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -8,10 +8,13 @@ export class AllureJestTestRuntime extends MessageTestRuntime {
8
8
  this.context = context;
9
9
  context.allureTestRuntime = () => this;
10
10
  }
11
+ sendMessageSync(message) {
12
+ this.jestEnvironment.handleAllureRuntimeMessage(message);
13
+ }
11
14
  sendMessage(message) {
12
15
  var _this = this;
13
16
  return _asyncToGenerator(function* () {
14
- _this.jestEnvironment.handleAllureRuntimeMessage(message);
17
+ _this.sendMessageSync(message);
15
18
  yield Promise.resolve();
16
19
  })();
17
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AllureJestTestRuntime.js","names":["MessageTestRuntime","AllureJestTestRuntime","constructor","jestEnvironment","context","allureTestRuntime","sendMessage","message","_this","_asyncToGenerator","handleAllureRuntimeMessage","Promise","resolve"],"sources":["../../src/AllureJestTestRuntime.ts"],"sourcesContent":["import type { Global } from \"@jest/types\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\nimport { MessageTestRuntime } from \"allure-js-commons/sdk/runtime\";\n\nimport type { AllureJestEnvironment } from \"./model.js\";\n\nexport class AllureJestTestRuntime extends MessageTestRuntime {\n constructor(\n private readonly jestEnvironment: AllureJestEnvironment,\n private readonly context: Global.Global,\n ) {\n super();\n context.allureTestRuntime = () => this;\n }\n\n async sendMessage(message: RuntimeMessage) {\n this.jestEnvironment.handleAllureRuntimeMessage(message);\n\n await Promise.resolve();\n }\n}\n"],"mappings":";;AAEA,SAASA,kBAAkB,QAAQ,+BAA+B;AAIlE,OAAO,MAAMC,qBAAqB,SAASD,kBAAkB,CAAC;EAC5DE,WAAWA,CACQC,eAAsC,EACtCC,OAAsB,EACvC;IACA,KAAK,CAAC,CAAC;IAAC,KAHSD,eAAsC,GAAtCA,eAAsC;IAAA,KACtCC,OAAsB,GAAtBA,OAAsB;IAGvCA,OAAO,CAACC,iBAAiB,GAAG,MAAM,IAAI;EACxC;EAEMC,WAAWA,CAACC,OAAuB,EAAE;IAAA,IAAAC,KAAA;IAAA,OAAAC,iBAAA;MACzCD,KAAI,CAACL,eAAe,CAACO,0BAA0B,CAACH,OAAO,CAAC;MAExD,MAAMI,OAAO,CAACC,OAAO,CAAC,CAAC;IAAC;EAC1B;AACF","ignoreList":[]}
1
+ {"version":3,"file":"AllureJestTestRuntime.js","names":["MessageTestRuntime","AllureJestTestRuntime","constructor","jestEnvironment","context","allureTestRuntime","sendMessageSync","message","handleAllureRuntimeMessage","sendMessage","_this","_asyncToGenerator","Promise","resolve"],"sources":["../../src/AllureJestTestRuntime.ts"],"sourcesContent":["import type { Global } from \"@jest/types\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\nimport { MessageTestRuntime } from \"allure-js-commons/sdk/runtime\";\n\nimport type { AllureJestEnvironment } from \"./model.js\";\n\nexport class AllureJestTestRuntime extends MessageTestRuntime {\n constructor(\n private readonly jestEnvironment: AllureJestEnvironment,\n private readonly context: Global.Global,\n ) {\n super();\n context.allureTestRuntime = () => this;\n }\n\n sendMessageSync(message: RuntimeMessage) {\n this.jestEnvironment.handleAllureRuntimeMessage(message);\n }\n\n async sendMessage(message: RuntimeMessage) {\n this.sendMessageSync(message);\n await Promise.resolve();\n }\n}\n"],"mappings":";;AAEA,SAASA,kBAAkB,QAAQ,+BAA+B;AAIlE,OAAO,MAAMC,qBAAqB,SAASD,kBAAkB,CAAC;EAC5DE,WAAWA,CACQC,eAAsC,EACtCC,OAAsB,EACvC;IACA,KAAK,CAAC,CAAC;IAAC,KAHSD,eAAsC,GAAtCA,eAAsC;IAAA,KACtCC,OAAsB,GAAtBA,OAAsB;IAGvCA,OAAO,CAACC,iBAAiB,GAAG,MAAM,IAAI;EACxC;EAEAC,eAAeA,CAACC,OAAuB,EAAE;IACvC,IAAI,CAACJ,eAAe,CAACK,0BAA0B,CAACD,OAAO,CAAC;EAC1D;EAEME,WAAWA,CAACF,OAAuB,EAAE;IAAA,IAAAG,KAAA;IAAA,OAAAC,iBAAA;MACzCD,KAAI,CAACJ,eAAe,CAACC,OAAO,CAAC;MAC7B,MAAMK,OAAO,CAACC,OAAO,CAAC,CAAC;IAAC;EAC1B;AACF","ignoreList":[]}
@@ -14,11 +14,11 @@ import { env } from "node:process";
14
14
  import * as allure from "allure-js-commons";
15
15
  import { Stage, Status } from "allure-js-commons";
16
16
  import { serialize } from "allure-js-commons/sdk";
17
- import { extractMetadataFromString, getMessageAndTraceFromError, getStatusFromError } from "allure-js-commons/sdk";
18
- import { ReporterRuntime, createDefaultWriter, getEnvironmentLabels, getFrameworkLabel, getHostLabel, getLanguageLabel, getPackageLabel, getPosixPath, getSuiteLabels, getThreadLabel, parseTestPlan } from "allure-js-commons/sdk/reporter";
17
+ import { extractMetadataFromString, getMessageAndTraceFromError, getStatusFromError, isPromise } from "allure-js-commons/sdk";
18
+ import { ReporterRuntime, createDefaultWriter, getEnvironmentLabels, getFrameworkLabel, getHostLabel, getLanguageLabel, getPackageLabel, getPosixPath, getSuiteLabels, getThreadLabel, includedInTestPlan, parseTestPlan } from "allure-js-commons/sdk/reporter";
19
19
  import { setGlobalTestRuntime } from "allure-js-commons/sdk/runtime";
20
20
  import { AllureJestTestRuntime } from "./AllureJestTestRuntime.js";
21
- import { getTestId, getTestPath, isTestPresentInTestPlan, last, shouldHookBeSkipped } from "./utils.js";
21
+ import { getTestId, getTestPath, last, shouldHookBeSkipped } from "./utils.js";
22
22
  var createJestEnvironment = Base => {
23
23
  var _Class_brand;
24
24
  // @ts-expect-error (ts(2545)) Incorrect assumption about a mixin class: https://github.com/microsoft/TypeScript/issues/37142
@@ -26,6 +26,7 @@ var createJestEnvironment = Base => {
26
26
  // config is AllureJestConfig in Jest v28 or greater. In older versions
27
27
  // it's AllureJestProjectConfig. See https://github.com/jestjs/jest/pull/12461
28
28
  constructor(config, context) {
29
+ var _this$handleTestEvent;
29
30
  super(config, context);
30
31
  _classPrivateMethodInitSpec(this, _Class_brand);
31
32
  _defineProperty(this, "testPath", void 0);
@@ -37,51 +38,25 @@ var createJestEnvironment = Base => {
37
38
  scopes: [],
38
39
  skippedTestsFullNamesByTestPlan: []
39
40
  });
40
- _defineProperty(this, "handleTestEvent", event => {
41
- switch (event.name) {
42
- case "hook_start":
43
- _assertClassBrand(_Class_brand, this, _handleHookStart).call(this, event.hook);
44
- break;
45
- case "hook_success":
46
- _assertClassBrand(_Class_brand, this, _handleHookPass).call(this, event.hook);
47
- break;
48
- case "hook_failure":
49
- _assertClassBrand(_Class_brand, this, _handleHookFail).call(this, event.hook, event.error);
50
- break;
51
- case "run_describe_start":
52
- _assertClassBrand(_Class_brand, this, _handleSuiteStart).call(this);
53
- break;
54
- case "run_describe_finish":
55
- _assertClassBrand(_Class_brand, this, _handleSuiteEnd).call(this);
56
- break;
57
- case "test_start":
58
- _assertClassBrand(_Class_brand, this, _handleTestScopeStart).call(this);
59
- break;
60
- case "test_fn_start":
61
- _assertClassBrand(_Class_brand, this, _handleTestStart).call(this, event.test);
62
- break;
63
- case "test_fn_success":
64
- _assertClassBrand(_Class_brand, this, _handleTestPass).call(this, event.test);
65
- break;
66
- case "test_fn_failure":
67
- _assertClassBrand(_Class_brand, this, _handleTestFail).call(this, event.test);
68
- break;
69
- case "test_done":
70
- _assertClassBrand(_Class_brand, this, _handleTestScopeStop).call(this, event.test);
71
- break;
72
- case "test_skip":
73
- _assertClassBrand(_Class_brand, this, _handleTestSkip).call(this, event.test);
74
- break;
75
- case "test_todo":
76
- _assertClassBrand(_Class_brand, this, _handleTestTodo).call(this, event.test);
77
- break;
78
- case "run_finish":
79
- _assertClassBrand(_Class_brand, this, _handleRunFinish).call(this);
80
- break;
81
- default:
82
- break;
41
+ var handleTestEvent = (_this$handleTestEvent = this.handleTestEvent) === null || _this$handleTestEvent === void 0 ? void 0 : _this$handleTestEvent.bind(this);
42
+
43
+ // Preserve any event handler defined by the base or custom environment.
44
+ this.handleTestEvent = (event, state) => {
45
+ var handleAllureEvent = () => _assertClassBrand(_Class_brand, this, _handleTestEvent).call(this, event, state);
46
+
47
+ // Keep Allure's lifecycle in sync even if the custom environment fails,
48
+ // then rethrow the original error so Jest keeps its native behavior.
49
+ try {
50
+ var result = handleTestEvent === null || handleTestEvent === void 0 ? void 0 : handleTestEvent(event, state);
51
+ if (isPromise(result)) {
52
+ return Promise.resolve(result).finally(handleAllureEvent);
53
+ }
54
+ } catch (error) {
55
+ handleAllureEvent();
56
+ throw error;
83
57
  }
84
- });
58
+ handleAllureEvent();
59
+ };
85
60
  var projectConfig = "projectConfig" in config ? config.projectConfig : config;
86
61
  var _ref = (projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.testEnvironmentOptions) || {},
87
62
  {
@@ -118,6 +93,51 @@ var createJestEnvironment = Base => {
118
93
  }
119
94
  }
120
95
  };
96
+ function _handleTestEvent(event, state) {
97
+ switch (event.name) {
98
+ case "hook_start":
99
+ _assertClassBrand(_Class_brand, this, _handleHookStart).call(this, event.hook);
100
+ break;
101
+ case "hook_success":
102
+ _assertClassBrand(_Class_brand, this, _handleHookPass).call(this, event.hook);
103
+ break;
104
+ case "hook_failure":
105
+ _assertClassBrand(_Class_brand, this, _handleHookFail).call(this, event.hook, event.error);
106
+ break;
107
+ case "run_describe_start":
108
+ _assertClassBrand(_Class_brand, this, _handleSuiteStart).call(this);
109
+ break;
110
+ case "run_describe_finish":
111
+ _assertClassBrand(_Class_brand, this, _handleSuiteEnd).call(this);
112
+ break;
113
+ case "test_start":
114
+ _assertClassBrand(_Class_brand, this, _handleTestScopeStart).call(this);
115
+ break;
116
+ case "test_fn_start":
117
+ _assertClassBrand(_Class_brand, this, _handleTestStart).call(this, event.test);
118
+ break;
119
+ case "test_fn_success":
120
+ _assertClassBrand(_Class_brand, this, _handleTestPass).call(this, event.test);
121
+ break;
122
+ case "test_fn_failure":
123
+ _assertClassBrand(_Class_brand, this, _handleTestFail).call(this, event.test);
124
+ break;
125
+ case "test_done":
126
+ _assertClassBrand(_Class_brand, this, _handleTestScopeStop).call(this, event.test);
127
+ break;
128
+ case "test_skip":
129
+ _assertClassBrand(_Class_brand, this, _handleTestSkip).call(this, event.test);
130
+ break;
131
+ case "test_todo":
132
+ _assertClassBrand(_Class_brand, this, _handleTestTodo).call(this, event.test);
133
+ break;
134
+ case "run_finish":
135
+ _assertClassBrand(_Class_brand, this, _handleRunFinish).call(this);
136
+ break;
137
+ default:
138
+ break;
139
+ }
140
+ }
121
141
  function _getTestFullName(test) {
122
142
  var testTitle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : test.name;
123
143
  var newTestSuitePath = getTestPath(test.parent);
@@ -179,7 +199,10 @@ var createJestEnvironment = Base => {
179
199
  links
180
200
  } = extractMetadataFromString(test.name);
181
201
  var newTestFullName = _assertClassBrand(_Class_brand, this, _getTestFullName).call(this, test, cleanTitle);
182
- if (this.testPlan && !isTestPresentInTestPlan(newTestFullName, this.testPlan)) {
202
+ if (this.testPlan && !includedInTestPlan(this.testPlan, {
203
+ fullName: newTestFullName,
204
+ tags: [test.name]
205
+ })) {
183
206
  test.mode = "skip";
184
207
  this.runContext.skippedTestsFullNamesByTestPlan.push(newTestFullName);
185
208
  return;
@@ -204,17 +227,18 @@ var createJestEnvironment = Base => {
204
227
  if (testUuid) {
205
228
  var _tr, _tr2;
206
229
  var {
230
+ status,
207
231
  details
208
232
  } = _assertClassBrand(_Class_brand, this, _statusAndDetails).call(this, test.errors);
209
233
  var tr;
210
234
  this.runtime.updateTest(testUuid, result => {
211
235
  tr = result;
212
236
  });
213
- // hook failure, finish as skipped
237
+ // hook failure, finish with the status reported by Jest
214
238
  if (((_tr = tr) === null || _tr === void 0 ? void 0 : _tr.status) === undefined && ((_tr2 = tr) === null || _tr2 === void 0 ? void 0 : _tr2.stage) === Stage.RUNNING) {
215
239
  this.runtime.updateTest(testUuid, result => {
216
240
  result.stage = Stage.FINISHED;
217
- result.status = Status.SKIPPED;
241
+ result.status = status;
218
242
  result.statusDetails = _objectSpread(_objectSpread({}, result.statusDetails), details);
219
243
  });
220
244
  }
@@ -1 +1 @@
1
- {"version":3,"file":"environmentFactory.js","names":["relative","sep","env","allure","Stage","Status","serialize","extractMetadataFromString","getMessageAndTraceFromError","getStatusFromError","ReporterRuntime","createDefaultWriter","getEnvironmentLabels","getFrameworkLabel","getHostLabel","getLanguageLabel","getPackageLabel","getPosixPath","getSuiteLabels","getThreadLabel","parseTestPlan","setGlobalTestRuntime","AllureJestTestRuntime","getTestId","getTestPath","isTestPresentInTestPlan","last","shouldHookBeSkipped","createJestEnvironment","Base","_Class_brand","WeakSet","constructor","config","context","_classPrivateMethodInitSpec","_defineProperty","executables","steps","scopes","skippedTestsFullNamesByTestPlan","event","name","_assertClassBrand","_handleHookStart","call","hook","_handleHookPass","_handleHookFail","error","_handleSuiteStart","_handleSuiteEnd","_handleTestScopeStart","_handleTestStart","test","_handleTestPass","_handleTestFail","_handleTestScopeStop","_handleTestSkip","_handleTestTodo","_handleRunFinish","projectConfig","_ref","testEnvironmentOptions","resultsDir","restConfig","_objectWithoutProperties","_excluded","runtime","_objectSpread","writer","testPath","rootDir","testPlan","testRuntime","global","setup","teardown","handleAllureRuntimeMessage","message","executableUuid","runContext","applyRuntimeMessages","applyGlobalRuntimeMessages","_getTestFullName","testTitle","arguments","length","undefined","newTestSuitePath","parent","newTestPath","concat","newTestId","_startScope","_stopScope","scopeUuid","fixtureUuid","startFixture","type","push","pop","updateFixture","r","status","PASSED","stage","FINISHED","stopFixture","BROKEN","statusDetails","trace","stack","_test$startedAt","fsPath","split","titlePath","cleanTitle","labels","links","newTestFullName","mode","testUuid","startTest","fullName","start","startedAt","RUNNING","JEST_WORKER_ID","_tr","_tr2","details","_statusAndDetails","errors","tr","updateTest","result","SKIPPED","writeTest","startScope","writeScope","_test$duration","_currentExecutable","suppressedErrors","expect","getState","statusAndDetails","stopTest","duration","_test$duration2","includes","writeEnvironmentInfo","writeCategoriesDefinitions","hasMultipleErrors","Array","isArray","exception","firstError","_convertToError","secondError"],"sources":["../../src/environmentFactory.ts"],"sourcesContent":["import { relative, sep } from \"node:path\";\nimport { env } from \"node:process\";\n\nimport type { EnvironmentContext, JestEnvironment, JestEnvironmentConfig } from \"@jest/environment\";\nimport type { Circus } from \"@jest/types\";\nimport * as allure from \"allure-js-commons\";\nimport { Stage, Status, type StatusDetails, type TestResult } from \"allure-js-commons\";\nimport { type RuntimeMessage, type TestPlanV1, serialize } from \"allure-js-commons/sdk\";\nimport { extractMetadataFromString, getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\nimport {\n ReporterRuntime,\n createDefaultWriter,\n getEnvironmentLabels,\n getFrameworkLabel,\n getHostLabel,\n getLanguageLabel,\n getPackageLabel,\n getPosixPath,\n getSuiteLabels,\n getThreadLabel,\n parseTestPlan,\n} from \"allure-js-commons/sdk/reporter\";\nimport { setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\n\nimport { AllureJestTestRuntime } from \"./AllureJestTestRuntime.js\";\nimport type { AllureJestConfig, AllureJestEnvironment, AllureJestProjectConfig, RunContext } from \"./model.js\";\nimport { getTestId, getTestPath, isTestPresentInTestPlan, last, shouldHookBeSkipped } from \"./utils.js\";\n\nconst createJestEnvironment = <T extends typeof JestEnvironment>(Base: T): T => {\n // @ts-expect-error (ts(2545)) Incorrect assumption about a mixin class: https://github.com/microsoft/TypeScript/issues/37142\n return class extends Base {\n testPath: string;\n testPlan?: TestPlanV1;\n runtime: ReporterRuntime;\n runContext: RunContext = {\n executables: [],\n steps: [],\n scopes: [],\n skippedTestsFullNamesByTestPlan: [],\n };\n\n // config is AllureJestConfig in Jest v28 or greater. In older versions\n // it's AllureJestProjectConfig. See https://github.com/jestjs/jest/pull/12461\n constructor(config: AllureJestConfig | AllureJestProjectConfig, context: EnvironmentContext) {\n super(config as JestEnvironmentConfig, context);\n\n const projectConfig = \"projectConfig\" in config ? config.projectConfig : config;\n const { resultsDir, ...restConfig } = projectConfig?.testEnvironmentOptions || {};\n\n this.runtime = new ReporterRuntime({\n ...restConfig,\n writer: createDefaultWriter({ resultsDir }),\n });\n this.testPath = relative(projectConfig.rootDir, context.testPath);\n this.testPlan = parseTestPlan();\n\n // @ts-ignore\n const testRuntime = new AllureJestTestRuntime(this as AllureJestEnvironment, this.global);\n\n // @ts-ignore\n this.global.allure = allure;\n\n setGlobalTestRuntime(testRuntime);\n }\n\n setup() {\n return super.setup();\n }\n\n teardown() {\n return super.teardown();\n }\n\n handleAllureRuntimeMessage(message: RuntimeMessage) {\n const executableUuid = last(this.runContext.executables);\n if (executableUuid) {\n this.runtime.applyRuntimeMessages(executableUuid, [message]);\n } else {\n this.runtime.applyGlobalRuntimeMessages([message]);\n }\n }\n\n handleTestEvent = (event: Circus.Event) => {\n switch (event.name) {\n case \"hook_start\":\n this.#handleHookStart(event.hook);\n break;\n case \"hook_success\":\n this.#handleHookPass(event.hook);\n break;\n case \"hook_failure\":\n this.#handleHookFail(event.hook, event.error);\n break;\n case \"run_describe_start\":\n this.#handleSuiteStart();\n break;\n case \"run_describe_finish\":\n this.#handleSuiteEnd();\n break;\n case \"test_start\":\n this.#handleTestScopeStart();\n break;\n case \"test_fn_start\":\n this.#handleTestStart(event.test);\n break;\n case \"test_fn_success\":\n this.#handleTestPass(event.test);\n break;\n case \"test_fn_failure\":\n this.#handleTestFail(event.test);\n break;\n case \"test_done\":\n this.#handleTestScopeStop(event.test);\n break;\n case \"test_skip\":\n this.#handleTestSkip(event.test);\n break;\n case \"test_todo\":\n this.#handleTestTodo(event.test);\n break;\n case \"run_finish\":\n this.#handleRunFinish();\n break;\n default:\n break;\n }\n };\n\n #getTestFullName(test: Circus.TestEntry, testTitle: string = test.name) {\n const newTestSuitePath = getTestPath(test.parent);\n const newTestPath = newTestSuitePath.concat(testTitle);\n const newTestId = getTestId(newTestPath);\n\n return `${getPosixPath(this.testPath)}#${newTestId}`;\n }\n\n #handleSuiteStart() {\n this.#startScope();\n }\n\n #handleSuiteEnd() {\n this.#stopScope();\n }\n\n #handleHookStart(hook: Circus.Hook) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const scopeUuid = last(this.runContext.scopes);\n const fixtureUuid = this.runtime.startFixture(scopeUuid, /after/i.test(hook.type) ? \"after\" : \"before\", {\n name: hook.type,\n })!;\n\n this.runContext.executables.push(fixtureUuid);\n }\n\n #handleHookPass(hook: Circus.Hook) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const fixtureUuid = this.runContext.executables.pop()!;\n\n this.runtime.updateFixture(fixtureUuid, (r) => {\n r.status = Status.PASSED;\n r.stage = Stage.FINISHED;\n });\n this.runtime.stopFixture(fixtureUuid);\n }\n\n #handleHookFail(hook: Circus.Hook, error: string | Circus.Exception) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const fixtureUuid = this.runContext.executables.pop()!;\n const status = typeof error === \"string\" ? Status.BROKEN : getStatusFromError(error as Error);\n\n this.runtime.updateFixture(fixtureUuid, (r) => {\n r.status = status;\n r.statusDetails = {\n message: typeof error === \"string\" ? error : error.message,\n trace: typeof error === \"string\" ? undefined : error.stack,\n };\n r.stage = Stage.FINISHED;\n });\n this.runtime.stopFixture(fixtureUuid);\n }\n\n #handleTestStart(test: Circus.TestEntry) {\n const fsPath = this.testPath.split(sep);\n const newTestSuitePath = getTestPath(test.parent);\n const titlePath = fsPath.concat(newTestSuitePath);\n const { cleanTitle, labels, links } = extractMetadataFromString(test.name);\n const newTestFullName = this.#getTestFullName(test, cleanTitle);\n\n if (this.testPlan && !isTestPresentInTestPlan(newTestFullName, this.testPlan)) {\n test.mode = \"skip\";\n this.runContext.skippedTestsFullNamesByTestPlan.push(newTestFullName);\n return;\n }\n\n const testUuid = this.runtime.startTest(\n {\n name: cleanTitle,\n fullName: newTestFullName,\n start: test.startedAt ?? undefined,\n stage: Stage.RUNNING,\n labels: [\n getLanguageLabel(),\n getFrameworkLabel(\"jest\"),\n getPackageLabel(this.testPath),\n getHostLabel(),\n getThreadLabel(env.JEST_WORKER_ID),\n ...getEnvironmentLabels(),\n ...getSuiteLabels(newTestSuitePath),\n ...labels,\n ],\n titlePath,\n links,\n },\n this.runContext.scopes,\n );\n\n this.runContext.executables.push(testUuid);\n\n return testUuid;\n }\n\n #handleTestScopeStart() {\n this.#startScope();\n }\n\n #handleTestScopeStop(test: Circus.TestEntry) {\n const testUuid = this.runContext.executables.pop();\n\n if (testUuid) {\n const { details } = this.#statusAndDetails(test.errors);\n let tr: TestResult | undefined;\n this.runtime.updateTest(testUuid, (result) => {\n tr = result;\n });\n // hook failure, finish as skipped\n if (tr?.status === undefined && tr?.stage === Stage.RUNNING) {\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.SKIPPED;\n result.statusDetails = {\n ...result.statusDetails,\n ...details,\n };\n });\n }\n\n this.runtime.writeTest(testUuid);\n }\n\n this.#stopScope();\n }\n\n #startScope() {\n const scopeUuid = this.runtime.startScope();\n\n this.runContext.scopes.push(scopeUuid);\n }\n\n #stopScope() {\n const scopeUuid = this.runContext.scopes.pop();\n if (!scopeUuid) {\n return;\n }\n\n this.runtime.writeScope(scopeUuid);\n }\n\n #handleTestPass(test: Circus.TestEntry) {\n const testUuid = this.#currentExecutable();\n\n if (!testUuid) {\n return;\n }\n // @ts-ignore\n const { suppressedErrors = [] } = this.global.expect.getState();\n const statusAndDetails = this.#statusAndDetails(suppressedErrors as Circus.TestError[]);\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = statusAndDetails.status;\n result.statusDetails = {\n ...result.statusDetails,\n ...statusAndDetails.details,\n };\n });\n\n this.runtime.stopTest(testUuid, { duration: test.duration ?? 0 });\n }\n\n #handleTestFail(test: Circus.TestEntry) {\n const testUuid = this.#currentExecutable();\n\n if (!testUuid) {\n return;\n }\n\n const { status, details } = this.#statusAndDetails(test.errors);\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = status;\n result.statusDetails = {\n ...result.statusDetails,\n ...details,\n };\n });\n this.runtime.stopTest(testUuid, { duration: test.duration ?? 0 });\n }\n\n #handleTestSkip(test: Circus.TestEntry) {\n const newTestFullName = this.#getTestFullName(test);\n\n if (this.runContext.skippedTestsFullNamesByTestPlan.includes(newTestFullName)) {\n return;\n }\n\n // noinspection JSPotentiallyInvalidUsageOfThis\n const testUuid = this.#handleTestStart(test);\n\n if (!testUuid) {\n return;\n }\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.SKIPPED;\n });\n // noinspection JSPotentiallyInvalidUsageOfThis\n this.#handleTestScopeStop(test);\n }\n\n #handleTestTodo(test: Circus.TestEntry) {\n // noinspection JSPotentiallyInvalidUsageOfThis\n const testUuid = this.#handleTestStart(test);\n if (!testUuid) {\n return;\n }\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.SKIPPED;\n result.statusDetails = {\n message: \"TODO\",\n };\n });\n // noinspection JSPotentiallyInvalidUsageOfThis\n this.#handleTestScopeStop(test);\n }\n\n #handleRunFinish() {\n this.runtime.writeEnvironmentInfo();\n this.runtime.writeCategoriesDefinitions();\n }\n\n #currentExecutable() {\n if (this.runContext.executables.length === 0) {\n return undefined;\n }\n return this.runContext.executables[this.runContext.executables.length - 1];\n }\n\n #statusAndDetails(errors: Circus.TestError[]): { status: Status; details: Partial<StatusDetails> } {\n if (errors.length === 0) {\n return {\n status: Status.PASSED,\n details: {},\n };\n }\n\n // jest collects all errors, but we need to report the first one because it's a reason why the test has been failed\n const [error] = errors;\n const hasMultipleErrors = Array.isArray(error);\n const exception: Circus.Exception = hasMultipleErrors ? error[0] : error;\n const firstError = this.#convertToError(exception);\n\n // in case user throws non-Error type, the first exception is the user-thrown object,\n // while the second one is provided by jest and has correct stack trace\n if (hasMultipleErrors && error.length > 1) {\n const secondError = this.#convertToError(error[1]);\n\n if (!firstError.message) {\n firstError.message = secondError.message;\n }\n\n if (!firstError.stack) {\n firstError.stack = secondError.stack;\n }\n }\n\n const details = getMessageAndTraceFromError(firstError);\n const status = getStatusFromError(firstError);\n\n return { status, details };\n }\n\n #convertToError(exception: Circus.Exception):\n | Error\n | {\n message?: string;\n stack?: string;\n } {\n if (!exception) {\n return {};\n }\n\n // user may throw an object as well\n if (typeof exception !== \"object\" || !(\"stack\" in exception)) {\n return {\n message: serialize(exception),\n };\n }\n\n return exception;\n }\n };\n};\n\nexport { createJestEnvironment };\n"],"mappings":";;;;;;;;;;;AAAA,SAASA,QAAQ,EAAEC,GAAG,QAAQ,WAAW;AACzC,SAASC,GAAG,QAAQ,cAAc;AAIlC,OAAO,KAAKC,MAAM,MAAM,mBAAmB;AAC3C,SAASC,KAAK,EAAEC,MAAM,QAA6C,mBAAmB;AACtF,SAA+CC,SAAS,QAAQ,uBAAuB;AACvF,SAASC,yBAAyB,EAAEC,2BAA2B,EAAEC,kBAAkB,QAAQ,uBAAuB;AAClH,SACEC,eAAe,EACfC,mBAAmB,EACnBC,oBAAoB,EACpBC,iBAAiB,EACjBC,YAAY,EACZC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,cAAc,EACdC,cAAc,EACdC,aAAa,QACR,gCAAgC;AACvC,SAASC,oBAAoB,QAAQ,+BAA+B;AAEpE,SAASC,qBAAqB,QAAQ,4BAA4B;AAElE,SAASC,SAAS,EAAEC,WAAW,EAAEC,uBAAuB,EAAEC,IAAI,EAAEC,mBAAmB,QAAQ,YAAY;AAEvG,IAAMC,qBAAqB,GAAsCC,IAAO,IAAQ;EAAA,IAAAC,YAAA;EAC9E;EACA,OAAAA,YAAA,oBAAAC,OAAA,IAAO,cAAcF,IAAI,CAAC;IAWxB;IACA;IACAG,WAAWA,CAACC,MAAkD,EAAEC,OAA2B,EAAE;MAC3F,KAAK,CAACD,MAAM,EAA2BC,OAAO,CAAC;MAACC,2BAAA,OAAAL,YAAA;MAAAM,eAAA;MAAAA,eAAA;MAAAA,eAAA;MAAAA,eAAA,qBAVzB;QACvBC,WAAW,EAAE,EAAE;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,CAAC;AAED,SAAShI,qBAAqB","ignoreList":[]}
1
+ {"version":3,"file":"environmentFactory.js","names":["relative","sep","env","allure","Stage","Status","serialize","extractMetadataFromString","getMessageAndTraceFromError","getStatusFromError","isPromise","ReporterRuntime","createDefaultWriter","getEnvironmentLabels","getFrameworkLabel","getHostLabel","getLanguageLabel","getPackageLabel","getPosixPath","getSuiteLabels","getThreadLabel","includedInTestPlan","parseTestPlan","setGlobalTestRuntime","AllureJestTestRuntime","getTestId","getTestPath","last","shouldHookBeSkipped","createJestEnvironment","Base","_Class_brand","WeakSet","constructor","config","context","_this$handleTestEvent","_classPrivateMethodInitSpec","_defineProperty","executables","steps","scopes","skippedTestsFullNamesByTestPlan","handleTestEvent","bind","event","state","handleAllureEvent","_assertClassBrand","_handleTestEvent","call","result","Promise","resolve","finally","error","projectConfig","_ref","testEnvironmentOptions","resultsDir","restConfig","_objectWithoutProperties","_excluded","runtime","_objectSpread","writer","testPath","rootDir","testPlan","testRuntime","global","setup","teardown","handleAllureRuntimeMessage","message","executableUuid","runContext","applyRuntimeMessages","applyGlobalRuntimeMessages","name","_handleHookStart","hook","_handleHookPass","_handleHookFail","_handleSuiteStart","_handleSuiteEnd","_handleTestScopeStart","_handleTestStart","test","_handleTestPass","_handleTestFail","_handleTestScopeStop","_handleTestSkip","_handleTestTodo","_handleRunFinish","_getTestFullName","testTitle","arguments","length","undefined","newTestSuitePath","parent","newTestPath","concat","newTestId","_startScope","_stopScope","scopeUuid","fixtureUuid","startFixture","type","push","pop","updateFixture","r","status","PASSED","stage","FINISHED","stopFixture","BROKEN","statusDetails","trace","stack","_test$startedAt","fsPath","split","titlePath","cleanTitle","labels","links","newTestFullName","fullName","tags","mode","testUuid","startTest","start","startedAt","RUNNING","JEST_WORKER_ID","_tr","_tr2","details","_statusAndDetails","errors","tr","updateTest","writeTest","startScope","writeScope","_test$duration","_currentExecutable","suppressedErrors","expect","getState","statusAndDetails","stopTest","duration","_test$duration2","includes","SKIPPED","writeEnvironmentInfo","writeCategoriesDefinitions","hasMultipleErrors","Array","isArray","exception","firstError","_convertToError","secondError"],"sources":["../../src/environmentFactory.ts"],"sourcesContent":["import { relative, sep } from \"node:path\";\nimport { env } from \"node:process\";\n\nimport type { EnvironmentContext, JestEnvironment, JestEnvironmentConfig } from \"@jest/environment\";\nimport type { Circus } from \"@jest/types\";\nimport * as allure from \"allure-js-commons\";\nimport { Stage, Status, type StatusDetails, type TestResult } from \"allure-js-commons\";\nimport { type RuntimeMessage, type TestPlanV1, serialize } from \"allure-js-commons/sdk\";\nimport {\n extractMetadataFromString,\n getMessageAndTraceFromError,\n getStatusFromError,\n isPromise,\n} from \"allure-js-commons/sdk\";\nimport {\n ReporterRuntime,\n createDefaultWriter,\n getEnvironmentLabels,\n getFrameworkLabel,\n getHostLabel,\n getLanguageLabel,\n getPackageLabel,\n getPosixPath,\n getSuiteLabels,\n getThreadLabel,\n includedInTestPlan,\n parseTestPlan,\n} from \"allure-js-commons/sdk/reporter\";\nimport { setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\n\nimport { AllureJestTestRuntime } from \"./AllureJestTestRuntime.js\";\nimport type { AllureJestConfig, AllureJestEnvironment, AllureJestProjectConfig, RunContext } from \"./model.js\";\nimport { getTestId, getTestPath, last, shouldHookBeSkipped } from \"./utils.js\";\n\nconst createJestEnvironment = <T extends typeof JestEnvironment>(Base: T): T => {\n // @ts-expect-error (ts(2545)) Incorrect assumption about a mixin class: https://github.com/microsoft/TypeScript/issues/37142\n return class extends Base {\n testPath: string;\n testPlan?: TestPlanV1;\n runtime: ReporterRuntime;\n runContext: RunContext = {\n executables: [],\n steps: [],\n scopes: [],\n skippedTestsFullNamesByTestPlan: [],\n };\n\n // config is AllureJestConfig in Jest v28 or greater. In older versions\n // it's AllureJestProjectConfig. See https://github.com/jestjs/jest/pull/12461\n constructor(config: AllureJestConfig | AllureJestProjectConfig, context: EnvironmentContext) {\n super(config as JestEnvironmentConfig, context);\n\n const handleTestEvent = this.handleTestEvent?.bind(this) as\n | ((event: Circus.Event, state: Circus.State) => void | PromiseLike<void>)\n | undefined;\n\n // Preserve any event handler defined by the base or custom environment.\n this.handleTestEvent = (event: Circus.Event, state: Circus.State) => {\n const handleAllureEvent = () => this.#handleTestEvent(event, state);\n\n // Keep Allure's lifecycle in sync even if the custom environment fails,\n // then rethrow the original error so Jest keeps its native behavior.\n try {\n const result = handleTestEvent?.(event, state);\n\n if (isPromise(result)) {\n return Promise.resolve(result).finally(handleAllureEvent);\n }\n } catch (error) {\n handleAllureEvent();\n throw error;\n }\n\n handleAllureEvent();\n };\n\n const projectConfig = \"projectConfig\" in config ? config.projectConfig : config;\n const { resultsDir, ...restConfig } = projectConfig?.testEnvironmentOptions || {};\n\n this.runtime = new ReporterRuntime({\n ...restConfig,\n writer: createDefaultWriter({ resultsDir }),\n });\n this.testPath = relative(projectConfig.rootDir, context.testPath);\n this.testPlan = parseTestPlan();\n\n // @ts-ignore\n const testRuntime = new AllureJestTestRuntime(this as AllureJestEnvironment, this.global);\n\n // @ts-ignore\n this.global.allure = allure;\n\n setGlobalTestRuntime(testRuntime);\n }\n\n setup() {\n return super.setup();\n }\n\n teardown() {\n return super.teardown();\n }\n\n handleAllureRuntimeMessage(message: RuntimeMessage) {\n const executableUuid = last(this.runContext.executables);\n if (executableUuid) {\n this.runtime.applyRuntimeMessages(executableUuid, [message]);\n } else {\n this.runtime.applyGlobalRuntimeMessages([message]);\n }\n }\n\n #handleTestEvent(event: Circus.Event, state: Circus.State) {\n switch (event.name) {\n case \"hook_start\":\n this.#handleHookStart(event.hook);\n break;\n case \"hook_success\":\n this.#handleHookPass(event.hook);\n break;\n case \"hook_failure\":\n this.#handleHookFail(event.hook, event.error);\n break;\n case \"run_describe_start\":\n this.#handleSuiteStart();\n break;\n case \"run_describe_finish\":\n this.#handleSuiteEnd();\n break;\n case \"test_start\":\n this.#handleTestScopeStart();\n break;\n case \"test_fn_start\":\n this.#handleTestStart(event.test);\n break;\n case \"test_fn_success\":\n this.#handleTestPass(event.test);\n break;\n case \"test_fn_failure\":\n this.#handleTestFail(event.test);\n break;\n case \"test_done\":\n this.#handleTestScopeStop(event.test);\n break;\n case \"test_skip\":\n this.#handleTestSkip(event.test);\n break;\n case \"test_todo\":\n this.#handleTestTodo(event.test);\n break;\n case \"run_finish\":\n this.#handleRunFinish();\n break;\n default:\n break;\n }\n }\n\n #getTestFullName(test: Circus.TestEntry, testTitle: string = test.name) {\n const newTestSuitePath = getTestPath(test.parent);\n const newTestPath = newTestSuitePath.concat(testTitle);\n const newTestId = getTestId(newTestPath);\n\n return `${getPosixPath(this.testPath)}#${newTestId}`;\n }\n\n #handleSuiteStart() {\n this.#startScope();\n }\n\n #handleSuiteEnd() {\n this.#stopScope();\n }\n\n #handleHookStart(hook: Circus.Hook) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const scopeUuid = last(this.runContext.scopes);\n const fixtureUuid = this.runtime.startFixture(scopeUuid, /after/i.test(hook.type) ? \"after\" : \"before\", {\n name: hook.type,\n })!;\n\n this.runContext.executables.push(fixtureUuid);\n }\n\n #handleHookPass(hook: Circus.Hook) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const fixtureUuid = this.runContext.executables.pop()!;\n\n this.runtime.updateFixture(fixtureUuid, (r) => {\n r.status = Status.PASSED;\n r.stage = Stage.FINISHED;\n });\n this.runtime.stopFixture(fixtureUuid);\n }\n\n #handleHookFail(hook: Circus.Hook, error: string | Circus.Exception) {\n if (shouldHookBeSkipped(hook)) {\n return;\n }\n\n const fixtureUuid = this.runContext.executables.pop()!;\n const status = typeof error === \"string\" ? Status.BROKEN : getStatusFromError(error as Error);\n\n this.runtime.updateFixture(fixtureUuid, (r) => {\n r.status = status;\n r.statusDetails = {\n message: typeof error === \"string\" ? error : error.message,\n trace: typeof error === \"string\" ? undefined : error.stack,\n };\n r.stage = Stage.FINISHED;\n });\n this.runtime.stopFixture(fixtureUuid);\n }\n\n #handleTestStart(test: Circus.TestEntry) {\n const fsPath = this.testPath.split(sep);\n const newTestSuitePath = getTestPath(test.parent);\n const titlePath = fsPath.concat(newTestSuitePath);\n const { cleanTitle, labels, links } = extractMetadataFromString(test.name);\n const newTestFullName = this.#getTestFullName(test, cleanTitle);\n\n if (this.testPlan && !includedInTestPlan(this.testPlan, { fullName: newTestFullName, tags: [test.name] })) {\n test.mode = \"skip\";\n this.runContext.skippedTestsFullNamesByTestPlan.push(newTestFullName);\n return;\n }\n\n const testUuid = this.runtime.startTest(\n {\n name: cleanTitle,\n fullName: newTestFullName,\n start: test.startedAt ?? undefined,\n stage: Stage.RUNNING,\n labels: [\n getLanguageLabel(),\n getFrameworkLabel(\"jest\"),\n getPackageLabel(this.testPath),\n getHostLabel(),\n getThreadLabel(env.JEST_WORKER_ID),\n ...getEnvironmentLabels(),\n ...getSuiteLabels(newTestSuitePath),\n ...labels,\n ],\n titlePath,\n links,\n },\n this.runContext.scopes,\n );\n\n this.runContext.executables.push(testUuid);\n\n return testUuid;\n }\n\n #handleTestScopeStart() {\n this.#startScope();\n }\n\n #handleTestScopeStop(test: Circus.TestEntry) {\n const testUuid = this.runContext.executables.pop();\n\n if (testUuid) {\n const { status, details } = this.#statusAndDetails(test.errors);\n let tr: TestResult | undefined;\n this.runtime.updateTest(testUuid, (result) => {\n tr = result;\n });\n // hook failure, finish with the status reported by Jest\n if (tr?.status === undefined && tr?.stage === Stage.RUNNING) {\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = status;\n result.statusDetails = {\n ...result.statusDetails,\n ...details,\n };\n });\n }\n\n this.runtime.writeTest(testUuid);\n }\n\n this.#stopScope();\n }\n\n #startScope() {\n const scopeUuid = this.runtime.startScope();\n\n this.runContext.scopes.push(scopeUuid);\n }\n\n #stopScope() {\n const scopeUuid = this.runContext.scopes.pop();\n if (!scopeUuid) {\n return;\n }\n\n this.runtime.writeScope(scopeUuid);\n }\n\n #handleTestPass(test: Circus.TestEntry) {\n const testUuid = this.#currentExecutable();\n\n if (!testUuid) {\n return;\n }\n // @ts-ignore\n const { suppressedErrors = [] } = this.global.expect.getState();\n const statusAndDetails = this.#statusAndDetails(suppressedErrors as Circus.TestError[]);\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = statusAndDetails.status;\n result.statusDetails = {\n ...result.statusDetails,\n ...statusAndDetails.details,\n };\n });\n\n this.runtime.stopTest(testUuid, { duration: test.duration ?? 0 });\n }\n\n #handleTestFail(test: Circus.TestEntry) {\n const testUuid = this.#currentExecutable();\n\n if (!testUuid) {\n return;\n }\n\n const { status, details } = this.#statusAndDetails(test.errors);\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = status;\n result.statusDetails = {\n ...result.statusDetails,\n ...details,\n };\n });\n this.runtime.stopTest(testUuid, { duration: test.duration ?? 0 });\n }\n\n #handleTestSkip(test: Circus.TestEntry) {\n const newTestFullName = this.#getTestFullName(test);\n\n if (this.runContext.skippedTestsFullNamesByTestPlan.includes(newTestFullName)) {\n return;\n }\n\n // noinspection JSPotentiallyInvalidUsageOfThis\n const testUuid = this.#handleTestStart(test);\n\n if (!testUuid) {\n return;\n }\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.SKIPPED;\n });\n // noinspection JSPotentiallyInvalidUsageOfThis\n this.#handleTestScopeStop(test);\n }\n\n #handleTestTodo(test: Circus.TestEntry) {\n // noinspection JSPotentiallyInvalidUsageOfThis\n const testUuid = this.#handleTestStart(test);\n if (!testUuid) {\n return;\n }\n\n this.runtime.updateTest(testUuid, (result) => {\n result.stage = Stage.FINISHED;\n result.status = Status.SKIPPED;\n result.statusDetails = {\n message: \"TODO\",\n };\n });\n // noinspection JSPotentiallyInvalidUsageOfThis\n this.#handleTestScopeStop(test);\n }\n\n #handleRunFinish() {\n this.runtime.writeEnvironmentInfo();\n this.runtime.writeCategoriesDefinitions();\n }\n\n #currentExecutable() {\n if (this.runContext.executables.length === 0) {\n return undefined;\n }\n return this.runContext.executables[this.runContext.executables.length - 1];\n }\n\n #statusAndDetails(errors: Circus.TestError[]): { status: Status; details: Partial<StatusDetails> } {\n if (errors.length === 0) {\n return {\n status: Status.PASSED,\n details: {},\n };\n }\n\n // jest collects all errors, but we need to report the first one because it's a reason why the test has been failed\n const [error] = errors;\n const hasMultipleErrors = Array.isArray(error);\n const exception: Circus.Exception = hasMultipleErrors ? error[0] : error;\n const firstError = this.#convertToError(exception);\n\n // in case user throws non-Error type, the first exception is the user-thrown object,\n // while the second one is provided by jest and has correct stack trace\n if (hasMultipleErrors && error.length > 1) {\n const secondError = this.#convertToError(error[1]);\n\n if (!firstError.message) {\n firstError.message = secondError.message;\n }\n\n if (!firstError.stack) {\n firstError.stack = secondError.stack;\n }\n }\n\n const details = getMessageAndTraceFromError(firstError);\n const status = getStatusFromError(firstError);\n\n return { status, details };\n }\n\n #convertToError(exception: Circus.Exception):\n | Error\n | {\n message?: string;\n stack?: string;\n } {\n if (!exception) {\n return {};\n }\n\n // user may throw an object as well\n if (typeof exception !== \"object\" || !(\"stack\" in exception)) {\n return {\n message: serialize(exception),\n };\n }\n\n return exception;\n }\n };\n};\n\nexport { createJestEnvironment };\n"],"mappings":";;;;;;;;;;;AAAA,SAASA,QAAQ,EAAEC,GAAG,QAAQ,WAAW;AACzC,SAASC,GAAG,QAAQ,cAAc;AAIlC,OAAO,KAAKC,MAAM,MAAM,mBAAmB;AAC3C,SAASC,KAAK,EAAEC,MAAM,QAA6C,mBAAmB;AACtF,SAA+CC,SAAS,QAAQ,uBAAuB;AACvF,SACEC,yBAAyB,EACzBC,2BAA2B,EAC3BC,kBAAkB,EAClBC,SAAS,QACJ,uBAAuB;AAC9B,SACEC,eAAe,EACfC,mBAAmB,EACnBC,oBAAoB,EACpBC,iBAAiB,EACjBC,YAAY,EACZC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,cAAc,EACdC,cAAc,EACdC,kBAAkB,EAClBC,aAAa,QACR,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AAK,QAAQ,IAAI,EAAE,OAAO,IAAIA,SAAS,CAAC,EAAE;MAC5D,OAAO;QACL7F,OAAO,EAAEpE,SAAS,CAACiK,SAAS;MAC9B,CAAC;IACH;IAEA,OAAOA,SAAS;EAClB;AAEJ,CAAC;AAED,SAAS1I,qBAAqB","ignoreList":[]}
package/dist/esm/utils.js CHANGED
@@ -1,5 +1,3 @@
1
- import { LabelName } from "allure-js-commons";
2
- import { extractMetadataFromString } from "allure-js-commons/sdk";
3
1
  /**
4
2
  * Returns array of names which represents full test hierarchy
5
3
  * Omits ROOT_DESCRIBE_BLOCK because it shouldn't be reported
@@ -26,7 +24,7 @@ export var getTestPath = test => {
26
24
  /**
27
25
  * Returns starndartized test name what can be used as test Id
28
26
  *
29
- * @doc https://github.com/jestjs/jest/blob/25a8785584c9d54a05887001ee7f498d489a5441/packages/jest-circus/src/utils.ts#L410
27
+ * @see https://github.com/jestjs/jest/blob/25a8785584c9d54a05887001ee7f498d489a5441/packages/jest-circus/src/utils.ts#L410
30
28
  * @param path Path memebers
31
29
  * @returns
32
30
  */
@@ -51,24 +49,4 @@ export var shouldHookBeSkipped = hook => {
51
49
  return jestHookPattern.test(errorFirstLine) || jestHookLegacyPattern.test(errorFirstLine);
52
50
  };
53
51
  export var last = array => array[array.length - 1];
54
- export var isTestPresentInTestPlan = (testFullName, testPlan) => {
55
- var {
56
- labels
57
- } = extractMetadataFromString(testFullName);
58
- var allureIdLabel = labels.find(_ref => {
59
- var {
60
- name
61
- } = _ref;
62
- return name === LabelName.ALLURE_ID;
63
- });
64
- return testPlan.tests.some(_ref2 => {
65
- var {
66
- id,
67
- selector = ""
68
- } = _ref2;
69
- var idMatched = id ? String(id) === (allureIdLabel === null || allureIdLabel === void 0 ? void 0 : allureIdLabel.value) : false;
70
- var selectorMatched = selector === testFullName;
71
- return idMatched || selectorMatched;
72
- });
73
- };
74
52
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["LabelName","extractMetadataFromString","getTestPath","test","path","currentUnit","name","unshift","parent","slice","getTestId","join","getTestFullName","jestHookPattern","jestHookLegacyPattern","shouldHookBeSkipped","hook","_stack$split","stackOrError","asyncError","stack","errorFirstLine","split","trim","last","array","length","isTestPresentInTestPlan","testFullName","testPlan","labels","allureIdLabel","find","_ref","ALLURE_ID","tests","some","_ref2","id","selector","idMatched","String","value","selectorMatched"],"sources":["../../src/utils.ts"],"sourcesContent":["import type { Circus } from \"@jest/types\";\nimport { LabelName } from \"allure-js-commons\";\nimport { extractMetadataFromString } from \"allure-js-commons/sdk\";\nimport type { TestPlanV1 } from \"allure-js-commons/sdk\";\n\n/**\n * Returns array of names which represents full test hierarchy\n * Omits ROOT_DESCRIBE_BLOCK because it shouldn't be reported\n *\n * @param test Test or describe block\n * @returns\n */\nexport const getTestPath = (test: Circus.TestEntry | Circus.DescribeBlock): string[] => {\n const path = [];\n let currentUnit: Circus.DescribeBlock | Circus.TestEntry | undefined = test;\n\n while (currentUnit) {\n if (currentUnit.name) {\n path.unshift(currentUnit.name);\n }\n\n currentUnit = currentUnit.parent;\n }\n\n // debugger\n\n // first element is always ROOT_DESCRIBE_BLOCK, which shouldn't be reported\n return path.slice(1);\n};\n\n/**\n * Returns starndartized test name what can be used as test Id\n *\n * @doc https://github.com/jestjs/jest/blob/25a8785584c9d54a05887001ee7f498d489a5441/packages/jest-circus/src/utils.ts#L410\n * @param path Path memebers\n * @returns\n */\nexport const getTestId = (path: string[]): string => path.join(\" \");\n\n/**\n * Returns test full name (test hierarchy joined by \" > \")\n *\n * @param path Path memebers\n * @returns\n */\nexport const getTestFullName = (path: string[]): string => path.join(\" > \");\n\nconst jestHookPattern = /^at jestAdapter/i;\n// A slightly different reference should be used to identify jestAdapter's global hook in some older versions of Jest.\nconst jestHookLegacyPattern = /jest-circus\\/build\\/legacy-code-todo-rewrite\\/jestAdapter.js:\\d+:\\d+$/;\n\nexport const shouldHookBeSkipped = (hook: Circus.Hook): boolean => {\n // In older versions of Jest the hook's stack is direcrly in asyncError. In newer ones - in asyncError.stack.\n const stackOrError: string | Error | undefined = hook?.asyncError;\n const stack = typeof stackOrError === \"string\" ? stackOrError : stackOrError?.stack;\n const errorFirstLine = stack?.split(\"\\n\")?.[1]?.trim() || \"\";\n\n return jestHookPattern.test(errorFirstLine) || jestHookLegacyPattern.test(errorFirstLine);\n};\n\nexport const last = <T>(array: T[]): T => array[array.length - 1];\n\nexport const isTestPresentInTestPlan = (testFullName: string, testPlan: TestPlanV1) => {\n const { labels } = extractMetadataFromString(testFullName);\n const allureIdLabel = labels.find(({ name }) => name === LabelName.ALLURE_ID);\n\n return testPlan.tests.some(({ id, selector = \"\" }) => {\n const idMatched = id ? String(id) === allureIdLabel?.value : false;\n const selectorMatched = selector === testFullName;\n\n return idMatched || selectorMatched;\n });\n};\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,yBAAyB,QAAQ,uBAAuB;AAGjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,WAAW,GAAIC,IAA6C,IAAe;EACtF,IAAMC,IAAI,GAAG,EAAE;EACf,IAAIC,WAAgE,GAAGF,IAAI;EAE3E,OAAOE,WAAW,EAAE;IAClB,IAAIA,WAAW,CAACC,IAAI,EAAE;MACpBF,IAAI,CAACG,OAAO,CAACF,WAAW,CAACC,IAAI,CAAC;IAChC;IAEAD,WAAW,GAAGA,WAAW,CAACG,MAAM;EAClC;;EAEA;;EAEA;EACA,OAAOJ,IAAI,CAACK,KAAK,CAAC,CAAC,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,SAAS,GAAIN,IAAc,IAAaA,IAAI,CAACO,IAAI,CAAC,GAAG,CAAC;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,eAAe,GAAIR,IAAc,IAAaA,IAAI,CAACO,IAAI,CAAC,KAAK,CAAC;AAE3E,IAAME,eAAe,GAAG,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AAGG,MAAM,CAACH,EAAE,CAAC,MAAKP,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEW,KAAK,IAAG,KAAK;IAClE,IAAMC,eAAe,GAAGJ,QAAQ,KAAKX,YAAY;IAEjD,OAAOY,SAAS,IAAIG,eAAe;EACrC,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":["getTestPath","test","path","currentUnit","name","unshift","parent","slice","getTestId","join","getTestFullName","jestHookPattern","jestHookLegacyPattern","shouldHookBeSkipped","hook","_stack$split","stackOrError","asyncError","stack","errorFirstLine","split","trim","last","array","length"],"sources":["../../src/utils.ts"],"sourcesContent":["import type { Circus } from \"@jest/types\";\n\n/**\n * Returns array of names which represents full test hierarchy\n * Omits ROOT_DESCRIBE_BLOCK because it shouldn't be reported\n *\n * @param test Test or describe block\n * @returns\n */\nexport const getTestPath = (test: Circus.TestEntry | Circus.DescribeBlock): string[] => {\n const path = [];\n let currentUnit: Circus.DescribeBlock | Circus.TestEntry | undefined = test;\n\n while (currentUnit) {\n if (currentUnit.name) {\n path.unshift(currentUnit.name);\n }\n\n currentUnit = currentUnit.parent;\n }\n\n // debugger\n\n // first element is always ROOT_DESCRIBE_BLOCK, which shouldn't be reported\n return path.slice(1);\n};\n\n/**\n * Returns starndartized test name what can be used as test Id\n *\n * @see https://github.com/jestjs/jest/blob/25a8785584c9d54a05887001ee7f498d489a5441/packages/jest-circus/src/utils.ts#L410\n * @param path Path memebers\n * @returns\n */\nexport const getTestId = (path: string[]): string => path.join(\" \");\n\n/**\n * Returns test full name (test hierarchy joined by \" > \")\n *\n * @param path Path memebers\n * @returns\n */\nexport const getTestFullName = (path: string[]): string => path.join(\" > \");\n\nconst jestHookPattern = /^at jestAdapter/i;\n// A slightly different reference should be used to identify jestAdapter's global hook in some older versions of Jest.\nconst jestHookLegacyPattern = /jest-circus\\/build\\/legacy-code-todo-rewrite\\/jestAdapter.js:\\d+:\\d+$/;\n\nexport const shouldHookBeSkipped = (hook: Circus.Hook): boolean => {\n // In older versions of Jest the hook's stack is direcrly in asyncError. In newer ones - in asyncError.stack.\n const stackOrError: string | Error | undefined = hook?.asyncError;\n const stack = typeof stackOrError === \"string\" ? stackOrError : stackOrError?.stack;\n const errorFirstLine = stack?.split(\"\\n\")?.[1]?.trim() || \"\";\n\n return jestHookPattern.test(errorFirstLine) || jestHookLegacyPattern.test(errorFirstLine);\n};\n\nexport const last = <T>(array: T[]): T => array[array.length - 1];\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMA,WAAW,GAAIC,IAA6C,IAAe;EACtF,IAAMC,IAAI,GAAG,EAAE;EACf,IAAIC,WAAgE,GAAGF,IAAI;EAE3E,OAAOE,WAAW,EAAE;IAClB,IAAIA,WAAW,CAACC,IAAI,EAAE;MACpBF,IAAI,CAACG,OAAO,CAACF,WAAW,CAACC,IAAI,CAAC;IAChC;IAEAD,WAAW,GAAGA,WAAW,CAACG,MAAM;EAClC;;EAEA;;EAEA;EACA,OAAOJ,IAAI,CAACK,KAAK,CAAC,CAAC,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,SAAS,GAAIN,IAAc,IAAaA,IAAI,CAACO,IAAI,CAAC,GAAG,CAAC;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,eAAe,GAAIR,IAAc,IAAaA,IAAI,CAACO,IAAI,CAAC,KAAK,CAAC;AAE3E,IAAME,eAAe,GAAG,kBAAkB;AAC1C;AACA,IAAMC,qBAAqB,GAAG,uEAAuE;AAErG,OAAO,IAAMC,mBAAmB,GAAIC,IAAiB,IAAc;EAAA,IAAAC,YAAA;EACjE;EACA,IAAMC,YAAwC,GAAGF,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,UAAU;EACjE,IAAMC,KAAK,GAAG,OAAOF,YAAY,KAAK,QAAQ,GAAGA,YAAY,GAAGA,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEE,KAAK;EACnF,IAAMC,cAAc,GAAG,CAAAD,KAAK,aAALA,KAAK,gBAAAH,YAAA,GAALG,KAAK,CAAEE,KAAK,CAAC,IAAI,CAAC,cAAAL,YAAA,gBAAAA,YAAA,GAAlBA,YAAA,CAAqB,CAAC,CAAC,cAAAA,YAAA,uBAAvBA,YAAA,CAAyBM,IAAI,CAAC,CAAC,KAAI,EAAE;EAE5D,OAAOV,eAAe,CAACV,IAAI,CAACkB,cAAc,CAAC,IAAIP,qBAAqB,CAACX,IAAI,CAACkB,cAAc,CAAC;AAC3F,CAAC;AAED,OAAO,IAAMG,IAAI,GAAOC,KAAU,IAAQA,KAAK,CAACA,KAAK,CAACC,MAAM,GAAG,CAAC,CAAC","ignoreList":[]}
@@ -6,5 +6,6 @@ export declare class AllureJestTestRuntime extends MessageTestRuntime {
6
6
  private readonly jestEnvironment;
7
7
  private readonly context;
8
8
  constructor(jestEnvironment: AllureJestEnvironment, context: Global.Global);
9
+ sendMessageSync(message: RuntimeMessage): void;
9
10
  sendMessage(message: RuntimeMessage): Promise<void>;
10
11
  }
@@ -1,5 +1,4 @@
1
1
  import type { Circus } from "@jest/types";
2
- import type { TestPlanV1 } from "allure-js-commons/sdk";
3
2
  /**
4
3
  * Returns array of names which represents full test hierarchy
5
4
  * Omits ROOT_DESCRIBE_BLOCK because it shouldn't be reported
@@ -11,7 +10,7 @@ export declare const getTestPath: (test: Circus.TestEntry | Circus.DescribeBlock
11
10
  /**
12
11
  * Returns starndartized test name what can be used as test Id
13
12
  *
14
- * @doc https://github.com/jestjs/jest/blob/25a8785584c9d54a05887001ee7f498d489a5441/packages/jest-circus/src/utils.ts#L410
13
+ * @see https://github.com/jestjs/jest/blob/25a8785584c9d54a05887001ee7f498d489a5441/packages/jest-circus/src/utils.ts#L410
15
14
  * @param path Path memebers
16
15
  * @returns
17
16
  */
@@ -25,4 +24,3 @@ export declare const getTestId: (path: string[]) => string;
25
24
  export declare const getTestFullName: (path: string[]) => string;
26
25
  export declare const shouldHookBeSkipped: (hook: Circus.Hook) => boolean;
27
26
  export declare const last: <T>(array: T[]) => T;
28
- export declare const isTestPresentInTestPlan: (testFullName: string, testPlan: TestPlanV1) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allure-jest",
3
- "version": "3.7.1",
3
+ "version": "3.8.0",
4
4
  "description": "Allure Jest integration",
5
5
  "keywords": [
6
6
  "allure",
@@ -60,7 +60,7 @@
60
60
  "test": "vitest run"
61
61
  },
62
62
  "dependencies": {
63
- "allure-js-commons": "3.7.1"
63
+ "allure-js-commons": "3.8.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@babel/cli": "^7.28.0",
@@ -74,7 +74,7 @@
74
74
  "@types/babel__preset-env": "^7.10.0",
75
75
  "@types/node": "^20.19.0",
76
76
  "allure-commandline": "^2.29.0",
77
- "allure-vitest": "3.7.1",
77
+ "allure-vitest": "3.8.0",
78
78
  "babel-plugin-add-module-exports": "^1.0.4",
79
79
  "jest-cli": "^30.0.0",
80
80
  "jest-environment-jsdom": "^30.0.0",