allure-cypress 3.15.0 → 3.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/browser/commandLog.js +44 -57
  3. package/dist/cjs/browser/commandLog.js.map +1 -1
  4. package/dist/cjs/browser/events/cypress.js +3 -4
  5. package/dist/cjs/browser/events/cypress.js.map +1 -1
  6. package/dist/cjs/browser/lifecycle.js +1 -0
  7. package/dist/cjs/browser/lifecycle.js.map +1 -1
  8. package/dist/cjs/browser/patching.js +16 -9
  9. package/dist/cjs/browser/patching.js.map +1 -1
  10. package/dist/cjs/browser/runtime.js +22 -4
  11. package/dist/cjs/browser/runtime.js.map +1 -1
  12. package/dist/cjs/browser/serialize.js +4 -6
  13. package/dist/cjs/browser/serialize.js.map +1 -1
  14. package/dist/cjs/browser/steps.js +11 -5
  15. package/dist/cjs/browser/steps.js.map +1 -1
  16. package/dist/cjs/browser/testplan.js +13 -11
  17. package/dist/cjs/browser/testplan.js.map +1 -1
  18. package/dist/cjs/browser/utils.js +7 -9
  19. package/dist/cjs/browser/utils.js.map +1 -1
  20. package/dist/cjs/index.js +2 -1
  21. package/dist/cjs/index.js.map +4 -4
  22. package/dist/cjs/reporter.js +56 -98
  23. package/dist/cjs/reporter.js.map +1 -1
  24. package/dist/esm/browser/commandLog.js +44 -57
  25. package/dist/esm/browser/commandLog.js.map +1 -1
  26. package/dist/esm/browser/events/cypress.js +3 -4
  27. package/dist/esm/browser/events/cypress.js.map +1 -1
  28. package/dist/esm/browser/lifecycle.js +1 -0
  29. package/dist/esm/browser/lifecycle.js.map +1 -1
  30. package/dist/esm/browser/patching.js +16 -9
  31. package/dist/esm/browser/patching.js.map +1 -1
  32. package/dist/esm/browser/runtime.js +22 -4
  33. package/dist/esm/browser/runtime.js.map +1 -1
  34. package/dist/esm/browser/serialize.js +4 -6
  35. package/dist/esm/browser/serialize.js.map +1 -1
  36. package/dist/esm/browser/steps.js +11 -5
  37. package/dist/esm/browser/steps.js.map +1 -1
  38. package/dist/esm/browser/testplan.js +13 -11
  39. package/dist/esm/browser/testplan.js.map +1 -1
  40. package/dist/esm/browser/utils.js +7 -9
  41. package/dist/esm/browser/utils.js.map +1 -1
  42. package/dist/esm/index.js +2 -1
  43. package/dist/esm/index.js.map +4 -4
  44. package/dist/esm/reporter.js +56 -98
  45. package/dist/esm/reporter.js.map +1 -1
  46. package/dist/types/browser/lifecycle.d.ts +1 -1
  47. package/package.json +13 -9
@@ -1,3 +1,9 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
1
7
  import { isDefined } from "../utils.js";
2
8
  import { reportStepStart } from "./lifecycle.js";
3
9
  import serializePropValue from "./serialize.js";
@@ -9,10 +15,9 @@ export var shouldCreateStepFromCommandLogEntry = entry => {
9
15
  // The user has turned the automatic steps off. Only the steps created via the Allure API are reported.
10
16
  return false;
11
17
  }
12
- var {
13
- event,
14
- instrument
15
- } = entry.attributes;
18
+ var _entry$attributes = entry.attributes,
19
+ event = _entry$attributes.event,
20
+ instrument = _entry$attributes.instrument;
16
21
  if (instrument !== "command") {
17
22
  // We are interested in the "TEST BODY" panel only for now.
18
23
  // Other instruments are logged in separate panels.
@@ -41,12 +46,9 @@ export var shouldCreateStepFromCommandLogEntry = entry => {
41
46
  export var setupScreenshotAttachmentStep = (originalName, name) => {
42
47
  var step = getCurrentStep();
43
48
  if (step && isLogStep(step)) {
44
- var {
45
- name: commandName,
46
- props: {
47
- name: nameFromProps
48
- }
49
- } = resolveConsoleProps(step.log);
49
+ var _resolveConsoleProps = resolveConsoleProps(step.log),
50
+ commandName = _resolveConsoleProps.name,
51
+ nameFromProps = _resolveConsoleProps.props.name;
50
52
  if (commandName === "screenshot" && nameFromProps === originalName) {
51
53
  step.attachmentName = name;
52
54
  }
@@ -62,9 +64,7 @@ export var startCommandLogStep = entry => {
62
64
  scheduleCommandLogStepStop(entry);
63
65
  };
64
66
  export var stopCommandLogStep = entryId => findAndStopStepWithSubsteps(_ref => {
65
- var {
66
- id
67
- } = _ref;
67
+ var id = _ref.id;
68
68
  return id === entryId;
69
69
  });
70
70
  var pushLogEntry = entry => {
@@ -88,11 +88,10 @@ var pushLogEntry = entry => {
88
88
  });
89
89
  };
90
90
  var scheduleCommandLogStepStop = entry => {
91
- var {
92
- groupStart,
93
- end,
94
- id
95
- } = entry.attributes;
91
+ var _entry$attributes2 = entry.attributes,
92
+ groupStart = _entry$attributes2.groupStart,
93
+ end = _entry$attributes2.end,
94
+ id = _entry$attributes2.id;
96
95
  if (end) {
97
96
  // Some entries are already completed (this is similar to the idea behind allure.logStep).
98
97
  // Cypress won't call entry.end() in such a case, so we need to stop such a step now.
@@ -118,25 +117,24 @@ var scheduleCommandLogStepStop = entry => {
118
117
  }
119
118
  };
120
119
  var isApiStepErrorLogEntry = entry => {
121
- var {
122
- name
123
- } = entry.attributes;
120
+ var name = entry.attributes.name;
124
121
  return name === "then" && Object.is(resolveConsoleProps(entry).props["Applied To"], ALLURE_STEP_CMD_SUBJECT);
125
122
  };
126
123
  var getCommandLogStepName = entry => {
127
124
  var _ref2, _ref3, _maybeGetAssertionLog;
128
- var {
129
- name,
130
- message,
131
- displayName
132
- } = entry.attributes;
125
+ var _entry$attributes3 = entry.attributes,
126
+ name = _entry$attributes3.name,
127
+ message = _entry$attributes3.message,
128
+ displayName = _entry$attributes3.displayName;
133
129
  var resolvedName = (displayName !== null && displayName !== void 0 ? displayName : name).trim();
134
130
  var resolvedMessage = ((_ref2 = (_ref3 = (_maybeGetAssertionLog = maybeGetAssertionLogMessage(entry)) !== null && _maybeGetAssertionLog !== void 0 ? _maybeGetAssertionLog : maybeGetCucumberLogMessage(entry)) !== null && _ref3 !== void 0 ? _ref3 : resolveRenderProps(entry).message) !== null && _ref2 !== void 0 ? _ref2 : message).trim();
135
131
  var stepName = [resolvedName, resolvedMessage].filter(Boolean).join(" ");
136
132
  return stepName;
137
133
  };
138
134
  var getCommandLogStepParameters = entry => getLogProps(entry).map(_ref4 => {
139
- var [k, v] = _ref4;
135
+ var _ref5 = _slicedToArray(_ref4, 2),
136
+ k = _ref5[0],
137
+ v = _ref5[1];
140
138
  return {
141
139
  name: k.toString(),
142
140
  value: serializePropValue(v)
@@ -144,22 +142,18 @@ var getCommandLogStepParameters = entry => getLogProps(entry).map(_ref4 => {
144
142
  }).filter(getPropValueSetFilter(entry));
145
143
  var WELL_KNOWN_CUCUMBER_LOG_NAMES = ["Given", "When", "Then", "And"];
146
144
  var maybeGetCucumberLogMessage = entry => {
147
- var {
148
- attributes: {
149
- name,
150
- message
151
- }
152
- } = entry;
145
+ var _entry$attributes4 = entry.attributes,
146
+ name = _entry$attributes4.name,
147
+ message = _entry$attributes4.message;
153
148
  if (WELL_KNOWN_CUCUMBER_LOG_NAMES.includes(name.trim()) && message.startsWith("**") && message.endsWith("**")) {
154
149
  return message.substring(2, message.length - 2);
155
150
  }
156
151
  };
157
152
  var getLogProps = entry => {
158
153
  var isAssertionWithMessage = !!maybeGetAssertionLogMessage(entry);
159
- var {
160
- props,
161
- name
162
- } = resolveConsoleProps(entry);
154
+ var _resolveConsoleProps2 = resolveConsoleProps(entry),
155
+ props = _resolveConsoleProps2.props,
156
+ name = _resolveConsoleProps2.name;
163
157
 
164
158
  // accessing LocalStorage after the page reload can stick the test runner
165
159
  // to avoid the issue, we just need to log the command manually
@@ -173,8 +167,10 @@ var getLogProps = entry => {
173
167
  // For assertion logs, we interpolate the 'Message' property, which contains unformatted assertion description,
174
168
  // directly into the step's name.
175
169
  // No need to keep the exact same information in the step's parameters.
176
- return Object.entries(props).filter(_ref5 => {
177
- var [k, v] = _ref5;
170
+ return Object.entries(props).filter(_ref6 => {
171
+ var _ref7 = _slicedToArray(_ref6, 2),
172
+ k = _ref7[0],
173
+ v = _ref7[1];
178
174
  return isDefined(v) && !(isAssertionWithMessage && k === "Message");
179
175
  });
180
176
  };
@@ -186,30 +182,21 @@ var maybeGetAssertionLogMessage = entry => {
186
182
  }
187
183
  }
188
184
  };
189
- var isAssertLog = _ref6 => {
190
- var {
191
- attributes: {
192
- name
193
- }
194
- } = _ref6;
185
+ var isAssertLog = _ref8 => {
186
+ var name = _ref8.attributes.name;
195
187
  return name === "assert";
196
188
  };
197
189
  var getCurrentLogEntry = () => getStepStack().findLast(isLogStep);
198
190
  var shouldStopCurrentLogStep = (currentLogEntry, newLogEntry) => {
199
- var {
200
- groupStart: currentEntryIsGroup,
201
- type: currentEntryType
202
- } = currentLogEntry.attributes;
203
- var {
204
- type: newEntryType
205
- } = newLogEntry.attributes;
191
+ var _currentLogEntry$attr = currentLogEntry.attributes,
192
+ currentEntryIsGroup = _currentLogEntry$attr.groupStart,
193
+ currentEntryType = _currentLogEntry$attr.type;
194
+ var newEntryType = newLogEntry.attributes.type;
206
195
  return !currentEntryIsGroup && (currentEntryType === "child" || newEntryType !== "child");
207
196
  };
208
- var getPropValueSetFilter = entry => entry.attributes.name === "wrap" ? () => true : _ref7 => {
209
- var {
210
- name,
211
- value
212
- } = _ref7;
197
+ var getPropValueSetFilter = entry => entry.attributes.name === "wrap" ? () => true : _ref9 => {
198
+ var name = _ref9.name,
199
+ value = _ref9.value;
213
200
  return name !== "Yielded" || value !== "{}";
214
201
  };
215
202
  //# sourceMappingURL=commandLog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commandLog.js","names":["isDefined","reportStepStart","serializePropValue","getConfig","getCurrentStep","getStepStack","pushStep","setupStepFinalization","ALLURE_STEP_CMD_SUBJECT","findAndStopStepWithSubsteps","isLogStep","resolveConsoleProps","resolveRenderProps","shouldCreateStepFromCommandLogEntry","entry","stepsFromCommands","enabled","event","instrument","attributes","isApiStepErrorLogEntry","setupScreenshotAttachmentStep","originalName","name","step","commandName","props","nameFromProps","log","attachmentName","startCommandLogStep","currentLogEntry","getCurrentLogEntry","shouldStopCurrentLogStep","stopCommandLogStep","id","pushLogEntry","getCommandLogStepName","scheduleCommandLogStepStop","entryId","_ref","stepDescriptor","type","data","parameters","getCommandLogStepParameters","groupStart","end","originalEndGroup","endGroup","call","originalEnd","Object","is","_ref2","_ref3","_maybeGetAssertionLog","message","displayName","resolvedName","trim","resolvedMessage","maybeGetAssertionLogMessage","maybeGetCucumberLogMessage","stepName","filter","Boolean","join","getLogProps","map","_ref4","k","v","toString","value","getPropValueSetFilter","WELL_KNOWN_CUCUMBER_LOG_NAMES","includes","startsWith","endsWith","substring","length","isAssertionWithMessage","entries","_ref5","isAssertLog","Message","_ref6","findLast","newLogEntry","currentEntryIsGroup","currentEntryType","newEntryType","_ref7"],"sources":["../../../src/browser/commandLog.ts"],"sourcesContent":["import type { Parameter } from \"allure-js-commons\";\n\nimport type { CypressLogEntry, LogStepDescriptor } from \"../types.js\";\nimport { isDefined } from \"../utils.js\";\nimport { reportStepStart } from \"./lifecycle.js\";\nimport serializePropValue from \"./serialize.js\";\nimport { getConfig, getCurrentStep, getStepStack, pushStep, setupStepFinalization } from \"./state.js\";\nimport { ALLURE_STEP_CMD_SUBJECT, findAndStopStepWithSubsteps, isLogStep } from \"./steps.js\";\nimport { resolveConsoleProps, resolveRenderProps } from \"./utils.js\";\n\nexport const shouldCreateStepFromCommandLogEntry = (entry: CypressLogEntry) => {\n if (!getConfig().stepsFromCommands.enabled) {\n // The user has turned the automatic steps off. Only the steps created via the Allure API are reported.\n return false;\n }\n\n const { event, instrument } = entry.attributes;\n if (instrument !== \"command\") {\n // We are interested in the \"TEST BODY\" panel only for now.\n // Other instruments are logged in separate panels.\n return false;\n }\n\n if (event) {\n // Events are tricky to report as they may span across commands and even leave the test's scope.\n // We ignore them for now.\n return false;\n }\n\n if (isApiStepErrorLogEntry(entry)) {\n // Cypress don't create a log message for 'cy.then' except when it throws an error.\n // This is in particularly happens when the function passed to 'allure.step' throws. In such a case however,\n // creating an extra step from the log entry is redundant because the error is already included in the report as\n // a part of the step.\n return false;\n }\n\n return true;\n};\n\n/**\n * Checks if the current step represents a cy.screenshot command log entry. If this is the case, associates the name\n * of the screenshot with the step. Later, that will allow converting the step with the attachment into the attachment\n * step.\n */\nexport const setupScreenshotAttachmentStep = (originalName: string | undefined, name: string) => {\n const step = getCurrentStep();\n if (step && isLogStep(step)) {\n const {\n name: commandName,\n props: { name: nameFromProps },\n } = resolveConsoleProps(step.log);\n if (commandName === \"screenshot\" && nameFromProps === originalName) {\n step.attachmentName = name;\n }\n }\n};\n\nexport const startCommandLogStep = (entry: CypressLogEntry) => {\n const currentLogEntry = getCurrentLogEntry();\n\n if (typeof currentLogEntry !== \"undefined\" && shouldStopCurrentLogStep(currentLogEntry.log, entry)) {\n stopCommandLogStep(currentLogEntry.log.attributes.id);\n }\n\n pushLogEntry(entry);\n reportStepStart(entry.attributes.id, getCommandLogStepName(entry));\n scheduleCommandLogStepStop(entry);\n};\n\nexport const stopCommandLogStep = (entryId: string) => findAndStopStepWithSubsteps(({ id }) => id === entryId);\n\nconst pushLogEntry = (entry: CypressLogEntry) => {\n const id = entry.attributes.id;\n const stepDescriptor: LogStepDescriptor = { id, type: \"log\", log: entry };\n\n pushStep(stepDescriptor);\n\n // Some properties of some Command Log entries are undefined at the time the entry is stopped. An example is the\n // Yielded property of some queries. We defer converting them to Allure step parameters until the test/hook ends.\n setupStepFinalization(stepDescriptor, (data) => {\n data.parameters = getCommandLogStepParameters(entry);\n\n if (stepDescriptor.attachmentName) {\n // Rename the step to match the attachment name. Once the names are the same, Allure will render the\n // attachment in the place of the step.\n data.name = stepDescriptor.attachmentName;\n }\n });\n};\n\nconst scheduleCommandLogStepStop = (entry: CypressLogEntry) => {\n const { groupStart, end, id } = entry.attributes;\n if (end) {\n // Some entries are already completed (this is similar to the idea behind allure.logStep).\n // Cypress won't call entry.end() in such a case, so we need to stop such a step now.\n // Example: cy.log\n stopCommandLogStep(id);\n } else if (groupStart) {\n // A logging group must be stopped be the user via the Cypress.Log.endGroup() call.\n // If the call is missing, the corresponding step will be stopped either at the test's (the hook's) end.\n const originalEndGroup = entry.endGroup;\n entry.endGroup = function () {\n stopCommandLogStep(id);\n return originalEndGroup.call(this);\n };\n } else {\n // Regular log entries are finalized by Cypress via the Cypress.Log.end() call. We're hooking into this function\n // to complete the step at the same time.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalEnd = entry.end;\n entry.end = function () {\n stopCommandLogStep(id);\n return originalEnd.call(this);\n };\n }\n};\n\nconst isApiStepErrorLogEntry = (entry: CypressLogEntry) => {\n const { name } = entry.attributes;\n return name === \"then\" && Object.is(resolveConsoleProps(entry).props[\"Applied To\"], ALLURE_STEP_CMD_SUBJECT);\n};\n\nconst getCommandLogStepName = (entry: CypressLogEntry) => {\n const { name, message, displayName } = entry.attributes;\n const resolvedName = (displayName ?? name).trim();\n const resolvedMessage = (\n maybeGetAssertionLogMessage(entry) ??\n maybeGetCucumberLogMessage(entry) ??\n resolveRenderProps(entry).message ??\n message\n ).trim();\n const stepName = [resolvedName, resolvedMessage].filter(Boolean).join(\" \");\n return stepName;\n};\n\nconst getCommandLogStepParameters = (entry: CypressLogEntry) =>\n getLogProps(entry)\n .map(([k, v]) => ({\n name: k.toString(),\n value: serializePropValue(v),\n }))\n .filter(getPropValueSetFilter(entry));\n\nconst WELL_KNOWN_CUCUMBER_LOG_NAMES = [\"Given\", \"When\", \"Then\", \"And\"];\n\nconst maybeGetCucumberLogMessage = (entry: CypressLogEntry) => {\n const {\n attributes: { name, message },\n } = entry;\n if (WELL_KNOWN_CUCUMBER_LOG_NAMES.includes(name.trim()) && message.startsWith(\"**\") && message.endsWith(\"**\")) {\n return message.substring(2, message.length - 2);\n }\n};\n\nconst getLogProps = (entry: CypressLogEntry) => {\n const isAssertionWithMessage = !!maybeGetAssertionLogMessage(entry);\n const { props, name } = resolveConsoleProps(entry);\n\n // accessing LocalStorage after the page reload can stick the test runner\n // to avoid the issue, we just need to log the command manually\n // the problem potentially can happen with other storage related commands, like `clearAllLocalStorage`, `clearAllSessionStorage`, `getAllLocalStorage`, `getAllSessionStorage`, `setLocalStorage`, `setSessionStorage`\n // but probably, we don't need to silent them all at this moment\n // the context: https://github.com/allure-framework/allure-js/issues/1222\n if ([\"clearLocalStorage\"].includes(name)) {\n return [] as [string, unknown][];\n }\n\n // For assertion logs, we interpolate the 'Message' property, which contains unformatted assertion description,\n // directly into the step's name.\n // No need to keep the exact same information in the step's parameters.\n return Object.entries(props).filter(([k, v]) => isDefined(v) && !(isAssertionWithMessage && k === \"Message\"));\n};\n\nconst maybeGetAssertionLogMessage = (entry: CypressLogEntry) => {\n if (isAssertLog(entry)) {\n const message = resolveConsoleProps(entry).props.Message;\n\n if (message && typeof message === \"string\") {\n return message;\n }\n }\n};\n\nconst isAssertLog = ({ attributes: { name } }: CypressLogEntry) => name === \"assert\";\n\nconst getCurrentLogEntry = () => getStepStack().findLast(isLogStep);\n\nconst shouldStopCurrentLogStep = (currentLogEntry: CypressLogEntry, newLogEntry: CypressLogEntry) => {\n const { groupStart: currentEntryIsGroup, type: currentEntryType } = currentLogEntry.attributes;\n const { type: newEntryType } = newLogEntry.attributes;\n\n return !currentEntryIsGroup && (currentEntryType === \"child\" || newEntryType !== \"child\");\n};\n\nconst getPropValueSetFilter = (entry: CypressLogEntry) =>\n entry.attributes.name === \"wrap\" ? () => true : ({ name, value }: Parameter) => name !== \"Yielded\" || value !== \"{}\";\n"],"mappings":"AAGA,SAASA,SAAS,QAAQ,aAAa;AACvC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,kBAAkB,MAAM,gBAAgB;AAC/C,SAASC,SAAS,EAAEC,cAAc,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,qBAAqB,QAAQ,YAAY;AACrG,SAASC,uBAAuB,EAAEC,2BAA2B,EAAEC,SAAS,QAAQ,YAAY;AAC5F,SAASC,mBAAmB,EAAEC,kBAAkB,QAAQ,YAAY;AAEpE,OAAO,IAAMC,mCAAmC,GAAIC,KAAsB,IAAK;EAC7E,IAAI,CAACX,SAAS,CAAC,CAAC,CAACY,iBAAiB,CAACC,OAAO,EAAE;IAC1C;IACA,OAAO,KAAK;EACd;EAEA,IAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGJ,KAAK,CAACK,UAAU;EAC9C,IAAID,UAAU,KAAK,SAAS,EAAE;IAC5B;IACA;IACA,OAAO,KAAK;EACd;EAEA,IAAID,KAAK,EAAE;IACT;IACA;IACA,OAAO,KAAK;EACd;EAEA,IAAIG,sBAAsB,CAACN,KAAK,CAAC,EAAE;IACjC;IACA;IACA;IACA;IACA,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMO,6BAA6B,GAAGA,CAACC,YAAgC,EAAEC,IAA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AEI;IAAK;EAAmB,CAAC,GAAAgE,KAAA;EAAA,OAAKhE,IAAI,KAAK,QAAQ;AAAA;AAEpF,IAAMS,kBAAkB,GAAGA,CAAA,KAAM3B,YAAY,CAAC,CAAC,CAACmF,QAAQ,CAAC9E,SAAS,CAAC;AAEnE,IAAMuB,wBAAwB,GAAGA,CAACF,eAAgC,EAAE0D,WAA4B,KAAK;EACnG,IAAM;IAAE3C,UAAU,EAAE4C,mBAAmB;IAAEhD,IAAI,EAAEiD;EAAiB,CAAC,GAAG5D,eAAe,CAACZ,UAAU;EAC9F,IAAM;IAAEuB,IAAI,EAAEkD;EAAa,CAAC,GAAGH,WAAW,CAACtE,UAAU;EAErD,OAAO,CAACuE,mBAAmB,KAAKC,gBAAgB,KAAK,OAAO,IAAIC,YAAY,KAAK,OAAO,CAAC;AAC3F,CAAC;AAED,IAAMjB,qBAAqB,GAAI7D,KAAsB,IACnDA,KAAK,CAACK,UAAU,CAACI,IAAI,KAAK,MAAM,GAAG,MAAM,IAAI,GAAGsE,KAAA;EAAA,IAAC;IAAEtE,IAAI;IAAEmD;EAAiB,CAAC,GAAAmB,KAAA;EAAA,OAAKtE,IAAI,KAAK,SAAS,IAAImD,KAAK,KAAK,IAAI;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"commandLog.js","names":["isDefined","reportStepStart","serializePropValue","getConfig","getCurrentStep","getStepStack","pushStep","setupStepFinalization","ALLURE_STEP_CMD_SUBJECT","findAndStopStepWithSubsteps","isLogStep","resolveConsoleProps","resolveRenderProps","shouldCreateStepFromCommandLogEntry","entry","stepsFromCommands","enabled","_entry$attributes","attributes","event","instrument","isApiStepErrorLogEntry","setupScreenshotAttachmentStep","originalName","name","step","_resolveConsoleProps","log","commandName","nameFromProps","props","attachmentName","startCommandLogStep","currentLogEntry","getCurrentLogEntry","shouldStopCurrentLogStep","stopCommandLogStep","id","pushLogEntry","getCommandLogStepName","scheduleCommandLogStepStop","entryId","_ref","stepDescriptor","type","data","parameters","getCommandLogStepParameters","_entry$attributes2","groupStart","end","originalEndGroup","endGroup","call","originalEnd","Object","is","_ref2","_ref3","_maybeGetAssertionLog","_entry$attributes3","message","displayName","resolvedName","trim","resolvedMessage","maybeGetAssertionLogMessage","maybeGetCucumberLogMessage","stepName","filter","Boolean","join","getLogProps","map","_ref4","_ref5","_slicedToArray","k","v","toString","value","getPropValueSetFilter","WELL_KNOWN_CUCUMBER_LOG_NAMES","_entry$attributes4","includes","startsWith","endsWith","substring","length","isAssertionWithMessage","_resolveConsoleProps2","entries","_ref6","_ref7","isAssertLog","Message","_ref8","findLast","newLogEntry","_currentLogEntry$attr","currentEntryIsGroup","currentEntryType","newEntryType","_ref9"],"sources":["../../../src/browser/commandLog.ts"],"sourcesContent":["import type { Parameter } from \"allure-js-commons\";\n\nimport type { CypressLogEntry, LogStepDescriptor } from \"../types.js\";\nimport { isDefined } from \"../utils.js\";\nimport { reportStepStart } from \"./lifecycle.js\";\nimport serializePropValue from \"./serialize.js\";\nimport { getConfig, getCurrentStep, getStepStack, pushStep, setupStepFinalization } from \"./state.js\";\nimport { ALLURE_STEP_CMD_SUBJECT, findAndStopStepWithSubsteps, isLogStep } from \"./steps.js\";\nimport { resolveConsoleProps, resolveRenderProps } from \"./utils.js\";\n\nexport const shouldCreateStepFromCommandLogEntry = (entry: CypressLogEntry) => {\n if (!getConfig().stepsFromCommands.enabled) {\n // The user has turned the automatic steps off. Only the steps created via the Allure API are reported.\n return false;\n }\n\n const { event, instrument } = entry.attributes;\n if (instrument !== \"command\") {\n // We are interested in the \"TEST BODY\" panel only for now.\n // Other instruments are logged in separate panels.\n return false;\n }\n\n if (event) {\n // Events are tricky to report as they may span across commands and even leave the test's scope.\n // We ignore them for now.\n return false;\n }\n\n if (isApiStepErrorLogEntry(entry)) {\n // Cypress don't create a log message for 'cy.then' except when it throws an error.\n // This is in particularly happens when the function passed to 'allure.step' throws. In such a case however,\n // creating an extra step from the log entry is redundant because the error is already included in the report as\n // a part of the step.\n return false;\n }\n\n return true;\n};\n\n/**\n * Checks if the current step represents a cy.screenshot command log entry. If this is the case, associates the name\n * of the screenshot with the step. Later, that will allow converting the step with the attachment into the attachment\n * step.\n */\nexport const setupScreenshotAttachmentStep = (originalName: string | undefined, name: string) => {\n const step = getCurrentStep();\n if (step && isLogStep(step)) {\n const {\n name: commandName,\n props: { name: nameFromProps },\n } = resolveConsoleProps(step.log);\n if (commandName === \"screenshot\" && nameFromProps === originalName) {\n step.attachmentName = name;\n }\n }\n};\n\nexport const startCommandLogStep = (entry: CypressLogEntry) => {\n const currentLogEntry = getCurrentLogEntry();\n\n if (typeof currentLogEntry !== \"undefined\" && shouldStopCurrentLogStep(currentLogEntry.log, entry)) {\n stopCommandLogStep(currentLogEntry.log.attributes.id);\n }\n\n pushLogEntry(entry);\n reportStepStart(entry.attributes.id, getCommandLogStepName(entry));\n scheduleCommandLogStepStop(entry);\n};\n\nexport const stopCommandLogStep = (entryId: string) => findAndStopStepWithSubsteps(({ id }) => id === entryId);\n\nconst pushLogEntry = (entry: CypressLogEntry) => {\n const id = entry.attributes.id;\n const stepDescriptor: LogStepDescriptor = { id, type: \"log\", log: entry };\n\n pushStep(stepDescriptor);\n\n // Some properties of some Command Log entries are undefined at the time the entry is stopped. An example is the\n // Yielded property of some queries. We defer converting them to Allure step parameters until the test/hook ends.\n setupStepFinalization(stepDescriptor, (data) => {\n data.parameters = getCommandLogStepParameters(entry);\n\n if (stepDescriptor.attachmentName) {\n // Rename the step to match the attachment name. Once the names are the same, Allure will render the\n // attachment in the place of the step.\n data.name = stepDescriptor.attachmentName;\n }\n });\n};\n\nconst scheduleCommandLogStepStop = (entry: CypressLogEntry) => {\n const { groupStart, end, id } = entry.attributes;\n if (end) {\n // Some entries are already completed (this is similar to the idea behind allure.logStep).\n // Cypress won't call entry.end() in such a case, so we need to stop such a step now.\n // Example: cy.log\n stopCommandLogStep(id);\n } else if (groupStart) {\n // A logging group must be stopped be the user via the Cypress.Log.endGroup() call.\n // If the call is missing, the corresponding step will be stopped either at the test's (the hook's) end.\n const originalEndGroup = entry.endGroup;\n entry.endGroup = function () {\n stopCommandLogStep(id);\n return originalEndGroup.call(this);\n };\n } else {\n // Regular log entries are finalized by Cypress via the Cypress.Log.end() call. We're hooking into this function\n // to complete the step at the same time.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalEnd = entry.end;\n entry.end = function () {\n stopCommandLogStep(id);\n return originalEnd.call(this);\n };\n }\n};\n\nconst isApiStepErrorLogEntry = (entry: CypressLogEntry) => {\n const { name } = entry.attributes;\n return name === \"then\" && Object.is(resolveConsoleProps(entry).props[\"Applied To\"], ALLURE_STEP_CMD_SUBJECT);\n};\n\nconst getCommandLogStepName = (entry: CypressLogEntry) => {\n const { name, message, displayName } = entry.attributes;\n const resolvedName = (displayName ?? name).trim();\n const resolvedMessage = (\n maybeGetAssertionLogMessage(entry) ??\n maybeGetCucumberLogMessage(entry) ??\n resolveRenderProps(entry).message ??\n message\n ).trim();\n const stepName = [resolvedName, resolvedMessage].filter(Boolean).join(\" \");\n return stepName;\n};\n\nconst getCommandLogStepParameters = (entry: CypressLogEntry) =>\n getLogProps(entry)\n .map(([k, v]) => ({\n name: k.toString(),\n value: serializePropValue(v),\n }))\n .filter(getPropValueSetFilter(entry));\n\nconst WELL_KNOWN_CUCUMBER_LOG_NAMES = [\"Given\", \"When\", \"Then\", \"And\"];\n\nconst maybeGetCucumberLogMessage = (entry: CypressLogEntry) => {\n const {\n attributes: { name, message },\n } = entry;\n if (WELL_KNOWN_CUCUMBER_LOG_NAMES.includes(name.trim()) && message.startsWith(\"**\") && message.endsWith(\"**\")) {\n return message.substring(2, message.length - 2);\n }\n};\n\nconst getLogProps = (entry: CypressLogEntry) => {\n const isAssertionWithMessage = !!maybeGetAssertionLogMessage(entry);\n const { props, name } = resolveConsoleProps(entry);\n\n // accessing LocalStorage after the page reload can stick the test runner\n // to avoid the issue, we just need to log the command manually\n // the problem potentially can happen with other storage related commands, like `clearAllLocalStorage`, `clearAllSessionStorage`, `getAllLocalStorage`, `getAllSessionStorage`, `setLocalStorage`, `setSessionStorage`\n // but probably, we don't need to silent them all at this moment\n // the context: https://github.com/allure-framework/allure-js/issues/1222\n if ([\"clearLocalStorage\"].includes(name)) {\n return [] as [string, unknown][];\n }\n\n // For assertion logs, we interpolate the 'Message' property, which contains unformatted assertion description,\n // directly into the step's name.\n // No need to keep the exact same information in the step's parameters.\n return Object.entries(props).filter(([k, v]) => isDefined(v) && !(isAssertionWithMessage && k === \"Message\"));\n};\n\nconst maybeGetAssertionLogMessage = (entry: CypressLogEntry) => {\n if (isAssertLog(entry)) {\n const message = resolveConsoleProps(entry).props.Message;\n\n if (message && typeof message === \"string\") {\n return message;\n }\n }\n};\n\nconst isAssertLog = ({ attributes: { name } }: CypressLogEntry) => name === \"assert\";\n\nconst getCurrentLogEntry = () => getStepStack().findLast(isLogStep);\n\nconst shouldStopCurrentLogStep = (currentLogEntry: CypressLogEntry, newLogEntry: CypressLogEntry) => {\n const { groupStart: currentEntryIsGroup, type: currentEntryType } = currentLogEntry.attributes;\n const { type: newEntryType } = newLogEntry.attributes;\n\n return !currentEntryIsGroup && (currentEntryType === \"child\" || newEntryType !== \"child\");\n};\n\nconst getPropValueSetFilter = (entry: CypressLogEntry) =>\n entry.attributes.name === \"wrap\" ? () => true : ({ name, value }: Parameter) => name !== \"Yielded\" || value !== \"{}\";\n"],"mappings":";;;;;;AAGA,SAASA,SAAS,QAAQ,aAAa;AACvC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,kBAAkB,MAAM,gBAAgB;AAC/C,SAASC,SAAS,EAAEC,cAAc,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,qBAAqB,QAAQ,YAAY;AACrG,SAASC,uBAAuB,EAAEC,2BAA2B,EAAEC,SAAS,QAAQ,YAAY;AAC5F,SAASC,mBAAmB,EAAEC,kBAAkB,QAAQ,YAAY;AAEpE,OAAO,IAAMC,mCAAmC,GAAIC,KAAsB,IAAK;EAC7E,IAAI,C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Ae,CAACf,UAAU;IAA1EkF,mBAAmB,GAAAD,qBAAA,CAA/BlD,UAAU;IAA6BoD,gBAAgB,GAAAF,qBAAA,CAAtBvD,IAAI;EAC7C,IAAc0D,YAAY,GAAKJ,WAAW,CAAChF,UAAU,CAA7C0B,IAAI;EAEZ,OAAO,CAACwD,mBAAmB,KAAKC,gBAAgB,KAAK,OAAO,IAAIC,YAAY,KAAK,OAAO,CAAC;AAC3F,CAAC;AAED,IAAMrB,qBAAqB,GAAInE,KAAsB,IACnDA,KAAK,CAACI,UAAU,CAACM,IAAI,KAAK,MAAM,GAAG,MAAM,IAAI,GAAG+E,KAAA;EAAA,IAAG/E,IAAI,GAAA+E,KAAA,CAAJ/E,IAAI;IAAEwD,KAAK,GAAAuB,KAAA,CAALvB,KAAK;EAAA,OAAkBxD,IAAI,KAAK,SAAS,IAAIwD,KAAK,KAAK,IAAI;AAAA","ignoreList":[]}
@@ -22,10 +22,9 @@ var onAfterScreenshot = function onAfterScreenshot() {
22
22
  for (var _len2 = arguments.length, _ref = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
23
23
  _ref[_key2] = arguments[_key2];
24
24
  }
25
- var [, {
26
- name: originalName,
27
- path
28
- }] = _ref;
25
+ var _ref$ = _ref[1],
26
+ originalName = _ref$.name,
27
+ path = _ref$.path;
29
28
  var name = originalName !== null && originalName !== void 0 ? originalName : getFileNameFromPath(path);
30
29
  reportScreenshot(path, name);
31
30
  setupScreenshotAttachmentStep(originalName, name);
@@ -1 +1 @@
1
- {"version":3,"file":"cypress.js","names":["setupScreenshotAttachmentStep","shouldCreateStepFromCommandLogEntry","startCommandLogStep","reportScreenshot","reportStepError","getFileNameFromPath","registerCypressEventListeners","Cypress","on","onFail","onLogAdded","enableReportingOfCypressScreenshots","screenshot","Screenshot","original","onAfterScreenshot","_len","arguments","length","args","Array","_key","apply","_len2","_ref","_key2","name","originalName","path","_","entry","error","noSubsequentFailListeners","Object","is","listeners","at"],"sources":["../../../../src/browser/events/cypress.ts"],"sourcesContent":["import type { CypressLogEntry } from \"../../types.js\";\nimport {\n setupScreenshotAttachmentStep,\n shouldCreateStepFromCommandLogEntry,\n startCommandLogStep,\n} from \"../commandLog.js\";\nimport { reportScreenshot } from \"../lifecycle.js\";\nimport { reportStepError } from \"../steps.js\";\nimport { getFileNameFromPath } from \"../utils.js\";\n\nexport const registerCypressEventListeners = () => Cypress.on(\"fail\", onFail).on(\"log:added\", onLogAdded);\n\nexport const enableReportingOfCypressScreenshots = () => {\n // Observe the dispatcher, so later defaults() calls cannot replace Allure's reporting.\n const screenshot = Cypress.Screenshot as unknown as {\n onAfterScreenshot: Cypress.ScreenshotDefaultsOptions[\"onAfterScreenshot\"];\n };\n const original = screenshot.onAfterScreenshot;\n screenshot.onAfterScreenshot = function (...args) {\n try {\n return original.apply(this, args);\n } finally {\n onAfterScreenshot(...args);\n }\n };\n};\n\nconst onAfterScreenshot = (\n ...[, { name: originalName, path }]: Parameters<Cypress.ScreenshotDefaultsOptions[\"onAfterScreenshot\"]>\n) => {\n const name = originalName ?? getFileNameFromPath(path);\n\n reportScreenshot(path, name);\n setupScreenshotAttachmentStep(originalName, name);\n};\n\nconst onLogAdded = (_: Cypress.ObjectLike, entry: CypressLogEntry) => {\n if (shouldCreateStepFromCommandLogEntry(entry)) {\n startCommandLogStep(entry);\n }\n};\n\nconst onFail = (error: Cypress.CypressError) => {\n reportStepError(error);\n\n // If there are more \"fail\" handlers yet to run, it's not our responsibility to throw.\n // Otherwise, we won't give them any chance to do their job (EventEmitter stops executing handlers as soon\n // as one of them throws - that is also true for eventemitter2, which is used by the browser-side of Cypress).\n if (noSubsequentFailListeners()) {\n throw error;\n }\n};\n\nconst noSubsequentFailListeners = () => Object.is(Cypress.listeners(\"fail\").at(-1), onFail);\n"],"mappings":"AACA,SACEA,6BAA6B,EAC7BC,mCAAmC,EACnCC,mBAAmB,QACd,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,eAAe,QAAQ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BAA6B,CAAC2B,YAAY,EAAED,IAAI,CAAC;AACnD,CAAC;AAED,IAAMhB,UAAU,GAAGA,CAACmB,CAAqB,EAAEC,KAAsB,KAAK;EACpE,IAAI7B,mCAAmC,CAAC6B,KAAK,CAAC,EAAE;IAC9C5B,mBAAmB,CAAC4B,KAAK,CAAC;EAC5B;AACF,CAAC;AAED,IAAMrB,MAAM,GAAIsB,KAA2B,IAAK;EAC9C3B,eAAe,CAAC2B,KAAK,CAAC;;EAEtB;EACA;EACA;EACA,IAAIC,yBAAyB,CAAC,CAAC,EAAE;IAC/B,MAAMD,KAAK;EACb;AACF,CAAC;AAED,IAAMC,yBAAyB,GAAGA,CAAA,KAAMC,MAAM,CAACC,EAAE,CAAC3B,OAAO,CAAC4B,SAAS,CAAC,MAAM,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE3B,MAAM,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"cypress.js","names":["setupScreenshotAttachmentStep","shouldCreateStepFromCommandLogEntry","startCommandLogStep","reportScreenshot","reportStepError","getFileNameFromPath","registerCypressEventListeners","Cypress","on","onFail","onLogAdded","enableReportingOfCypressScreenshots","screenshot","Screenshot","original","onAfterScreenshot","_len","arguments","length","args","Array","_key","apply","_len2","_ref","_key2","_ref$","originalName","name","path","_","entry","error","noSubsequentFailListeners","Object","is","listeners","at"],"sources":["../../../../src/browser/events/cypress.ts"],"sourcesContent":["import type { CypressLogEntry } from \"../../types.js\";\nimport {\n setupScreenshotAttachmentStep,\n shouldCreateStepFromCommandLogEntry,\n startCommandLogStep,\n} from \"../commandLog.js\";\nimport { reportScreenshot } from \"../lifecycle.js\";\nimport { reportStepError } from \"../steps.js\";\nimport { getFileNameFromPath } from \"../utils.js\";\n\nexport const registerCypressEventListeners = () => Cypress.on(\"fail\", onFail).on(\"log:added\", onLogAdded);\n\nexport const enableReportingOfCypressScreenshots = () => {\n // Observe the dispatcher, so later defaults() calls cannot replace Allure's reporting.\n const screenshot = Cypress.Screenshot as unknown as {\n onAfterScreenshot: Cypress.ScreenshotDefaultsOptions[\"onAfterScreenshot\"];\n };\n const original = screenshot.onAfterScreenshot;\n screenshot.onAfterScreenshot = function (...args) {\n try {\n return original.apply(this, args);\n } finally {\n onAfterScreenshot(...args);\n }\n };\n};\n\nconst onAfterScreenshot = (\n ...[, { name: originalName, path }]: Parameters<Cypress.ScreenshotDefaultsOptions[\"onAfterScreenshot\"]>\n) => {\n const name = originalName ?? getFileNameFromPath(path);\n\n reportScreenshot(path, name);\n setupScreenshotAttachmentStep(originalName, name);\n};\n\nconst onLogAdded = (_: Cypress.ObjectLike, entry: CypressLogEntry) => {\n if (shouldCreateStepFromCommandLogEntry(entry)) {\n startCommandLogStep(entry);\n }\n};\n\nconst onFail = (error: Cypress.CypressError) => {\n reportStepError(error);\n\n // If there are more \"fail\" handlers yet to run, it's not our responsibility to throw.\n // Otherwise, we won't give them any chance to do their job (EventEmitter stops executing handlers as soon\n // as one of them throws - that is also true for eventemitter2, which is used by the browser-side of Cypress).\n if (noSubsequentFailListeners()) {\n throw error;\n }\n};\n\nconst noSubsequentFailListeners = () => Object.is(Cypress.listeners(\"fail\").at(-1), onFail);\n"],"mappings":"AACA,SACEA,6BAA6B,EAC7BC,mCAAmC,EACnCC,mBAAmB,QACd,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,eAAe,QAAQ,aAAa;AAC7C,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,OAAO,IAAMC,6BAA6B,GAAGA,CAAA,KAAMC,OAAO,CAACC,EAAE,CAAC,MAAM,EAAEC,MAAM,CAAC,CAACD,EAAE,CAAC,WAAW,EAAEE,UAAU,CAAC;AAEzG,OAAO,IAAMC,mCAAmC,GAAGA,CAAA,KAAM;EACvD;EACA,IAAMC,UAAU,GAAGL,OAAO,CAACM,UAE1B;EACD,IAAMC,QAAQ,GAAGF,UAAU,CAACG,iBAAiB;EAC7CH,UAAU,CAACG,iBAAiB,GAAG,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,CAAC,CAAC,EAAE;IAC/B,MAAMD,KAAK;EACb;AACF,CAAC;AAED,IAAMC,yBAAyB,GAAGA,CAAA,KAAMC,MAAM,CAACC,EAAE,CAAC5B,OAAO,CAAC6B,SAAS,CAAC,MAAM,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE5B,MAAM,CAAC","ignoreList":[]}
@@ -182,6 +182,7 @@ export var throwAfterSpecCompletion = (context, err) => {
182
182
  if (!chain) {
183
183
  throw err;
184
184
  }
185
+ return chain;
185
186
  };
186
187
  export var flushRuntimeMessages = () => getTestRuntime().flushAllureMessagesToTask("reportAllureCypressSpecMessages");
187
188
  export var completeSpecAsync = () => getTestRuntime().flushAllureMessagesToTaskAsync("reportFinalAllureCypressSpecMessages");
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.js","names":["ContentType","Status","getMessageAndTraceFromError","getStatusFromError","getTestRuntime","serializeValue","dropCurrentTest","enqueueRuntimeMessage","getCurrentTest","setCurrentTest","finalizeSteps","stopAllSteps","getStatusDataOfTestSkippedByHookError","getStepStopData","getSuitePath","getTestSkipData","getTestStartData","getTestStopData","isAllureHook","isLastRootAfterHook","isTestReported","iterateTests","markTestAsReported","reportRunStart","type","data","reportSuiteStart","suite","id","name","title","root","start","Date","now","reportSuiteEnd","stop","reportHookStart","hook","scopeType","hookName","includes","position","reportHookEnd","_hook$duration","duration","reportTestStart","test","reportStepStart","reportStepStop","step","status","statusDetails","reportTestPass","reportTestOrHookFail","err","completeHookErrorReporting","isEachHook","parent","testFailData","reportCurrentTestIfAny","reportRemainingTests","reportTestSkip","SKIPPED","message","reportTestEnd","_test$duration","_retries","retries","reportScreenshot","path","contentType","PNG","completeSpecIfNoAfterHookLeft","context","completeSpecAsync","completeSpecOnAfterHookFailure","hookError","allureError","logAllureRootAfterError","throwAfterSpecCompletion","_completeSpecOnAfterH","chain","then","flushRuntimeMessages","flushAllureMessagesToTask","flushAllureMessagesToTaskAsync","currentTest","reportTestsSkippedByHookError","pending","_objectSpread","suites","map","s","_context$test$title","_context$test","console","error","concat","_unused"],"sources":["../../../src/browser/lifecycle.ts"],"sourcesContent":["import { ContentType, Status } from \"allure-js-commons\";\nimport type { StatusDetails } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\n\nimport type { CypressFailMessage, CypressHook, CypressSuite, CypressTest, StepDescriptor } from \"../types.js\";\nimport { getTestRuntime } from \"./runtime.js\";\nimport serializeValue from \"./serialize.js\";\nimport { dropCurrentTest, enqueueRuntimeMessage, getCurrentTest, setCurrentTest } from \"./state.js\";\nimport { finalizeSteps, stopAllSteps } from \"./steps.js\";\nimport {\n getStatusDataOfTestSkippedByHookError,\n getStepStopData,\n getSuitePath,\n getTestSkipData,\n getTestStartData,\n getTestStopData,\n isAllureHook,\n isLastRootAfterHook,\n isTestReported,\n iterateTests,\n markTestAsReported,\n} from \"./utils.js\";\n\nexport const reportRunStart = () => {\n enqueueRuntimeMessage({\n type: \"cypress_run_start\",\n data: {},\n });\n};\n\nexport const reportSuiteStart = (suite: CypressSuite) => {\n enqueueRuntimeMessage({\n type: \"cypress_suite_start\",\n data: {\n id: suite.id,\n name: suite.title,\n root: suite.root,\n start: Date.now(),\n },\n });\n};\n\nexport const reportSuiteEnd = (suite: CypressSuite) => {\n enqueueRuntimeMessage({\n type: \"cypress_suite_end\",\n data: {\n root: suite.root,\n stop: Date.now(),\n },\n });\n};\n\nexport const reportHookStart = (hook: CypressHook, start?: number) => {\n enqueueRuntimeMessage({\n type: \"cypress_hook_start\",\n data: {\n name: hook.title,\n scopeType: hook.hookName.includes(\"each\") ? \"each\" : \"all\",\n position: hook.hookName.includes(\"before\") ? \"before\" : \"after\",\n start: start ?? Date.now(),\n },\n });\n};\n\nexport const reportHookEnd = (hook: CypressHook) => {\n finalizeSteps();\n enqueueRuntimeMessage({\n type: \"cypress_hook_end\",\n data: {\n duration: hook.duration ?? 0,\n },\n });\n};\n\nexport const reportTestStart = (test: CypressTest) => {\n setCurrentTest(test);\n enqueueRuntimeMessage({\n type: \"cypress_test_start\",\n data: getTestStartData(test),\n });\n markTestAsReported(test);\n};\n\nexport const reportStepStart = (id: string, name: string) => {\n enqueueRuntimeMessage({\n type: \"cypress_step_start\",\n data: {\n id,\n name,\n start: Date.now(),\n },\n });\n};\n\nexport const reportStepStop = (step: StepDescriptor, status?: Status, statusDetails?: StatusDetails) => {\n enqueueRuntimeMessage({\n type: \"cypress_step_stop\",\n data: getStepStopData(step, status, statusDetails),\n });\n};\n\nexport const reportTestPass = () => {\n enqueueRuntimeMessage({\n type: \"cypress_test_pass\",\n data: {},\n });\n};\n\nexport const reportTestOrHookFail = (err: Error) => {\n const status = getStatusFromError(err);\n const statusDetails = getMessageAndTraceFromError(err, serializeValue);\n\n stopAllSteps(status, statusDetails);\n\n enqueueRuntimeMessage({\n type: \"cypress_fail\",\n data: {\n status,\n statusDetails,\n },\n });\n};\n\nexport const completeHookErrorReporting = (hook: CypressHook, err: Error) => {\n const isEachHook = hook.hookName.includes(\"each\");\n const suite = hook.parent!;\n const testFailData = getStatusDataOfTestSkippedByHookError(hook.title, isEachHook, err, suite);\n\n // Cypress doens't emit 'hook end' if the hook has failed.\n reportHookEnd(hook);\n\n // Cypress doens't emit 'test end' if the hook has failed.\n // We must report the test's end manualy in case of a 'before each' hook.\n reportCurrentTestIfAny();\n\n // Cypress skips the remaining tests in the suite of a failed hook.\n // We should include them to the report manually.\n reportRemainingTests(suite, testFailData);\n};\n\nexport const reportTestSkip = (test: CypressTest) => {\n if (isTestReported(test)) {\n // Ignore pending events for retry attempts that already ended.\n if (getCurrentTest() !== test) {\n return;\n }\n\n stopAllSteps(Status.SKIPPED, {\n message: \"The test was skipped before the command was completed\",\n });\n } else {\n reportTestStart(test);\n }\n\n enqueueRuntimeMessage({\n type: \"cypress_test_skip\",\n data: getTestSkipData(),\n });\n};\n\nexport const reportTestEnd = (test: CypressTest) => {\n finalizeSteps();\n enqueueRuntimeMessage({\n type: \"cypress_test_end\",\n data: {\n duration: test.duration ?? 0,\n retries: (test as any)._retries ?? 0,\n },\n });\n dropCurrentTest();\n};\n\nexport const reportScreenshot = (path: string, name: string) => {\n enqueueRuntimeMessage({\n type: \"attachment_path\",\n data: { path, name, contentType: ContentType.PNG },\n });\n};\n\nexport const completeSpecIfNoAfterHookLeft = (context: Mocha.Context) => {\n if (isLastRootAfterHook(context)) {\n const hook = context.test as CypressHook;\n if (!isAllureHook(hook)) {\n reportHookEnd(hook);\n }\n return completeSpecAsync();\n }\n};\n\nexport const completeSpecOnAfterHookFailure = (\n context: Mocha.Context,\n hookError: Error,\n): Cypress.Chainable<unknown> | undefined => {\n try {\n reportTestOrHookFail(hookError);\n completeHookErrorReporting(context.test as CypressHook, hookError);\n\n // cy.task's then doesn't have onrejected, that's why we don't log async Allure errors here.\n return completeSpecAsync();\n } catch (allureError) {\n logAllureRootAfterError(context, allureError);\n }\n};\n\nexport const throwAfterSpecCompletion = (context: Mocha.Context, err: any) => {\n const chain = completeSpecOnAfterHookFailure(context, err as Error)?.then(() => {\n throw err;\n });\n if (!chain) {\n throw err;\n }\n};\n\nexport const flushRuntimeMessages = () => getTestRuntime().flushAllureMessagesToTask(\"reportAllureCypressSpecMessages\");\n\nexport const completeSpecAsync = () =>\n getTestRuntime().flushAllureMessagesToTaskAsync(\"reportFinalAllureCypressSpecMessages\");\n\nconst reportCurrentTestIfAny = () => {\n const currentTest = getCurrentTest();\n if (currentTest) {\n reportTestEnd(currentTest);\n }\n};\n\nconst reportRemainingTests = (suite: CypressSuite, testFailData: CypressFailMessage[\"data\"]) => {\n for (const test of iterateTests(suite)) {\n // Some tests in the suite might've been already reported.\n if (!isTestReported(test)) {\n reportTestsSkippedByHookError(\n test,\n test.pending ? { ...getTestSkipData(), status: Status.SKIPPED } : testFailData,\n );\n }\n }\n};\n\nconst reportTestsSkippedByHookError = (test: CypressTest, testFailData: CypressFailMessage[\"data\"]) => {\n enqueueRuntimeMessage({\n type: \"cypress_skipped_test\",\n data: {\n ...getTestStartData(test),\n ...testFailData,\n ...getTestStopData(test),\n suites: getSuitePath(test).map((s) => s.id),\n },\n });\n markTestAsReported(test);\n};\n\nconst logAllureRootAfterError = (context: Mocha.Context, err: unknown) => {\n // We play safe and swallow errors here to keep the original 'after all' error.\n try {\n // eslint-disable-next-line no-console\n console.error(`Unexpected error when reporting the failure of ${context.test?.title ?? \"'after all'\"}`);\n // eslint-disable-next-line no-console\n console.error(err);\n } catch {}\n};\n"],"mappings":";;;;;AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,mBAAmB;AAEvD,SAASC,2BAA2B,EAAEC,kBAAkB,QAAQ,uBAAuB;AAGvF,SAASC,cAAc,QAAQ,cAAc;AAC7C,OAAOC,cAAc,MAAM,gBAAgB;AAC3C,SAASC,eAAe,EAAEC,qBAAqB,EAAEC,cAAc,EAAEC,cAAc,QAAQ,YAAY;AACnG,SAASC,aAAa,EAAEC,YAAY,QAAQ,YAAY;AACxD,SACEC,qCAAqC,EACrCC,eAAe,EACfC,YAAY,EACZC,eAAe,EACfC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,mBAAmB,EACnBC,cAAc,EACdC,YAAY,EACZC,kBAAkB,QACb,YAAY;AAEnB,OAAO,IAAMC,cAAc,GAAGA,CAAA,KAAM;EAClChB,qBAAqB,CAAC;IACpBiB,IAAI,EAAE,mBAAmB;IACzBC,IAAI,EAAE,CAAC;EACT,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,IAAMC,gBAAgB,GAAIC,KAAmB,IAAK;EACvDpB,qBAAqB,CAAC;IACpBiB,IAAI,EAAE,qBAAqB;IAC3BC,IAAI,EAAE;MACJG,EAAE,EAAED,KAAK,CAACC,EAAE;MACZC,IAAI,EAAEF,KAAK,CAACG,KAAK;MACjBC,IAAI,EAAEJ,KAAK,CAACI,IAAI;MAChBC,KAAK,EAAEC,IAAI,CAACC,GAAG,CAAC;IAClB;EACF,CAAC,CAAC;AACJ,CAAC;AAED,OAAO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AA,GAAI,aAAa,CAAE,CAAC;IACvG;IACAE,OAAO,CAACC,KAAK,CAAC1C,GAAG,CAAC;EACpB,CAAC,CAAC,OAAA4C,OAAA,EAAM,CAAC;AACX,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"lifecycle.js","names":["ContentType","Status","getMessageAndTraceFromError","getStatusFromError","getTestRuntime","serializeValue","dropCurrentTest","enqueueRuntimeMessage","getCurrentTest","setCurrentTest","finalizeSteps","stopAllSteps","getStatusDataOfTestSkippedByHookError","getStepStopData","getSuitePath","getTestSkipData","getTestStartData","getTestStopData","isAllureHook","isLastRootAfterHook","isTestReported","iterateTests","markTestAsReported","reportRunStart","type","data","reportSuiteStart","suite","id","name","title","root","start","Date","now","reportSuiteEnd","stop","reportHookStart","hook","scopeType","hookName","includes","position","reportHookEnd","_hook$duration","duration","reportTestStart","test","reportStepStart","reportStepStop","step","status","statusDetails","reportTestPass","reportTestOrHookFail","err","completeHookErrorReporting","isEachHook","parent","testFailData","reportCurrentTestIfAny","reportRemainingTests","reportTestSkip","SKIPPED","message","reportTestEnd","_test$duration","_retries","retries","reportScreenshot","path","contentType","PNG","completeSpecIfNoAfterHookLeft","context","completeSpecAsync","completeSpecOnAfterHookFailure","hookError","allureError","logAllureRootAfterError","throwAfterSpecCompletion","_completeSpecOnAfterH","chain","then","flushRuntimeMessages","flushAllureMessagesToTask","flushAllureMessagesToTaskAsync","currentTest","reportTestsSkippedByHookError","pending","_objectSpread","suites","map","s","_context$test$title","_context$test","console","error","concat","_unused"],"sources":["../../../src/browser/lifecycle.ts"],"sourcesContent":["import { ContentType, Status } from \"allure-js-commons\";\nimport type { StatusDetails } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\n\nimport type { CypressFailMessage, CypressHook, CypressSuite, CypressTest, StepDescriptor } from \"../types.js\";\nimport { getTestRuntime } from \"./runtime.js\";\nimport serializeValue from \"./serialize.js\";\nimport { dropCurrentTest, enqueueRuntimeMessage, getCurrentTest, setCurrentTest } from \"./state.js\";\nimport { finalizeSteps, stopAllSteps } from \"./steps.js\";\nimport {\n getStatusDataOfTestSkippedByHookError,\n getStepStopData,\n getSuitePath,\n getTestSkipData,\n getTestStartData,\n getTestStopData,\n isAllureHook,\n isLastRootAfterHook,\n isTestReported,\n iterateTests,\n markTestAsReported,\n} from \"./utils.js\";\n\nexport const reportRunStart = () => {\n enqueueRuntimeMessage({\n type: \"cypress_run_start\",\n data: {},\n });\n};\n\nexport const reportSuiteStart = (suite: CypressSuite) => {\n enqueueRuntimeMessage({\n type: \"cypress_suite_start\",\n data: {\n id: suite.id,\n name: suite.title,\n root: suite.root,\n start: Date.now(),\n },\n });\n};\n\nexport const reportSuiteEnd = (suite: CypressSuite) => {\n enqueueRuntimeMessage({\n type: \"cypress_suite_end\",\n data: {\n root: suite.root,\n stop: Date.now(),\n },\n });\n};\n\nexport const reportHookStart = (hook: CypressHook, start?: number) => {\n enqueueRuntimeMessage({\n type: \"cypress_hook_start\",\n data: {\n name: hook.title,\n scopeType: hook.hookName.includes(\"each\") ? \"each\" : \"all\",\n position: hook.hookName.includes(\"before\") ? \"before\" : \"after\",\n start: start ?? Date.now(),\n },\n });\n};\n\nexport const reportHookEnd = (hook: CypressHook) => {\n finalizeSteps();\n enqueueRuntimeMessage({\n type: \"cypress_hook_end\",\n data: {\n duration: hook.duration ?? 0,\n },\n });\n};\n\nexport const reportTestStart = (test: CypressTest) => {\n setCurrentTest(test);\n enqueueRuntimeMessage({\n type: \"cypress_test_start\",\n data: getTestStartData(test),\n });\n markTestAsReported(test);\n};\n\nexport const reportStepStart = (id: string, name: string) => {\n enqueueRuntimeMessage({\n type: \"cypress_step_start\",\n data: {\n id,\n name,\n start: Date.now(),\n },\n });\n};\n\nexport const reportStepStop = (step: StepDescriptor, status?: Status, statusDetails?: StatusDetails) => {\n enqueueRuntimeMessage({\n type: \"cypress_step_stop\",\n data: getStepStopData(step, status, statusDetails),\n });\n};\n\nexport const reportTestPass = () => {\n enqueueRuntimeMessage({\n type: \"cypress_test_pass\",\n data: {},\n });\n};\n\nexport const reportTestOrHookFail = (err: Error) => {\n const status = getStatusFromError(err);\n const statusDetails = getMessageAndTraceFromError(err, serializeValue);\n\n stopAllSteps(status, statusDetails);\n\n enqueueRuntimeMessage({\n type: \"cypress_fail\",\n data: {\n status,\n statusDetails,\n },\n });\n};\n\nexport const completeHookErrorReporting = (hook: CypressHook, err: Error) => {\n const isEachHook = hook.hookName.includes(\"each\");\n const suite = hook.parent!;\n const testFailData = getStatusDataOfTestSkippedByHookError(hook.title, isEachHook, err, suite);\n\n // Cypress doens't emit 'hook end' if the hook has failed.\n reportHookEnd(hook);\n\n // Cypress doens't emit 'test end' if the hook has failed.\n // We must report the test's end manualy in case of a 'before each' hook.\n reportCurrentTestIfAny();\n\n // Cypress skips the remaining tests in the suite of a failed hook.\n // We should include them to the report manually.\n reportRemainingTests(suite, testFailData);\n};\n\nexport const reportTestSkip = (test: CypressTest) => {\n if (isTestReported(test)) {\n // Ignore pending events for retry attempts that already ended.\n if (getCurrentTest() !== test) {\n return;\n }\n\n stopAllSteps(Status.SKIPPED, {\n message: \"The test was skipped before the command was completed\",\n });\n } else {\n reportTestStart(test);\n }\n\n enqueueRuntimeMessage({\n type: \"cypress_test_skip\",\n data: getTestSkipData(),\n });\n};\n\nexport const reportTestEnd = (test: CypressTest) => {\n finalizeSteps();\n enqueueRuntimeMessage({\n type: \"cypress_test_end\",\n data: {\n duration: test.duration ?? 0,\n retries: (test as any)._retries ?? 0,\n },\n });\n dropCurrentTest();\n};\n\nexport const reportScreenshot = (path: string, name: string) => {\n enqueueRuntimeMessage({\n type: \"attachment_path\",\n data: { path, name, contentType: ContentType.PNG },\n });\n};\n\nexport const completeSpecIfNoAfterHookLeft = (context: Mocha.Context) => {\n if (isLastRootAfterHook(context)) {\n const hook = context.test as CypressHook;\n if (!isAllureHook(hook)) {\n reportHookEnd(hook);\n }\n return completeSpecAsync();\n }\n};\n\nexport const completeSpecOnAfterHookFailure = (\n context: Mocha.Context,\n hookError: Error,\n): Cypress.Chainable<unknown> | undefined => {\n try {\n reportTestOrHookFail(hookError);\n completeHookErrorReporting(context.test as CypressHook, hookError);\n\n // cy.task's then doesn't have onrejected, that's why we don't log async Allure errors here.\n return completeSpecAsync();\n } catch (allureError) {\n logAllureRootAfterError(context, allureError);\n }\n};\n\nexport const throwAfterSpecCompletion = (context: Mocha.Context, err: any) => {\n const chain = completeSpecOnAfterHookFailure(context, err as Error)?.then(() => {\n throw err;\n });\n if (!chain) {\n throw err;\n }\n return chain;\n};\n\nexport const flushRuntimeMessages = () => getTestRuntime().flushAllureMessagesToTask(\"reportAllureCypressSpecMessages\");\n\nexport const completeSpecAsync = () =>\n getTestRuntime().flushAllureMessagesToTaskAsync(\"reportFinalAllureCypressSpecMessages\");\n\nconst reportCurrentTestIfAny = () => {\n const currentTest = getCurrentTest();\n if (currentTest) {\n reportTestEnd(currentTest);\n }\n};\n\nconst reportRemainingTests = (suite: CypressSuite, testFailData: CypressFailMessage[\"data\"]) => {\n for (const test of iterateTests(suite)) {\n // Some tests in the suite might've been already reported.\n if (!isTestReported(test)) {\n reportTestsSkippedByHookError(\n test,\n test.pending ? { ...getTestSkipData(), status: Status.SKIPPED } : testFailData,\n );\n }\n }\n};\n\nconst reportTestsSkippedByHookError = (test: CypressTest, testFailData: CypressFailMessage[\"data\"]) => {\n enqueueRuntimeMessage({\n type: \"cypress_skipped_test\",\n data: {\n ...getTestStartData(test),\n ...testFailData,\n ...getTestStopData(test),\n suites: getSuitePath(test).map((s) => s.id),\n },\n });\n markTestAsReported(test);\n};\n\nconst logAllureRootAfterError = (context: Mocha.Context, err: unknown) => {\n // We play safe and swallow errors here to keep the original 'after all' error.\n try {\n // eslint-disable-next-line no-console\n console.error(`Unexpected error when reporting the failure of ${context.test?.title ?? \"'after all'\"}`);\n // eslint-disable-next-line no-console\n console.error(err);\n } catch {}\n};\n"],"mappings":";;;;;AAAA,SAASA,WAAW,EAAEC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A6B,CAC3BzC,IAAI,EACJA,IAAI,CAAC0C,OAAO,GAAAC,aAAA,CAAAA,aAAA,KAAQ3E,eAAe,CAAC,CAAC;QAAEoC,MAAM,EAAElD,MAAM,CAAC8D;MAAO,KAAKJ,YACpE,CAAC;IACH;EACF;AACF,CAAC;AAED,IAAM6B,6BAA6B,GAAGA,CAACzC,IAAiB,EAAEY,YAAwC,KAAK;EACrGpD,qBAAqB,CAAC;IACpBiB,IAAI,EAAE,sBAAsB;IAC5BC,IAAI,EAAAiE,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAAA,aAAA,KACC1E,gBAAgB,CAAC+B,IAAI,CAAC,GACtBY,YAAY,GACZ1C,eAAe,CAAC8B,IAAI,CAAC;MACxB4C,MAAM,EAAE7E,YAAY,CAACiC,IAAI,CAAC,CAAC6C,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACjE,EAAE;IAAC;EAE/C,CAAC,CAAC;EACFN,kBAAkB,CAACyB,IAAI,CAAC;AAC1B,CAAC;AAED,IAAMgC,uBAAuB,GAAGA,CAACL,OAAsB,EAAEnB,GAAY,KAAK;EACxE;EACA,IAAI;IAAA,IAAAuC,mBAAA,EAAAC,aAAA;IACF;IACAC,OAAO,CAACC,KAAK,mDAAAC,MAAA,EAAAJ,mBAAA,IAAAC,aAAA,GAAmDrB,OAAO,CAAC3B,IAAI,cAAAgD,aAAA,uBAAZA,aAAA,CAAcjE,KAAK,cAAAgE,mBAAA,cAAAA,mBAAA,GAAI,aAAa,CAAE,CAAC;IACvG;IACAE,OAAO,CAACC,KAAK,CAAC1C,GAAG,CAAC;EACpB,CAAC,CAAC,OAAA4C,OAAA,EAAM,CAAC;AACX,CAAC","ignoreList":[]}
@@ -22,10 +22,8 @@ var createSuiteDepthCounterState = () => {
22
22
  };
23
23
  };
24
24
  var patchDescribe = _ref => {
25
- var {
26
- incrementSuiteDepth,
27
- decrementSuiteDepth
28
- } = _ref;
25
+ var incrementSuiteDepth = _ref.incrementSuiteDepth,
26
+ decrementSuiteDepth = _ref.decrementSuiteDepth;
29
27
  var patchDescribeFn = target => (title, configOrFn, fn) => {
30
28
  incrementSuiteDepth();
31
29
  try {
@@ -41,9 +39,7 @@ var patchDescribe = _ref => {
41
39
  globalThis.describe = patchedDescribe;
42
40
  };
43
41
  var patchAfter = _ref2 => {
44
- var {
45
- getSuiteDepth
46
- } = _ref2;
42
+ var getSuiteDepth = _ref2.getSuiteDepth;
47
43
  var originalAfter = globalThis.after;
48
44
  var patchedAfter = (nameOrFn, fn) => {
49
45
  return typeof nameOrFn === "string" ? originalAfter(nameOrFn, wrapRootAfterFn(getSuiteDepth, fn)) : originalAfter(wrapRootAfterFn(getSuiteDepth, nameOrFn));
@@ -54,7 +50,9 @@ var forwardDescribeCall = function forwardDescribeCall(target) {
54
50
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
55
51
  args[_key - 1] = arguments[_key];
56
52
  }
57
- var [title, configOrFn, fn] = args;
53
+ var title = args[0],
54
+ configOrFn = args[1],
55
+ fn = args[2];
58
56
  if (typeof fn === "undefined" && typeof configOrFn === "undefined") {
59
57
  return target(title);
60
58
  } else if (typeof configOrFn === "function") {
@@ -109,7 +107,16 @@ var wrapAfterFnWithoutArgs = fn => {
109
107
  if (syncError) {
110
108
  throwAfterSpecCompletion(this, syncError);
111
109
  } else if (isPromise(result)) {
112
- return result.then(() => completeSpecIfNoAfterHookLeft(this), asyncError => throwAfterSpecCompletion(this, asyncError));
110
+ // Await the hook without queuing Cypress commands inside its promise callbacks.
111
+ var outcome = result.then(() => ({
112
+ ok: true
113
+ }), error => ({
114
+ ok: false,
115
+ error
116
+ }));
117
+ return cy.then(() => outcome).then(settled => {
118
+ return settled.ok ? completeSpecIfNoAfterHookLeft(this) : throwAfterSpecCompletion(this, settled.error);
119
+ });
113
120
  } else {
114
121
  completeSpecIfNoAfterHookLeft(this);
115
122
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"patching.js","names":["isPromise","completeSpecIfNoAfterHookLeft","completeSpecOnAfterHookFailure","throwAfterSpecCompletion","enableScopeLevelAfterHookReporting","suiteDepthCounter","createSuiteDepthCounterState","patchDescribe","patchAfter","suiteDepth","getSuiteDepth","incrementSuiteDepth","decrementSuiteDepth","_ref","patchDescribeFn","target","title","configOrFn","fn","forwardDescribeCall","originalDescribeFn","globalThis","describe","patchedDescribe","only","skip","_ref2","originalAfter","after","patchedAfter","nameOrFn","wrapRootAfterFn","_len","arguments","length","args","Array","_key","wrappedFn","wrapAfterFnWithCallback","wrapAfterFnWithoutArgs","Object","defineProperty","value","name","done","wrappedDone","hookError","_completeSpecOnAfterH","then","_completeSpecIfNoAfte","allureError","bind","result","syncError","e","asyncError"],"sources":["../../../src/browser/patching.ts"],"sourcesContent":["import { isPromise } from \"allure-js-commons/sdk\";\n\nimport type { CypressSuiteFunction, DirectHookImplementation, HookImplementation } from \"../types.js\";\nimport {\n completeSpecIfNoAfterHookLeft,\n completeSpecOnAfterHookFailure,\n throwAfterSpecCompletion,\n} from \"./lifecycle.js\";\n\ntype SuiteDepthCounter = {\n getSuiteDepth: () => number;\n incrementSuiteDepth: () => void;\n decrementSuiteDepth: () => void;\n};\n\n/**\n * Patches the `after` function, to inject reporting of spec-level\n * `after` hooks defined by the user.\n */\nexport const enableScopeLevelAfterHookReporting = () => {\n const suiteDepthCounter = createSuiteDepthCounterState();\n patchDescribe(suiteDepthCounter);\n patchAfter(suiteDepthCounter);\n};\n\nconst createSuiteDepthCounterState = (): SuiteDepthCounter => {\n let suiteDepth = 0;\n return {\n getSuiteDepth: () => suiteDepth,\n incrementSuiteDepth: () => {\n suiteDepth++;\n },\n decrementSuiteDepth: () => {\n suiteDepth--;\n },\n };\n};\n\nconst patchDescribe = ({ incrementSuiteDepth, decrementSuiteDepth }: SuiteDepthCounter) => {\n const patchDescribeFn =\n (target: CypressSuiteFunction): CypressSuiteFunction =>\n (title, configOrFn, fn) => {\n incrementSuiteDepth();\n try {\n return forwardDescribeCall(target, title, configOrFn, fn);\n } finally {\n decrementSuiteDepth();\n }\n };\n const originalDescribeFn: Mocha.SuiteFunction = globalThis.describe;\n const patchedDescribe = patchDescribeFn(originalDescribeFn) as Mocha.SuiteFunction;\n patchedDescribe.only = patchDescribeFn(\n originalDescribeFn.only as CypressSuiteFunction,\n ) as Mocha.ExclusiveSuiteFunction;\n patchedDescribe.skip = patchDescribeFn(originalDescribeFn.skip as CypressSuiteFunction) as Mocha.PendingSuiteFunction;\n globalThis.describe = patchedDescribe;\n};\n\nconst patchAfter = ({ getSuiteDepth }: SuiteDepthCounter) => {\n const originalAfter = globalThis.after;\n const patchedAfter = (nameOrFn: string | HookImplementation, fn?: HookImplementation): void => {\n return typeof nameOrFn === \"string\"\n ? originalAfter(nameOrFn, wrapRootAfterFn(getSuiteDepth, fn))\n : originalAfter(wrapRootAfterFn(getSuiteDepth, nameOrFn)!);\n };\n globalThis.after = patchedAfter;\n};\n\nconst forwardDescribeCall = (target: CypressSuiteFunction, ...args: Parameters<CypressSuiteFunction>) => {\n const [title, configOrFn, fn] = args;\n if (typeof fn === \"undefined\" && typeof configOrFn === \"undefined\") {\n return target(title);\n } else if (typeof configOrFn === \"function\") {\n return target(title, configOrFn);\n } else {\n return target(title, configOrFn, fn);\n }\n};\n\nconst wrapRootAfterFn = (getSuiteDepth: () => number, fn?: HookImplementation): HookImplementation | undefined => {\n if (getSuiteDepth() === 0 && fn) {\n const wrappedFn = fn.length ? wrapAfterFnWithCallback(fn) : wrapAfterFnWithoutArgs(fn as DirectHookImplementation);\n Object.defineProperty(wrappedFn, \"name\", { value: fn.name });\n return wrappedFn;\n }\n return fn;\n};\n\nconst wrapAfterFnWithCallback = (fn: Mocha.Func): Mocha.Func => {\n return function (this: Mocha.Context, done: Mocha.Done) {\n const wrappedDone = (hookError?: Error) => {\n if (hookError) {\n if (!completeSpecOnAfterHookFailure(this, hookError)?.then(() => done(hookError))) {\n done(hookError);\n }\n return;\n }\n\n try {\n if (completeSpecIfNoAfterHookLeft(this)?.then(() => done())) {\n return;\n }\n } catch (allureError) {\n done(allureError);\n return;\n }\n\n done();\n };\n return fn.bind(this)(wrappedDone);\n };\n};\n\nconst wrapAfterFnWithoutArgs = (fn: DirectHookImplementation) => {\n return function (this: Mocha.Context) {\n let result;\n let syncError: any;\n\n try {\n result = fn.bind(this)();\n } catch (e) {\n syncError = e;\n }\n\n if (syncError) {\n throwAfterSpecCompletion(this, syncError);\n } else if (isPromise(result)) {\n return result.then(\n () => completeSpecIfNoAfterHookLeft(this),\n (asyncError) => throwAfterSpecCompletion(this, asyncError),\n );\n } else {\n completeSpecIfNoAfterHookLeft(this);\n return result;\n }\n };\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,uBAAuB;AAGjD,SACEC,6BAA6B,EAC7BC,8BAA8B,EAC9BC,wBAAwB,QACnB,gBAAgB;AAQvB;AACA;AACA;AACA;AACA,OAAO,IAAMC,kCAAkC,GAAGA,CAAA,KAAM;EACtD,IAAMC,iBAAiB,GAAGC,4BAA4B,CAAC,CAAC;EACxDC,aAAa,CAACF,iBAAiB,CAAC;EAChCG,UAAU,CAACH,iBAAiB,CAAC;AAC/B,CAAC;AAED,IAAMC,4BAA4B,GAAGA,CAAA,KAAyB;EAC5D,IAAIG,UAAU,GAAG,CAAC;EAClB,OAAO;IACLC,aAAa,EAAEA,CAAA,KAAMD,UAAU;IAC/BE,mBAAmB,EAAEA,CAAA,KAAM;MACzBF,UAAU,EAAE;IACd,CAAC;IACDG,mBAAmB,EAAEA,CAAA,KAAM;MACzBH,UAAU,EAAE;IACd;EACF,CAAC;AACH,CAAC;AAED,IAAMF,aAAa,GAAGM,IAAA,IAAqE;EAAA,IAApE;IAAEF,mBAAmB;IAAEC;EAAuC,CAAC,GAAAC,IAAA;EACpF,IAAMC,eAAe,GAClBC,MAA4B,IAC7B,CAACC,KAAK,EAAEC,UAAU,EAAEC,EAAE,KAAK;IACzBP,mBAAmB,CAAC,CAAC;IACrB,IAAI;MACF,O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,qBAAA,CAAqCD,IAAI,CAAC,MAAMJ,IAAI,CAAC,CAAC,CAAC,EAAE;UAC3D;QACF;MACF,CAAC,CAAC,OAAOM,WAAW,EAAE;QACpBN,IAAI,CAACM,WAAW,CAAC;QACjB;MACF;MAEAN,IAAI,CAAC,CAAC;IACR,CAAC;IACD,OAAO3B,EAAE,CAACkC,IAAI,CAAC,IAAI,CAAC,CAACN,WAAW,CAAC;EACnC,CAAC;AACH,CAAC;AAED,IAAMN,sBAAsB,GAAItB,EAA4B,IAAK;EAC/D,OAAO,YAA+B;IACpC,IAAImC,MAAM;IACV,IAAIC,SAAc;IAElB,IAAI;MACFD,MAAM,GAAGnC,EAAE,CAACkC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC,OAAOG,CAAC,EAAE;MACVD,SAAS,GAAGC,CAAC;IACf;IAEA,IAAID,SAAS,EAAE;MACbnD,wBAAwB,CAAC,IAAI,EAAEmD,SAAS,CAAC;IAC3C,CAAC,MAAM,IAAItD,SAAS,CAACqD,MAAM,CAAC,EAAE;MAC5B,OAAOA,MAAM,CAACJ,IAAI,CAChB,MAAMhD,6BAA6B,CAAC,IAAI,CAAC,EACxCuD,UAAU,IAAKrD,wBAAwB,CAAC,IAAI,EAAEqD,UAAU,CAC3D,CAAC;IACH,CAAC,MAAM;MACLvD,6BAA6B,CAAC,IAAI,CAAC;MACnC,OAAOoD,MAAM;IACf;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"patching.js","names":["isPromise","completeSpecIfNoAfterHookLeft","completeSpecOnAfterHookFailure","throwAfterSpecCompletion","enableScopeLevelAfterHookReporting","suiteDepthCounter","createSuiteDepthCounterState","patchDescribe","patchAfter","suiteDepth","getSuiteDepth","incrementSuiteDepth","decrementSuiteDepth","_ref","patchDescribeFn","target","title","configOrFn","fn","forwardDescribeCall","originalDescribeFn","globalThis","describe","patchedDescribe","only","skip","_ref2","originalAfter","after","patchedAfter","nameOrFn","wrapRootAfterFn","_len","arguments","length","args","Array","_key","wrappedFn","wrapAfterFnWithCallback","wrapAfterFnWithoutArgs","Object","defineProperty","value","name","done","wrappedDone","hookError","_completeSpecOnAfterH","then","_completeSpecIfNoAfte","allureError","bind","result","syncError","e","outcome","ok","error","cy","settled"],"sources":["../../../src/browser/patching.ts"],"sourcesContent":["import { isPromise } from \"allure-js-commons/sdk\";\n\nimport type { CypressSuiteFunction, DirectHookImplementation, HookImplementation } from \"../types.js\";\nimport {\n completeSpecIfNoAfterHookLeft,\n completeSpecOnAfterHookFailure,\n throwAfterSpecCompletion,\n} from \"./lifecycle.js\";\n\ntype SuiteDepthCounter = {\n getSuiteDepth: () => number;\n incrementSuiteDepth: () => void;\n decrementSuiteDepth: () => void;\n};\n\n/**\n * Patches the `after` function, to inject reporting of spec-level\n * `after` hooks defined by the user.\n */\nexport const enableScopeLevelAfterHookReporting = () => {\n const suiteDepthCounter = createSuiteDepthCounterState();\n patchDescribe(suiteDepthCounter);\n patchAfter(suiteDepthCounter);\n};\n\nconst createSuiteDepthCounterState = (): SuiteDepthCounter => {\n let suiteDepth = 0;\n return {\n getSuiteDepth: () => suiteDepth,\n incrementSuiteDepth: () => {\n suiteDepth++;\n },\n decrementSuiteDepth: () => {\n suiteDepth--;\n },\n };\n};\n\nconst patchDescribe = ({ incrementSuiteDepth, decrementSuiteDepth }: SuiteDepthCounter) => {\n const patchDescribeFn =\n (target: CypressSuiteFunction): CypressSuiteFunction =>\n (title, configOrFn, fn) => {\n incrementSuiteDepth();\n try {\n return forwardDescribeCall(target, title, configOrFn, fn);\n } finally {\n decrementSuiteDepth();\n }\n };\n const originalDescribeFn: Mocha.SuiteFunction = globalThis.describe;\n const patchedDescribe = patchDescribeFn(originalDescribeFn) as Mocha.SuiteFunction;\n patchedDescribe.only = patchDescribeFn(\n originalDescribeFn.only as CypressSuiteFunction,\n ) as Mocha.ExclusiveSuiteFunction;\n patchedDescribe.skip = patchDescribeFn(originalDescribeFn.skip as CypressSuiteFunction) as Mocha.PendingSuiteFunction;\n globalThis.describe = patchedDescribe;\n};\n\nconst patchAfter = ({ getSuiteDepth }: SuiteDepthCounter) => {\n const originalAfter = globalThis.after;\n const patchedAfter = (nameOrFn: string | HookImplementation, fn?: HookImplementation): void => {\n return typeof nameOrFn === \"string\"\n ? originalAfter(nameOrFn, wrapRootAfterFn(getSuiteDepth, fn))\n : originalAfter(wrapRootAfterFn(getSuiteDepth, nameOrFn)!);\n };\n globalThis.after = patchedAfter;\n};\n\nconst forwardDescribeCall = (target: CypressSuiteFunction, ...args: Parameters<CypressSuiteFunction>) => {\n const [title, configOrFn, fn] = args;\n if (typeof fn === \"undefined\" && typeof configOrFn === \"undefined\") {\n return target(title);\n } else if (typeof configOrFn === \"function\") {\n return target(title, configOrFn);\n } else {\n return target(title, configOrFn, fn);\n }\n};\n\nconst wrapRootAfterFn = (getSuiteDepth: () => number, fn?: HookImplementation): HookImplementation | undefined => {\n if (getSuiteDepth() === 0 && fn) {\n const wrappedFn = fn.length ? wrapAfterFnWithCallback(fn) : wrapAfterFnWithoutArgs(fn as DirectHookImplementation);\n Object.defineProperty(wrappedFn, \"name\", { value: fn.name });\n return wrappedFn;\n }\n return fn;\n};\n\nconst wrapAfterFnWithCallback = (fn: Mocha.Func): Mocha.Func => {\n return function (this: Mocha.Context, done: Mocha.Done) {\n const wrappedDone = (hookError?: Error) => {\n if (hookError) {\n if (!completeSpecOnAfterHookFailure(this, hookError)?.then(() => done(hookError))) {\n done(hookError);\n }\n return;\n }\n\n try {\n if (completeSpecIfNoAfterHookLeft(this)?.then(() => done())) {\n return;\n }\n } catch (allureError) {\n done(allureError);\n return;\n }\n\n done();\n };\n return fn.bind(this)(wrappedDone);\n };\n};\n\nconst wrapAfterFnWithoutArgs = (fn: DirectHookImplementation) => {\n return function (this: Mocha.Context) {\n let result;\n let syncError: any;\n\n try {\n result = fn.bind(this)();\n } catch (e) {\n syncError = e;\n }\n\n if (syncError) {\n throwAfterSpecCompletion(this, syncError);\n } else if (isPromise(result)) {\n // Await the hook without queuing Cypress commands inside its promise callbacks.\n const outcome = result.then(\n () => ({ ok: true as const }),\n (error: unknown) => ({ ok: false as const, error }),\n );\n return cy\n .then(() => outcome)\n .then((settled) => {\n return settled.ok ? completeSpecIfNoAfterHookLeft(this) : throwAfterSpecCompletion(this, settled.error);\n });\n } else {\n completeSpecIfNoAfterHookLeft(this);\n return result;\n }\n };\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,uBAAuB;AAGjD,SACEC,6BAA6B,EAC7BC,8BAA8B,EAC9BC,wBAAwB,QACnB,gBAAgB;AAQvB;AACA;AACA;AACA;AACA,OAAO,IAAMC,kCAAkC,GAAGA,CAAA,KAAM;EACtD,IAAMC,iBAAiB,GAAGC,4BAA4B,CAAC,CAAC;EACxDC,aAAa,CAACF,iBAAiB,CAAC;EAChCG,UAAU,CAACH,iBAAiB,CAAC;AAC/B,CAAC;AAED,IAAMC,4BAA4B,GAAGA,CAAA,KAAyB;EAC5D,IAAIG,UAAU,GAAG,CAAC;EAClB,OAAO;IACLC,aAAa,EAAEA,CAAA,KAAMD,UAAU;IAC/BE,mBAAmB,EAAEA,CAAA,KAAM;MACzBF,UAAU,EAAE;IACd,CAAC;IACDG,mBAAmB,EAAEA,CAAA,KAAM;MACzBH,UAAU,EAAE;IACd;EACF,CAAC;AACH,CAAC;AAED,IAAMF,aAAa,GAAGM,IAAA,IAAqE;EAAA,IAAlEF,mBAAmB,GAAAE,IAAA,CAAnBF,mBAAmB;IAAEC,mBAAmB,GAAAC,IAAA,CAAnBD,mBAAmB;EAC/D,IAAME,eAAe,GAClBC,MAA4B,IAC7B,CAACC,KAAK,EAAEC,UAAU,EAAEC,EAAE,KAAK;IACzBP,mBAAmB,CAAC,CAAC;IACrB,IAAI;MACF,OAAOQ,mBAAmB,CAACJ,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAEC,EAAE,CAAC;IAC3D,CAAC,SAAS;MACRN,mBAAmB,CAAC,CAAC;IAC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AOM,WAAW,EAAE;QACpBN,IAAI,CAACM,WAAW,CAAC;QACjB;MACF;MAEAN,IAAI,CAAC,CAAC;IACR,CAAC;IACD,OAAO3B,EAAE,CAACkC,IAAI,CAAC,IAAI,CAAC,CAACN,WAAW,CAAC;EACnC,CAAC;AACH,CAAC;AAED,IAAMN,sBAAsB,GAAItB,EAA4B,IAAK;EAC/D,OAAO,YAA+B;IACpC,IAAImC,MAAM;IACV,IAAIC,SAAc;IAElB,IAAI;MACFD,MAAM,GAAGnC,EAAE,CAACkC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC,OAAOG,CAAC,EAAE;MACVD,SAAS,GAAGC,CAAC;IACf;IAEA,IAAID,SAAS,EAAE;MACbnD,wBAAwB,CAAC,IAAI,EAAEmD,SAAS,CAAC;IAC3C,CAAC,MAAM,IAAItD,SAAS,CAACqD,MAAM,CAAC,EAAE;MAC5B;MACA,IAAMG,OAAO,GAAGH,MAAM,CAACJ,IAAI,CACzB,OAAO;QAAEQ,EAAE,EAAE;MAAc,CAAC,CAAC,EAC5BC,KAAc,KAAM;QAAED,EAAE,EAAE,KAAc;QAAEC;MAAM,CAAC,CACpD,CAAC;MACD,OAAOC,EAAE,CACNV,IAAI,CAAC,MAAMO,OAAO,CAAC,CACnBP,IAAI,CAAEW,OAAO,IAAK;QACjB,OAAOA,OAAO,CAACH,EAAE,GAAGxD,6BAA6B,CAAC,IAAI,CAAC,GAAGE,wBAAwB,CAAC,IAAI,EAAEyD,OAAO,CAACF,KAAK,CAAC;MACzG,CAAC,CAAC;IACN,CAAC,MAAM;MACLzD,6BAA6B,CAAC,IAAI,CAAC;MACnC,OAAOoD,MAAM;IACf;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,3 +1,9 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
1
7
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
9
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -131,7 +137,10 @@ class AllureCypressTestRuntime {
131
137
  });
132
138
  }
133
139
  attachment(name, content, options) {
134
- var [attachmentContent, actualEncoding] = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content);
140
+ var _assertClassBrand$cal = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content),
141
+ _assertClassBrand$cal2 = _slicedToArray(_assertClassBrand$cal, 2),
142
+ attachmentContent = _assertClassBrand$cal2[0],
143
+ actualEncoding = _assertClassBrand$cal2[1];
135
144
  return _assertClassBrand(_AllureCypressTestRuntime_brand, this, _enqueueMessageAsync).call(this, {
136
145
  type: "attachment_content",
137
146
  data: {
@@ -155,7 +164,10 @@ class AllureCypressTestRuntime {
155
164
  });
156
165
  }
157
166
  globalAttachment(name, content, options) {
158
- var [attachmentContent, actualEncoding] = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content);
167
+ var _assertClassBrand$cal3 = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content),
168
+ _assertClassBrand$cal4 = _slicedToArray(_assertClassBrand$cal3, 2),
169
+ attachmentContent = _assertClassBrand$cal4[0],
170
+ actualEncoding = _assertClassBrand$cal4[1];
159
171
  return _assertClassBrand(_AllureCypressTestRuntime_brand, this, _enqueueMessageAsync).call(this, {
160
172
  type: "global_attachment_content",
161
173
  data: {
@@ -420,7 +432,10 @@ function _createSyncRuntime() {
420
432
  }
421
433
  }),
422
434
  attachment: (name, content, options) => {
423
- var [attachmentContent, actualEncoding] = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content);
435
+ var _assertClassBrand$cal5 = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content),
436
+ _assertClassBrand$cal6 = _slicedToArray(_assertClassBrand$cal5, 2),
437
+ attachmentContent = _assertClassBrand$cal6[0],
438
+ actualEncoding = _assertClassBrand$cal6[1];
424
439
  enqueueRuntimeMessage({
425
440
  type: "attachment_content",
426
441
  data: {
@@ -442,7 +457,10 @@ function _createSyncRuntime() {
442
457
  }
443
458
  }),
444
459
  globalAttachment: (name, content, options) => {
445
- var [attachmentContent, actualEncoding] = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content);
460
+ var _assertClassBrand$cal7 = _assertClassBrand(_AllureCypressTestRuntime_brand, this, _buildAttachmentContent).call(this, content),
461
+ _assertClassBrand$cal8 = _slicedToArray(_assertClassBrand$cal7, 2),
462
+ attachmentContent = _assertClassBrand$cal8[0],
463
+ actualEncoding = _assertClassBrand$cal8[1];
446
464
  enqueueRuntimeMessage({
447
465
  type: "global_attachment_content",
448
466
  data: {