allure-cypress 3.6.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,6 +16,12 @@
16
16
 
17
17
  The docs for Allure Cypress are available at [https://allurereport.org/docs/cypress/](https://allurereport.org/docs/cypress/).
18
18
 
19
+ ## Features
20
+
21
+ - writes Allure results from Cypress runs
22
+ - supports steps, attachments, labels, links, parameters, and metadata through `allure-js-commons`
23
+ - works with Allure Report 2 and Allure Report 3
24
+
19
25
  ## Installation
20
26
 
21
27
  Install `allure-cypress` using a package manager of your choice. For example:
@@ -24,6 +30,17 @@ Install `allure-cypress` using a package manager of your choice. For example:
24
30
  npm install -D allure-cypress
25
31
  ```
26
32
 
33
+ Install Allure Report separately when you want to render the generated `allure-results`:
34
+
35
+ - follow the [Allure Report 2 installation guide](https://allurereport.org/docs/install/) to use the `allure` CLI
36
+ - or install Allure Report 3 with `npm install -D allure` to use `npx allure`
37
+
38
+ ## Supported versions and platforms
39
+
40
+ - `cypress >= 12.17.4`
41
+ - Linux, macOS, and Windows wherever Cypress supports Node.js
42
+ - this repository is validated in CI on Node.js 20 and 22
43
+
27
44
  ## Usage
28
45
 
29
46
  Call `allureCypress` to initialize the plugin from the `setupNodeEvents` function in `cypress.config.js`:
@@ -56,18 +73,18 @@ You may select another location, or further customize the plugin's behavior with
56
73
 
57
74
  ### View the report
58
75
 
59
- > You need Allure Report to be installed on your machine to generate and open the report from the result files. See the [installation instructions](https://allurereport.org/docs/install/) on how to get it.
60
-
61
- Generate Allure Report:
76
+ Use Allure Report 2:
62
77
 
63
78
  ```bash
64
79
  allure generate ./allure-results -o ./allure-report
80
+ allure open ./allure-report
65
81
  ```
66
82
 
67
- Open Allure Report:
83
+ Or use Allure Report 3:
68
84
 
69
85
  ```bash
70
- allure open ./allure-report
86
+ npx allure generate ./allure-results
87
+ npx allure open ./allure-report
71
88
  ```
72
89
 
73
90
  ## Allure API
@@ -88,33 +105,34 @@ describe("signing in with a password", () => {
88
105
  allure.owner("eroshenkoam");
89
106
  allure.parameter("browser", Cypress.browser.family);
90
107
 
91
- allure.step("Prepare the user", () => {
92
- return createAnActiveUserInDb();
93
- }).then((user) => {
94
- allure.step("Make a sign-in attempt", () => {
95
- allure.step("Navigate to the sign-in page", () => {
96
- // ...
97
- });
108
+ allure
109
+ .step("Prepare the user", () => {
110
+ return createAnActiveUserInDb();
111
+ })
112
+ .then((user) => {
113
+ allure.step("Make a sign-in attempt", () => {
114
+ allure.step("Navigate to the sign-in page", () => {
115
+ // ...
116
+ });
98
117
 
99
- allure.step("Fill the sign-in form", (stepContext) => {
100
- stepContext.parameter("login", user.login);
101
- stepContext.parameter("password", user.password, "masked");
118
+ allure.step("Fill the sign-in form", (stepContext) => {
119
+ stepContext.parameter("login", user.login);
120
+ stepContext.parameter("password", user.password, "masked");
102
121
 
103
- // ...
104
- });
122
+ // ...
123
+ });
105
124
 
106
- allure.step("Submit the form", () => {
107
- // ...
125
+ allure.step("Submit the form", () => {
126
+ // ...
108
127
 
109
- allure.attachment("cookies", JSON.stringify(cy.getCookies()), { contentType: "application/json" });
128
+ allure.attachment("cookies", JSON.stringify(cy.getCookies()), { contentType: "application/json" });
129
+ });
110
130
  });
111
- });
112
-
113
131
 
114
- allure.step("Assert the signed-in state", () => {
115
- // ...
132
+ allure.step("Assert the signed-in state", () => {
133
+ // ...
134
+ });
116
135
  });
117
- });
118
136
  });
119
137
  });
120
138
  ```
@@ -195,8 +213,8 @@ Cypress can't compose multiple Node events, which are set in `setupNodeEvents`.
195
213
 
196
214
  Allure Cypress requires access to the following events:
197
215
 
198
- - `after:spec`
199
- - `after:run`
216
+ - `after:spec`
217
+ - `after:run`
200
218
 
201
219
  Otherwise, it may not work as expected.
202
220
 
@@ -1 +1 @@
1
- {"version":3,"file":"commandLog.js","names":["_utils","require","_lifecycle","_serialize","_interopRequireDefault","_state","_steps","_utils2","e","__esModule","default","shouldCreateStepFromCommandLogEntry","entry","event","instrument","attributes","isApiStepErrorLogEntry","exports","setupScreenshotAttachmentStep","originalName","name","step","getCurrentStep","isLogStep","commandName","props","nameFromProps","resolveConsoleProps","log","attachmentName","startCommandLogStep","currentLogEntry","getCurrentLogEntry","shouldStopCurrentLogStep","stopCommandLogStep","id","pushLogEntry","reportStepStart","getCommandLogStepName","scheduleCommandLogStepStop","entryId","findAndStopStepWithSubsteps","_ref","stepDescriptor","type","pushStep","setupStepFinalization","data","parameters","getCommandLogStepParameters","groupStart","end","originalEndGroup","endGroup","call","originalEnd","Object","is","ALLURE_STEP_CMD_SUBJECT","_ref2","_ref3","_maybeGetAssertionLog","message","displayName","resolvedName","trim","resolvedMessage","maybeGetAssertionLogMessage","maybeGetCucumberLogMessage","resolveRenderProps","stepName","filter","Boolean","join","getLogProps","map","_ref4","k","v","toString","value","serializePropValue","getPropValueSetFilter","WELL_KNOWN_CUCUMBER_LOG_NAMES","includes","startsWith","endsWith","substring","length","isAssertionWithMessage","entries","_ref5","isDefined","isAssertLog","Message","_ref6","getStepStack","findLast","newLogEntry","currentEntryIsGroup","currentEntryType","newEntryType","_ref7"],"sources":["../../../src/browser/commandLog.ts"],"sourcesContent":["import type { Parameter } from \"allure-js-commons\";\nimport type { CypressLogEntry, LogStepDescriptor } from \"../types.js\";\nimport { isDefined } from \"../utils.js\";\nimport { reportStepStart } from \"./lifecycle.js\";\nimport serializePropValue from \"./serialize.js\";\nimport { 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 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":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,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,CAACnF,UAAU;EAErD,OAAO,CAACoF,mBAAmB,KAAKC,gBAAgB,KAAK,OAAO,IAAIC,YAAY,KAAK,OAAO,CAAC;AAC3F,CAAC;AAED,IAAMnB,qBAAqB,GAAItE,KAAsB,IACnDA,KAAK,CAACG,UAAU,CAACK,IAAI,KAAK,MAAM,GAAG,MAAM,IAAI,GAAGkF,KAAA;EAAA,IAAC;IAAElF,IAAI;IAAE4D;EAAiB,CAAC,GAAAsB,KAAA;EAAA,OAAKlF,IAAI,KAAK,SAAS,IAAI4D,KAAK,KAAK,IAAI;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"commandLog.js","names":["_utils","require","_lifecycle","_serialize","_interopRequireDefault","_state","_steps","_utils2","e","__esModule","default","shouldCreateStepFromCommandLogEntry","entry","event","instrument","attributes","isApiStepErrorLogEntry","exports","setupScreenshotAttachmentStep","originalName","name","step","getCurrentStep","isLogStep","commandName","props","nameFromProps","resolveConsoleProps","log","attachmentName","startCommandLogStep","currentLogEntry","getCurrentLogEntry","shouldStopCurrentLogStep","stopCommandLogStep","id","pushLogEntry","reportStepStart","getCommandLogStepName","scheduleCommandLogStepStop","entryId","findAndStopStepWithSubsteps","_ref","stepDescriptor","type","pushStep","setupStepFinalization","data","parameters","getCommandLogStepParameters","groupStart","end","originalEndGroup","endGroup","call","originalEnd","Object","is","ALLURE_STEP_CMD_SUBJECT","_ref2","_ref3","_maybeGetAssertionLog","message","displayName","resolvedName","trim","resolvedMessage","maybeGetAssertionLogMessage","maybeGetCucumberLogMessage","resolveRenderProps","stepName","filter","Boolean","join","getLogProps","map","_ref4","k","v","toString","value","serializePropValue","getPropValueSetFilter","WELL_KNOWN_CUCUMBER_LOG_NAMES","includes","startsWith","endsWith","substring","length","isAssertionWithMessage","entries","_ref5","isDefined","isAssertLog","Message","_ref6","getStepStack","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 { 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 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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAAqE,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9D,IAAMG,mCAAmC,GAAIC,KAAsB,IAAK;EAC7E,IAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,KAAK,CAACG,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,CAACJ,KAAK,CAAC,EAAE;IACjC;IACA;IACA;IACA;IACA,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJAK,OAAA,CAAAN,mCAAA,GAAAA,mCAAA;AAKO,IAAMO,6BAA6B,GAAGA,CAACC,YAAgC,EAAEC,IAAY,KAAK;EAC/F,IAAMC,IAAI,GAAG,IAAAC,qBAAc,EAAC,CAAC;EAC7B,IAAID,IAAI,IAAI,IAAAE,gBAAS,EAACF,IAAI,CAAC,EAAE;IAC3B,IAA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AAED,IAAM+B,WAAW,GAAGE,KAAA;EAAA,IAAC;IAAEhF,UAAU,EAAE;MAAEK;IAAK;EAAmB,CAAC,GAAA2E,KAAA;EAAA,OAAK3E,IAAI,KAAK,QAAQ;AAAA;AAEpF,IAAMY,kBAAkB,GAAGA,CAAA,KAAM,IAAAgE,mBAAY,EAAC,CAAC,CAACC,QAAQ,CAAC1E,gBAAS,CAAC;AAEnE,IAAMU,wBAAwB,GAAGA,CAACF,eAAgC,EAAEmE,WAA4B,KAAK;EACnG,IAAM;IAAEhD,UAAU,EAAEiD,mBAAmB;IAAEvD,IAAI,EAAEwD;EAAiB,CAAC,GAAGrE,eAAe,CAAChB,UAAU;EAC9F,IAAM;IAAE6B,IAAI,EAAEyD;EAAa,CAAC,GAAGH,WAAW,CAACnF,UAAU;EAErD,OAAO,CAACoF,mBAAmB,KAAKC,gBAAgB,KAAK,OAAO,IAAIC,YAAY,KAAK,OAAO,CAAC;AAC3F,CAAC;AAED,IAAMnB,qBAAqB,GAAItE,KAAsB,IACnDA,KAAK,CAACG,UAAU,CAACK,IAAI,KAAK,MAAM,GAAG,MAAM,IAAI,GAAGkF,KAAA;EAAA,IAAC;IAAElF,IAAI;IAAE4D;EAAiB,CAAC,GAAAsB,KAAA;EAAA,OAAKlF,IAAI,KAAK,SAAS,IAAI4D,KAAK,KAAK,IAAI;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.js","names":["_allureJsCommons","require","_sdk","_runtime","_state","_steps","_utils","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","reportRunStart","enqueueRuntimeMessage","type","data","exports","reportSuiteStart","suite","id","name","title","root","start","Date","now","reportSuiteEnd","stop","reportHookStart","hook","scopeType","hookName","includes","position","reportHookEnd","_hook$duration","finalizeSteps","duration","reportTestStart","test","setCurrentTest","getTestStartData","markTestAsReported","reportStepStart","reportStepStop","step","status","statusDetails","getStepStopData","reportTestPass","reportTestOrHookFail","err","getStatusFromError","getMessageAndTraceFromError","stopAllSteps","completeHookErrorReporting","isEachHook","parent","testFailData","getStatusDataOfTestSkippedByHookError","reportCurrentTestIfAny","reportRemainingTests","reportTestSkip","isTestReported","Status","SKIPPED","message","getTestSkipData","reportTestEnd","_test$duration","_retries","retries","dropCurrentTest","reportScreenshot","path","contentType","ContentType","PNG","completeSpecIfNoAfterHookLeft","context","isLastRootAfterHook","isAllureHook","completeSpecAsync","completeSpecOnAfterHookFailure","hookError","allureError","logAllureRootAfterError","throwAfterSpecCompletion","_completeSpecOnAfterH","chain","then","flushRuntimeMessages","getTestRuntime","flushAllureMessagesToTask","flushAllureMessagesToTaskAsync","currentTest","getCurrentTest","iterateTests","reportTestsSkippedByHookError","pending","getTestStopData","suites","getSuitePath","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\";\nimport type { CypressFailMessage, CypressHook, CypressSuite, CypressTest, StepDescriptor } from \"../types.js\";\nimport { getTestRuntime } from \"./runtime.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);\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 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,IAAAA,gBAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAYoB,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,C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EAE/C,CAAC,CAAC;EACF,IAAAuB,yBAAkB,EAACH,IAAI,CAAC;AAC1B,CAAC;AAED,IAAM+C,uBAAuB,GAAGA,CAACP,OAAsB,EAAE5B,GAAY,KAAK;EACxE;EACA,IAAI;IAAA,IAAAsD,mBAAA,EAAAC,aAAA;IACF;IACAC,OAAO,CAACC,KAAK,mDAAAC,MAAA,EAAAJ,mBAAA,IAAAC,aAAA,GAAmD3B,OAAO,CAACxC,IAAI,cAAAmE,aAAA,uBAAZA,aAAA,CAAcrF,KAAK,cAAAoF,mBAAA,cAAAA,mBAAA,GAAI,aAAa,CAAE,CAAC;IACvG;IACAE,OAAO,CAACC,KAAK,CAACzD,GAAG,CAAC;EACpB,CAAC,CAAC,OAAA2D,OAAA,EAAM,CAAC;AACX,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"lifecycle.js","names":["_allureJsCommons","require","_sdk","_runtime","_state","_steps","_utils","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","reportRunStart","enqueueRuntimeMessage","type","data","exports","reportSuiteStart","suite","id","name","title","root","start","Date","now","reportSuiteEnd","stop","reportHookStart","hook","scopeType","hookName","includes","position","reportHookEnd","_hook$duration","finalizeSteps","duration","reportTestStart","test","setCurrentTest","getTestStartData","markTestAsReported","reportStepStart","reportStepStop","step","status","statusDetails","getStepStopData","reportTestPass","reportTestOrHookFail","err","getStatusFromError","getMessageAndTraceFromError","stopAllSteps","completeHookErrorReporting","isEachHook","parent","testFailData","getStatusDataOfTestSkippedByHookError","reportCurrentTestIfAny","reportRemainingTests","reportTestSkip","isTestReported","Status","SKIPPED","message","getTestSkipData","reportTestEnd","_test$duration","_retries","retries","dropCurrentTest","reportScreenshot","path","contentType","ContentType","PNG","completeSpecIfNoAfterHookLeft","context","isLastRootAfterHook","isAllureHook","completeSpecAsync","completeSpecOnAfterHookFailure","hookError","allureError","logAllureRootAfterError","throwAfterSpecCompletion","_completeSpecOnAfterH","chain","then","flushRuntimeMessages","getTestRuntime","flushAllureMessagesToTask","flushAllureMessagesToTaskAsync","currentTest","getCurrentTest","iterateTests","reportTestsSkippedByHookError","pending","getTestStopData","suites","getSuitePath","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 { 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);\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 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,IAAAA,gBAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAGA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAYoB,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAA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AAI,aAAa,CAAE,CAAC;IACvG;IACAE,OAAO,CAACC,KAAK,CAACzD,GAAG,CAAC;EACpB,CAAC,CAAC,OAAA2D,OAAA,EAAM,CAAC;AACX,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"patching.js","names":["_sdk","require","_lifecycle","enableScopeLevelAfterHookReporting","suiteDepthCounter","createSuiteDepthCounterState","patchDescribe","patchAfter","exports","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","completeSpecOnAfterHookFailure","then","_completeSpecIfNoAfte","completeSpecIfNoAfterHookLeft","allureError","bind","result","syncError","e","throwAfterSpecCompletion","isPromise","asyncError"],"sources":["../../../src/browser/patching.ts"],"sourcesContent":["import { isPromise } from \"allure-js-commons/sdk\";\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,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAYA;AACA;AACA;AACA;AACO,IAAME,kCAAkC,GAAGA,CAAA,KAAM;EACtD,IAAMC,iBAAiB,GAAGC,4BAA4B,CAAC,CAAC;EACxDC,aAAa,CAACF,iBAAiB,CAAC;EAChCG,UAAU,CAACH,iBAAiB,CAAC;AAC/B,CAAC;AAACI,OAAA,CAAAL,kCAAA,GAAAA,kCAAA;AAEF,IAAME,4BAA4B,GAAGA,CAAA,KAAyB;EAC5D,IAAII,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,IAAMH,aAAa,GAAGO,IAAA,IAAqE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AML,IAAI,CAACE,SAAS,CAAC,CAAC,GAAE;UACjFF,IAAI,CAACE,SAAS,CAAC;QACjB;QACA;MACF;MAEA,IAAI;QAAA,IAAAI,qBAAA;QACF,KAAAA,qBAAA,GAAI,IAAAC,wCAA6B,EAAC,IAAI,CAAC,cAAAD,qBAAA,eAAnCA,qBAAA,CAAqCD,IAAI,CAAC,MAAML,IAAI,CAAC,CAAC,CAAC,EAAE;UAC3D;QACF;MACF,CAAC,CAAC,OAAOQ,WAAW,EAAE;QACpBR,IAAI,CAACQ,WAAW,CAAC;QACjB;MACF;MAEAR,IAAI,CAAC,CAAC;IACR,CAAC;IACD,OAAO3B,EAAE,CAACoC,IAAI,CAAC,IAAI,CAAC,CAACR,WAAW,CAAC;EACnC,CAAC;AACH,CAAC;AAED,IAAMN,sBAAsB,GAAItB,EAA4B,IAAK;EAC/D,OAAO,YAA+B;IACpC,IAAIqC,MAAM;IACV,IAAIC,SAAc;IAElB,IAAI;MACFD,MAAM,GAAGrC,EAAE,CAACoC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC,OAAOG,CAAC,EAAE;MACVD,SAAS,GAAGC,CAAC;IACf;IAEA,IAAID,SAAS,EAAE;MACb,IAAAE,mCAAwB,EAAC,IAAI,EAAEF,SAAS,CAAC;IAC3C,CAAC,MAAM,IAAI,IAAAG,cAAS,EAACJ,MAAM,CAAC,EAAE;MAC5B,OAAOA,MAAM,CAACL,IAAI,CAChB,MAAM,IAAAE,wCAA6B,EAAC,IAAI,CAAC,EACxCQ,UAAU,IAAK,IAAAF,mCAAwB,EAAC,IAAI,EAAEE,UAAU,CAC3D,CAAC;IACH,CAAC,MAAM;MACL,IAAAR,wCAA6B,EAAC,IAAI,CAAC;MACnC,OAAOG,MAAM;IACf;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"patching.js","names":["_sdk","require","_lifecycle","enableScopeLevelAfterHookReporting","suiteDepthCounter","createSuiteDepthCounterState","patchDescribe","patchAfter","exports","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","completeSpecOnAfterHookFailure","then","_completeSpecIfNoAfte","completeSpecIfNoAfterHookLeft","allureError","bind","result","syncError","e","throwAfterSpecCompletion","isPromise","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,IAAAA,IAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AAYA;AACA;AACA;AACA;AACO,IAAME,kCAAkC,GAAGA,CAAA,KAAM;EACtD,IAAMC,iBAAiB,GAAGC,4BAA4B,CAAC,CAAC;EACxDC,aAAa,CAACF,iBAAiB,CAAC;EAChCG,UAAU,CAACH,iBAAiB,CAAC;AAC/B,CAAC;AAACI,OAAA,CAAAL,kCAAA,GAAAA,kCAAA;AAEF,IAAME,4BAA4B,GAAGA,CAAA,KAAyB;EAC5D,IAAII,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,IAAMH,aAAa,GAAGO,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,OAAOQ,mBAAmB,CAACJ,MAAM,EAAEC,KAAK,EAAEC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AAC,CAAC,CAAC,EAAE;UAC3D;QACF;MACF,CAAC,CAAC,OAAOQ,WAAW,EAAE;QACpBR,IAAI,CAACQ,WAAW,CAAC;QACjB;MACF;MAEAR,IAAI,CAAC,CAAC;IACR,CAAC;IACD,OAAO3B,EAAE,CAACoC,IAAI,CAAC,IAAI,CAAC,CAACR,WAAW,CAAC;EACnC,CAAC;AACH,CAAC;AAED,IAAMN,sBAAsB,GAAItB,EAA4B,IAAK;EAC/D,OAAO,YAA+B;IACpC,IAAIqC,MAAM;IACV,IAAIC,SAAc;IAElB,IAAI;MACFD,MAAM,GAAGrC,EAAE,CAACoC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC,OAAOG,CAAC,EAAE;MACVD,SAAS,GAAGC,CAAC;IACf;IAEA,IAAID,SAAS,EAAE;MACb,IAAAE,mCAAwB,EAAC,IAAI,EAAEF,SAAS,CAAC;IAC3C,CAAC,MAAM,IAAI,IAAAG,cAAS,EAACJ,MAAM,CAAC,EAAE;MAC5B,OAAOA,MAAM,CAACL,IAAI,CAChB,MAAM,IAAAE,wCAA6B,EAAC,IAAI,CAAC,EACxCQ,UAAU,IAAK,IAAAF,mCAAwB,EAAC,IAAI,EAAEE,UAAU,CAC3D,CAAC;IACH,CAAC,MAAM;MACL,IAAAR,wCAA6B,EAAC,IAAI,CAAC;MACnC,OAAOG,MAAM;IACf;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","names":["_allureJsCommons","require","_sdk","_runtime","_state","_steps","_utils","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_classPrivateMethodInitSpec","a","_checkPrivateRedeclaration","add","has","_assertClassBrand","n","initTestRuntime","setGlobalTestRuntime","AllureCypressTestRuntime","exports","getTestRuntime","getGlobalTestRuntime","_AllureCypressTestRuntime_brand","WeakSet","constructor","_resetMessages","labels","_len","Array","_key","_enqueueMessageAsync","type","data","links","_len2","_key2","parameter","name","options","parameters","description","markdown","descriptionHtml","html","displayName","historyId","testCaseId","attachment","content","attachmentContent","actualEncoding","_buildAttachmentContent","encoding","contentType","fileExtension","attachmentFromPath","path","globalAttachment","globalAttachmentFromPath","globalError","details","logStep","status","undefined","Status","PASSED","error","_isInOriginContext","startAllureApiStep","stopCurrentAllureApiStep","getMessageAndTraceFromError","Cypress","Promise","resolve","cy","wrap","ALLURE_STEP_CMD_SUBJECT","log","then","step","body","result","stepDisplayName","stepParameter","mode","flushAllureMessagesToTask","taskName","messages","_dequeueAllMessages","task","absolutePath","spec","absolute","flushAllureMessagesToTaskAsync","args","isInteractive","config","setRuntimeMessages","message","enqueueRuntimeMessage","getRuntimeMessages","rawContent","_normalizeAttachmentContent","uint8ArrayToBase64","Uint8Array","_isSerializedBuffer","candidate","isArray","hasOriginContext","window","cypressOriginContext","hasOriginWindow","cypressOriginWindow","baseUrl","currentOrigin","location","origin","cypressInstance","state","cyExists","cyTaskExists"],"sources":["../../../src/browser/runtime.ts"],"sourcesContent":["import type { AttachmentOptions, Label, Link, ParameterMode, ParameterOptions, StatusDetails } from \"allure-js-commons\";\nimport { Status } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError } from \"allure-js-commons/sdk\";\nimport type { TestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport { getGlobalTestRuntime, setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport type { AllureCypressTaskArgs, CypressMessage } from \"../types.js\";\nimport { enqueueRuntimeMessage, getRuntimeMessages, setRuntimeMessages } from \"./state.js\";\nimport { ALLURE_STEP_CMD_SUBJECT, startAllureApiStep, stopCurrentAllureApiStep } from \"./steps.js\";\nimport { uint8ArrayToBase64 } from \"./utils.js\";\n\nexport const initTestRuntime = () => setGlobalTestRuntime(new AllureCypressTestRuntime() as TestRuntime);\n\nexport const getTestRuntime = () => getGlobalTestRuntime() as AllureCypressTestRuntime;\n\ntype SerializedBuffer = {\n type: \"Buffer\";\n data: number[];\n};\n\nclass AllureCypressTestRuntime implements TestRuntime {\n constructor() {\n this.#resetMessages();\n }\n\n labels(...labels: Label[]) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n labels,\n },\n });\n }\n\n links(...links: Link[]) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n links,\n },\n });\n }\n\n parameter(name: string, value: string, options?: ParameterOptions) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n parameters: [\n {\n name,\n value,\n ...options,\n },\n ],\n },\n });\n }\n\n description(markdown: string) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n description: markdown,\n },\n });\n }\n\n descriptionHtml(html: string) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n descriptionHtml: html,\n },\n });\n }\n\n displayName(name: string) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n displayName: name,\n },\n });\n }\n\n historyId(value: string) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n historyId: value,\n },\n });\n }\n\n testCaseId(value: string) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n testCaseId: value,\n },\n });\n }\n\n attachment(name: string, content: Uint8Array | Buffer | string, options: AttachmentOptions) {\n const [attachmentContent, actualEncoding] = this.#buildAttachmentContent(\n content as Buffer | string | SerializedBuffer,\n );\n\n return this.#enqueueMessageAsync({\n type: \"attachment_content\",\n data: {\n name,\n content: attachmentContent,\n encoding: actualEncoding,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n attachmentFromPath(name: string, path: string, options: Omit<AttachmentOptions, \"encoding\">) {\n return this.#enqueueMessageAsync({\n type: \"attachment_path\",\n data: {\n name,\n path,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n globalAttachment(name: string, content: Uint8Array | Buffer | string, options: AttachmentOptions) {\n const [attachmentContent, actualEncoding] = this.#buildAttachmentContent(\n content as Buffer | string | SerializedBuffer,\n );\n\n return this.#enqueueMessageAsync({\n type: \"global_attachment_content\",\n data: {\n name,\n content: attachmentContent,\n encoding: actualEncoding,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n globalAttachmentFromPath(name: string, path: string, options: Omit<AttachmentOptions, \"encoding\">) {\n return this.#enqueueMessageAsync({\n type: \"global_attachment_path\",\n data: {\n name,\n path,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n globalError(details: StatusDetails) {\n return this.#enqueueMessageAsync({\n type: \"global_error\",\n data: details,\n });\n }\n\n logStep(name: string, status: Status = Status.PASSED, error?: Error): PromiseLike<void> {\n if (this.#isInOriginContext()) {\n startAllureApiStep(name);\n stopCurrentAllureApiStep(status, error ? getMessageAndTraceFromError(error) : undefined);\n return Cypress.Promise.resolve();\n }\n\n return cy\n .wrap(ALLURE_STEP_CMD_SUBJECT, { log: false })\n .then(() => {\n startAllureApiStep(name);\n return Cypress.Promise.resolve();\n })\n .then(() => {\n stopCurrentAllureApiStep(status, error ? getMessageAndTraceFromError(error) : undefined);\n return Cypress.Promise.resolve();\n });\n }\n\n step<T = void>(name: string, body: () => T | PromiseLike<T>) {\n return cy\n .wrap(ALLURE_STEP_CMD_SUBJECT, { log: false })\n .then(() => {\n startAllureApiStep(name);\n return Cypress.Promise.resolve(body());\n })\n .then((result) => {\n stopCurrentAllureApiStep();\n return result;\n });\n }\n\n stepDisplayName(name: string) {\n return this.#enqueueMessageAsync({\n type: \"step_metadata\",\n data: {\n name,\n },\n });\n }\n\n stepParameter(name: string, value: string, mode?: ParameterMode) {\n return this.#enqueueMessageAsync({\n type: \"step_metadata\",\n data: {\n parameters: [{ name, value, mode }],\n },\n });\n }\n\n flushAllureMessagesToTask(taskName: string) {\n const messages = this.#dequeueAllMessages();\n if (messages.length) {\n cy.task(taskName, { absolutePath: Cypress.spec.absolute, messages }, { log: false });\n }\n }\n\n flushAllureMessagesToTaskAsync(taskName: string): Cypress.Chainable<unknown> | undefined {\n const messages = this.#dequeueAllMessages();\n if (messages.length) {\n const args: AllureCypressTaskArgs = {\n absolutePath: Cypress.spec.absolute,\n messages,\n isInteractive: Cypress.config(\"isInteractive\"),\n };\n return cy.task(taskName, args, { log: false });\n }\n }\n\n #resetMessages() {\n setRuntimeMessages([]);\n }\n\n #enqueueMessageAsync(message: CypressMessage): PromiseLike<void> {\n enqueueRuntimeMessage(message);\n return Cypress.Promise.resolve();\n }\n\n #dequeueAllMessages() {\n const messages = getRuntimeMessages();\n this.#resetMessages();\n return messages;\n }\n\n #buildAttachmentContent(content: Buffer | string | SerializedBuffer): [string, BufferEncoding] {\n const rawContent = this.#normalizeAttachmentContent(content);\n const encoding: BufferEncoding = typeof rawContent === \"string\" ? \"utf8\" : \"base64\";\n\n return [uint8ArrayToBase64(rawContent), encoding];\n }\n\n #normalizeAttachmentContent(content: Uint8Array | Buffer | string | SerializedBuffer): string | Uint8Array {\n if (content instanceof Uint8Array || typeof content === \"string\") {\n return content;\n }\n\n if (this.#isSerializedBuffer(content)) {\n return new Uint8Array(content.data);\n }\n\n return content;\n }\n\n #isSerializedBuffer(content: unknown): content is SerializedBuffer {\n if (!content || typeof content !== \"object\") {\n return false;\n }\n\n const candidate = content as Partial<SerializedBuffer>;\n return candidate.type === \"Buffer\" && Array.isArray(candidate.data);\n }\n\n #isInOriginContext(): boolean {\n try {\n const hasOriginContext = !!(window as any).cypressOriginContext;\n const hasOriginWindow = !!(window as any).cypressOriginWindow;\n\n if (hasOriginContext || hasOriginWindow) {\n return true;\n }\n\n const baseUrl = Cypress.config(\"baseUrl\");\n const currentOrigin = window.location.origin;\n\n if (baseUrl && currentOrigin !== baseUrl) {\n return true;\n }\n\n const cypressInstance = (window as any).Cypress;\n\n if (cypressInstance && cypressInstance.state && cypressInstance.state(\"origin\")) {\n return true;\n }\n\n try {\n const cyExists = typeof cy !== \"undefined\";\n const cyTaskExists = typeof cy.task !== \"undefined\";\n\n // In cy.origin context, cy.task may not be available or may throw\n if (!cyExists || !cyTaskExists) {\n return true;\n }\n } catch (error) {\n return true;\n }\n\n return false;\n } catch (error) {\n return true;\n }\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAgD,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAAA,CAAAc,yBAAA,CAAAf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eys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_classPrivateMethodInitSpec","a","_checkPrivateRedeclaration","add","has","_assertClassBrand","n","initTestRuntime","setGlobalTestRuntime","AllureCypressTestRuntime","exports","getTestRuntime","getGlobalTestRuntime","_AllureCypressTestRuntime_brand","WeakSet","constructor","_resetMessages","labels","_len","Array","_key","_enqueueMessageAsync","type","data","links","_len2","_key2","parameter","name","options","parameters","description","markdown","descriptionHtml","html","displayName","historyId","testCaseId","attachment","content","attachmentContent","actualEncoding","_buildAttachmentContent","encoding","contentType","fileExtension","attachmentFromPath","path","globalAttachment","globalAttachmentFromPath","globalError","details","logStep","status","undefined","Status","PASSED","error","_isInOriginContext","startAllureApiStep","stopCurrentAllureApiStep","getMessageAndTraceFromError","Cypress","Promise","resolve","cy","wrap","ALLURE_STEP_CMD_SUBJECT","log","then","step","body","result","stepDisplayName","stepParameter","mode","flushAllureMessagesToTask","taskName","messages","_dequeueAllMessages","task","absolutePath","spec","absolute","flushAllureMessagesToTaskAsync","args","isInteractive","config","setRuntimeMessages","message","enqueueRuntimeMessage","getRuntimeMessages","rawContent","_normalizeAttachmentContent","uint8ArrayToBase64","Uint8Array","_isSerializedBuffer","candidate","isArray","hasOriginContext","window","cypressOriginContext","hasOriginWindow","cypressOriginWindow","baseUrl","currentOrigin","location","origin","cypressInstance","state","cyExists","cyTaskExists"],"sources":["../../../src/browser/runtime.ts"],"sourcesContent":["import type { AttachmentOptions, Label, Link, ParameterMode, ParameterOptions, StatusDetails } from \"allure-js-commons\";\nimport { Status } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError } from \"allure-js-commons/sdk\";\nimport type { TestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport { getGlobalTestRuntime, setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\n\nimport type { AllureCypressTaskArgs, CypressMessage } from \"../types.js\";\nimport { enqueueRuntimeMessage, getRuntimeMessages, setRuntimeMessages } from \"./state.js\";\nimport { ALLURE_STEP_CMD_SUBJECT, startAllureApiStep, stopCurrentAllureApiStep } from \"./steps.js\";\nimport { uint8ArrayToBase64 } from \"./utils.js\";\n\nexport const initTestRuntime = () => setGlobalTestRuntime(new AllureCypressTestRuntime() as TestRuntime);\n\nexport const getTestRuntime = () => getGlobalTestRuntime() as AllureCypressTestRuntime;\n\ntype SerializedBuffer = {\n type: \"Buffer\";\n data: number[];\n};\n\nclass AllureCypressTestRuntime implements TestRuntime {\n constructor() {\n this.#resetMessages();\n }\n\n labels(...labels: Label[]) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n labels,\n },\n });\n }\n\n links(...links: Link[]) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n links,\n },\n });\n }\n\n parameter(name: string, value: string, options?: ParameterOptions) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n parameters: [\n {\n name,\n value,\n ...options,\n },\n ],\n },\n });\n }\n\n description(markdown: string) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n description: markdown,\n },\n });\n }\n\n descriptionHtml(html: string) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n descriptionHtml: html,\n },\n });\n }\n\n displayName(name: string) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n displayName: name,\n },\n });\n }\n\n historyId(value: string) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n historyId: value,\n },\n });\n }\n\n testCaseId(value: string) {\n return this.#enqueueMessageAsync({\n type: \"metadata\",\n data: {\n testCaseId: value,\n },\n });\n }\n\n attachment(name: string, content: Uint8Array | Buffer | string, options: AttachmentOptions) {\n const [attachmentContent, actualEncoding] = this.#buildAttachmentContent(\n content as Buffer | string | SerializedBuffer,\n );\n\n return this.#enqueueMessageAsync({\n type: \"attachment_content\",\n data: {\n name,\n content: attachmentContent,\n encoding: actualEncoding,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n attachmentFromPath(name: string, path: string, options: Omit<AttachmentOptions, \"encoding\">) {\n return this.#enqueueMessageAsync({\n type: \"attachment_path\",\n data: {\n name,\n path,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n globalAttachment(name: string, content: Uint8Array | Buffer | string, options: AttachmentOptions) {\n const [attachmentContent, actualEncoding] = this.#buildAttachmentContent(\n content as Buffer | string | SerializedBuffer,\n );\n\n return this.#enqueueMessageAsync({\n type: \"global_attachment_content\",\n data: {\n name,\n content: attachmentContent,\n encoding: actualEncoding,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n globalAttachmentFromPath(name: string, path: string, options: Omit<AttachmentOptions, \"encoding\">) {\n return this.#enqueueMessageAsync({\n type: \"global_attachment_path\",\n data: {\n name,\n path,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n globalError(details: StatusDetails) {\n return this.#enqueueMessageAsync({\n type: \"global_error\",\n data: details,\n });\n }\n\n logStep(name: string, status: Status = Status.PASSED, error?: Error): PromiseLike<void> {\n if (this.#isInOriginContext()) {\n startAllureApiStep(name);\n stopCurrentAllureApiStep(status, error ? getMessageAndTraceFromError(error) : undefined);\n return Cypress.Promise.resolve();\n }\n\n return cy\n .wrap(ALLURE_STEP_CMD_SUBJECT, { log: false })\n .then(() => {\n startAllureApiStep(name);\n return Cypress.Promise.resolve();\n })\n .then(() => {\n stopCurrentAllureApiStep(status, error ? getMessageAndTraceFromError(error) : undefined);\n return Cypress.Promise.resolve();\n });\n }\n\n step<T = void>(name: string, body: () => T | PromiseLike<T>) {\n return cy\n .wrap(ALLURE_STEP_CMD_SUBJECT, { log: false })\n .then(() => {\n startAllureApiStep(name);\n return Cypress.Promise.resolve(body());\n })\n .then((result) => {\n stopCurrentAllureApiStep();\n return result;\n });\n }\n\n stepDisplayName(name: string) {\n return this.#enqueueMessageAsync({\n type: \"step_metadata\",\n data: {\n name,\n },\n });\n }\n\n stepParameter(name: string, value: string, mode?: ParameterMode) {\n return this.#enqueueMessageAsync({\n type: \"step_metadata\",\n data: {\n parameters: [{ name, value, mode }],\n },\n });\n }\n\n flushAllureMessagesToTask(taskName: string) {\n const messages = this.#dequeueAllMessages();\n if (messages.length) {\n cy.task(taskName, { absolutePath: Cypress.spec.absolute, messages }, { log: false });\n }\n }\n\n flushAllureMessagesToTaskAsync(taskName: string): Cypress.Chainable<unknown> | undefined {\n const messages = this.#dequeueAllMessages();\n if (messages.length) {\n const args: AllureCypressTaskArgs = {\n absolutePath: Cypress.spec.absolute,\n messages,\n isInteractive: Cypress.config(\"isInteractive\"),\n };\n return cy.task(taskName, args, { log: false });\n }\n }\n\n #resetMessages() {\n setRuntimeMessages([]);\n }\n\n #enqueueMessageAsync(message: CypressMessage): PromiseLike<void> {\n enqueueRuntimeMessage(message);\n return Cypress.Promise.resolve();\n }\n\n #dequeueAllMessages() {\n const messages = getRuntimeMessages();\n this.#resetMessages();\n return messages;\n }\n\n #buildAttachmentContent(content: Buffer | string | SerializedBuffer): [string, BufferEncoding] {\n const rawContent = this.#normalizeAttachmentContent(content);\n const encoding: BufferEncoding = typeof rawContent === \"string\" ? \"utf8\" : \"base64\";\n\n return [uint8ArrayToBase64(rawContent), encoding];\n }\n\n #normalizeAttachmentContent(content: Uint8Array | Buffer | string | SerializedBuffer): string | Uint8Array {\n if (content instanceof Uint8Array || typeof content === \"string\") {\n return content;\n }\n\n if (this.#isSerializedBuffer(content)) {\n return new Uint8Array(content.data);\n }\n\n return content;\n }\n\n #isSerializedBuffer(content: unknown): content is SerializedBuffer {\n if (!content || typeof content !== \"object\") {\n return false;\n }\n\n const candidate = content as Partial<SerializedBuffer>;\n return candidate.type === \"Buffer\" && Array.isArray(candidate.data);\n }\n\n #isInOriginContext(): boolean {\n try {\n const hasOriginContext = !!(window as any).cypressOriginContext;\n const hasOriginWindow = !!(window as any).cypressOriginWindow;\n\n if (hasOriginContext || hasOriginWindow) {\n return true;\n }\n\n const baseUrl = Cypress.config(\"baseUrl\");\n const currentOrigin = window.location.origin;\n\n if (baseUrl && currentOrigin !== baseUrl) {\n return true;\n }\n\n const cypressInstance = (window as any).Cypress;\n\n if (cypressInstance && cypressInstance.state && cypressInstance.state(\"origin\")) {\n return true;\n }\n\n try {\n const cyExists = typeof cy !== \"undefined\";\n const cyTaskExists = typeof cy.task !== \"undefined\";\n\n // In cy.origin context, cy.task may not be available or may throw\n if (!cyExists || !cyTaskExists) {\n return true;\n }\n } catch (error) {\n return true;\n }\n\n return false;\n } catch (error) {\n return true;\n }\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAGA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAgD,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAA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,EAAE;QAC9B,OAAO,IAAI;MACb;IACF,CAAC,CAAC,OAAOtD,KAAK,EAAE;MACd,OAAO,IAAI;IACb;IAEA,OAAO,KAAK;EACd,CAAC,CAAC,OAAOA,KAAK,EAAE;IACd,OAAO,IAAI;EACb;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.js","names":["_sdk","require","_state","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_default","isDomObject","stringifyAsDom","serializeAsObject","exports","default","isPlainObject","Array","isArray","stripAncestorRefs","ancestors","undefined","result","key","prop","entries","includes","pop","cleaned","serialize","getSerializeOptions","stepsFromCommands","maxArgumentDepth","maxDepth","maxArgumentLength","maxLength","getConfig","nonNullReplacerWithDomSupport","Cypress","dom","isDom","stringify","_"],"sources":["../../../src/browser/serialize.ts"],"sourcesContent":["import { serialize } from \"allure-js-commons/sdk\";\nimport { getConfig } from \"./state.js\";\n\nexport default (value: unknown) => {\n return isDomObject(value) ? stringifyAsDom(value) : serializeAsObject(value);\n};\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst stripAncestorRefs = (value: unknown, ancestors: object[] = []): unknown => {\n if (!isPlainObject(value)) {\n return value;\n }\n\n const result: Record<string, unknown> = {};\n ancestors.push(value);\n\n for (const [key, prop] of Object.entries(value)) {\n if (typeof prop === \"object\" && prop !== null) {\n if (ancestors.includes(prop)) {\n continue;\n }\n result[key] = stripAncestorRefs(prop, ancestors);\n } else {\n result[key] = prop;\n }\n }\n\n ancestors.pop();\n return result;\n};\n\nexport const serializeAsObject = (value: unknown) => {\n if (isPlainObject(value)) {\n const cleaned = stripAncestorRefs(value);\n return serialize({ ...(cleaned as object) }, getSerializeOptions());\n }\n return serialize(value, getSerializeOptions());\n};\n\nconst getSerializeOptions = () => {\n const {\n stepsFromCommands: { maxArgumentDepth: maxDepth, maxArgumentLength: maxLength },\n } = getConfig();\n\n return { maxDepth, maxLength, nonNullReplacerWithDomSupport };\n};\n\nconst isDomObject = (value: unknown): value is object =>\n typeof value === \"object\" && value !== null && Cypress.dom.isDom(value);\n\n// @ts-ignore\nconst stringifyAsDom = (value: object) => Cypress.dom.stringify(value, \"long\");\n\nconst nonNullReplacerWithDomSupport = (_: string, value: unknown) => {\n if (typeof value === \"object\") {\n // Exclude null properties to make the result more compact.\n if (value === null) {\n return undefined;\n }\n\n if (Cypress.dom.isDom(value)) {\n // Window, document, and DOM element properties are serialized with Cypress.dom.stringify.\n return stringifyAsDom(value);\n }\n }\n\n // Use the implementation from allure-js-commons/sdk in all other cases.\n return value;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAuC,SAAAE,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAA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,mBAAmB,CAAC,CAAC,CAAC;EACrE;EACA,OAAO,IAAAD,cAAS,EAAC9B,KAAK,EAAE+B,mBAAmB,CAAC,CAAC,CAAC;AAChD,CAAC;AAAChB,OAAA,CAAAD,iBAAA,GAAAA,iBAAA;AAEF,IAAMiB,mBAAmB,GAAGA,CAAA,KAAM;EAChC,IAAM;IACJC,iBAAiB,EAAE;MAAEC,gBAAgB,EAAEC,QAAQ;MAAEC,iBAAiB,EAAEC;IAAU;EAChF,CAAC,GAAG,IAAAC,gBAAS,EAAC,CAAC;EAEf,OAAO;IAAEH,QAAQ;IAAEE,SAAS;IAAEE;EAA8B,CAAC;AAC/D,CAAC;AAED,IAAM1B,WAAW,GAAIZ,KAAc,IACjC,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,IAAIuC,OAAO,CAACC,GAAG,CAACC,KAAK,CAACzC,KAAK,CAAC;;AAEzE;AACA,IAAMa,cAAc,GAAIb,KAAa,IAAKuC,OAAO,CAACC,GAAG,CAACE,SAAS,CAAC1C,KAAK,EAAE,MAAM,CAAC;AAE9E,IAAMsC,6BAA6B,GAAGA,CAACK,CAAS,EAAE3C,KAAc,KAAK;EACnE,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B;IACA,IAAIA,KAAK,KAAK,IAAI,EAAE;MAClB,OAAOsB,SAAS;IAClB;IAEA,IAAIiB,OAAO,CAACC,GAAG,CAACC,KAAK,CAACzC,KAAK,CAAC,EAAE;MAC5B;MACA,OAAOa,cAAc,CAACb,KAAK,CAAC;IAC9B;EACF;;EAEA;EACA,OAAOA,KAAK;AACd,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"serialize.js","names":["_sdk","require","_state","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_default","isDomObject","stringifyAsDom","serializeAsObject","exports","default","isPlainObject","Array","isArray","stripAncestorRefs","ancestors","undefined","result","key","prop","entries","includes","pop","cleaned","serialize","getSerializeOptions","stepsFromCommands","maxArgumentDepth","maxDepth","maxArgumentLength","maxLength","getConfig","nonNullReplacerWithDomSupport","Cypress","dom","isDom","stringify","_"],"sources":["../../../src/browser/serialize.ts"],"sourcesContent":["import { serialize } from \"allure-js-commons/sdk\";\n\nimport { getConfig } from \"./state.js\";\n\nexport default (value: unknown) => {\n return isDomObject(value) ? stringifyAsDom(value) : serializeAsObject(value);\n};\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst stripAncestorRefs = (value: unknown, ancestors: object[] = []): unknown => {\n if (!isPlainObject(value)) {\n return value;\n }\n\n const result: Record<string, unknown> = {};\n ancestors.push(value);\n\n for (const [key, prop] of Object.entries(value)) {\n if (typeof prop === \"object\" && prop !== null) {\n if (ancestors.includes(prop)) {\n continue;\n }\n result[key] = stripAncestorRefs(prop, ancestors);\n } else {\n result[key] = prop;\n }\n }\n\n ancestors.pop();\n return result;\n};\n\nexport const serializeAsObject = (value: unknown) => {\n if (isPlainObject(value)) {\n const cleaned = stripAncestorRefs(value);\n return serialize({ ...(cleaned as object) }, getSerializeOptions());\n }\n return serialize(value, getSerializeOptions());\n};\n\nconst getSerializeOptions = () => {\n const {\n stepsFromCommands: { maxArgumentDepth: maxDepth, maxArgumentLength: maxLength },\n } = getConfig();\n\n return { maxDepth, maxLength, nonNullReplacerWithDomSupport };\n};\n\nconst isDomObject = (value: unknown): value is object =>\n typeof value === \"object\" && value !== null && Cypress.dom.isDom(value);\n\n// @ts-ignore\nconst stringifyAsDom = (value: object) => Cypress.dom.stringify(value, \"long\");\n\nconst nonNullReplacerWithDomSupport = (_: string, value: unknown) => {\n if (typeof value === \"object\") {\n // Exclude null properties to make the result more compact.\n if (value === null) {\n return undefined;\n }\n\n if (Cypress.dom.isDom(value)) {\n // Window, document, and DOM element properties are serialized with Cypress.dom.stringify.\n return stringifyAsDom(value);\n }\n }\n\n // Use the implementation from allure-js-commons/sdk in all other cases.\n return value;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAAuC,SAAAE,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAAA,CAAAc,yBAAA,CAAAf,CAAA,KAAAH,OAAA,CAAAI,MAAA,CAAAD,CAAA,GAAAa,OAAA,WAAAd,CAAA,IAAAE,MAAA,CAAAgB,cAAA,CAAAnB,CAAA,EAAAC,CAAA,EAAAE,MAAA,CAAAK,wBAAA,CAAAN,CAAA,EAAAD,CAAA,iBAAAD,CAAA;AAA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AC/D,CAAC;AAED,IAAM1B,WAAW,GAAIZ,KAAc,IACjC,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,IAAIuC,OAAO,CAACC,GAAG,CAACC,KAAK,CAACzC,KAAK,CAAC;;AAEzE;AACA,IAAMa,cAAc,GAAIb,KAAa,IAAKuC,OAAO,CAACC,GAAG,CAACE,SAAS,CAAC1C,KAAK,EAAE,MAAM,CAAC;AAE9E,IAAMsC,6BAA6B,GAAGA,CAACK,CAAS,EAAE3C,KAAc,KAAK;EACnE,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B;IACA,IAAIA,KAAK,KAAK,IAAI,EAAE;MAClB,OAAOsB,SAAS;IAClB;IAEA,IAAIiB,OAAO,CAACC,GAAG,CAACC,KAAK,CAACzC,KAAK,CAAC,EAAE;MAC5B;MACA,OAAOa,cAAc,CAACb,KAAK,CAAC;IAC9B;EACF;;EAEA;EACA,OAAOA,KAAK;AACd,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"steps.js","names":["_allureJsCommons","require","_sdk","_utils","_lifecycle","_state","_utils2","ALLURE_STEP_CMD_SUBJECT","exports","isApiStep","descriptor","type","isLogStep","startAllureApiStep","name","reportStepStart","pushAllureStep","id","generateApiStepId","pushStep","reportStepError","error","status","getStatusFromError","statusDetails","getMessageAndTraceFromError","stopAllureApiStepStackTip","associateErrorWithRunningSteps","stopCurrentAllureApiStep","findAndStopStepWithSubsteps","stepDescriptor","pred","stopSelectedSteps","popUntilFindIncluded","getStepStack","stopAllSteps","popAllSteps","finalizeSteps","getStepsToFinalize","forEach","finalizeOneStep","clearStepsToFinalize","resolveStepStatus","step","Status","PASSED","_ref","finalizer","data","enqueueRuntimeMessage","stepStack","firstApiStepAfterLastLogStep","at","findLastIndex","logEntryOrMessage","Object","is","propagateErrorToStepDescriptor","errorOfSubstep","log","attributes","steps","stepEntry","stopStep","reportStepStop","setupStepFinalization"],"sources":["../../../src/browser/steps.ts"],"sourcesContent":["import type { StatusDetails } from \"allure-js-commons\";\nimport { Status } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\nimport type {\n ApiStepDescriptor,\n CypressStepFinalizeMessage,\n LogStepDescriptor,\n StepDescriptor,\n StepFinalizer,\n} from \"../types.js\";\nimport { popUntilFindIncluded } from \"../utils.js\";\nimport { reportStepStart, reportStepStop } from \"./lifecycle.js\";\nimport {\n clearStepsToFinalize,\n enqueueRuntimeMessage,\n getStepStack,\n getStepsToFinalize,\n popAllSteps,\n pushStep,\n setupStepFinalization,\n} from \"./state.js\";\nimport { generateApiStepId } from \"./utils.js\";\n\nexport const ALLURE_STEP_CMD_SUBJECT = {};\n\nexport const isApiStep = (descriptor: StepDescriptor): descriptor is ApiStepDescriptor => {\n return descriptor.type === \"api\";\n};\n\nexport const isLogStep = (descriptor: StepDescriptor): descriptor is LogStepDescriptor => {\n return descriptor.type === \"log\";\n};\n\nexport const startAllureApiStep = (name: string) => reportStepStart(pushAllureStep(), name);\n\nexport const pushAllureStep = () => {\n const id = generateApiStepId();\n pushStep({ id, type: \"api\" });\n return id;\n};\n\nexport const reportStepError = (error: Error) => {\n const status = getStatusFromError(error);\n const statusDetails = getMessageAndTraceFromError(error);\n\n // Cypress will abort the test/hook execution soon. No subsequent commands will be run, including the ones that\n // have been scheduled by `allure.step` to stop the currently running steps.\n // Additionally, we can't tell in advance if the current command log steps will be stopped normally or not.\n //\n // Given that, this function will stop all consecutive Allure API steps at the tip of the step stack.\n // The command log steps will be given a chance to stop normally to get the most correct timings.\n //\n // The command log steps that won't stop normally (and Allure API substeps thereof) will be stopped during the\n // test/hook finalization phase.\n stopAllureApiStepStackTip(status, statusDetails);\n\n // It's not guaranteed for command log steps and intermediate Allure API steps to have access to the error at the\n // moment they are stopped.\n // Additionally, Cypress may not update the stack trace of the error at that time. Until that happens, the stack\n // trace points deep in the bundled code, which is little to no use for the user. Therefore, we need to associate\n // the remaining steps with the error object to grab the updated stack trace later.\n associateErrorWithRunningSteps(error);\n};\n\nexport const stopCurrentAllureApiStep = (status?: Status, statusDetails?: StatusDetails) =>\n findAndStopStepWithSubsteps((stepDescriptor) => isApiStep(stepDescriptor), status, statusDetails);\n\nexport const findAndStopStepWithSubsteps = (\n pred: (stepEntry: StepDescriptor) => boolean,\n status?: Status,\n statusDetails?: StatusDetails,\n) => stopSelectedSteps(popUntilFindIncluded(getStepStack(), pred), status, statusDetails);\n\nexport const stopAllSteps = (status?: Status, statusDetails?: StatusDetails) =>\n stopSelectedSteps(popAllSteps(), status, statusDetails);\n\nexport const finalizeSteps = () => {\n // This will stop all dangling steps (like log groups with missing endGroup calls or logs that haven't been\n // finished by Cypress due to an error).\n stopAllSteps();\n\n getStepsToFinalize().forEach(finalizeOneStep);\n clearStepsToFinalize();\n};\n\nexport const resolveStepStatus = (step: StepDescriptor) =>\n step.error ? getStatusFromError(step.error) : Status.PASSED;\n\nconst finalizeOneStep = ([step, finalizer]: [StepDescriptor, StepFinalizer | undefined]) => {\n const { id, error } = step;\n const data: CypressStepFinalizeMessage[\"data\"] = { id };\n\n if (error) {\n // Cypress rewrites the stack trace of an error to point to the location in the test file. Until then, the stack\n // trace points inside the messy bundle, which is not helpful. There are circumstances when we can't be sure this\n // has happened when a step is about to stop. That's why we defer setting the status details until we are sure\n // Cypress does its job.\n data.statusDetails = getMessageAndTraceFromError(error);\n }\n\n finalizer?.(data);\n\n enqueueRuntimeMessage({\n type: \"cypress_step_finalize\",\n data,\n });\n};\n\nconst stopAllureApiStepStackTip = (status: Status, statusDetails: StatusDetails) => {\n const stepStack = getStepStack();\n const firstApiStepAfterLastLogStep = stepStack.at(stepStack.findLastIndex(isLogStep) + 1);\n if (firstApiStepAfterLastLogStep) {\n findAndStopStepWithSubsteps(\n (logEntryOrMessage) => Object.is(logEntryOrMessage, firstApiStepAfterLastLogStep),\n status,\n statusDetails,\n );\n }\n};\n\nconst propagateErrorToStepDescriptor = (step: StepDescriptor, errorOfSubstep: Error | undefined) => {\n if (isLogStep(step)) {\n const error = step.log.attributes.error;\n if (error) {\n return (step.error = error);\n }\n }\n\n if (errorOfSubstep) {\n step.error = errorOfSubstep;\n }\n\n return step.error;\n};\n\nconst stopSelectedSteps = (steps: readonly StepDescriptor[], status?: Status, statusDetails?: StatusDetails) => {\n let error: Error | undefined;\n for (const stepEntry of steps) {\n error = propagateErrorToStepDescriptor(stepEntry, error);\n stopStep(stepEntry, status, statusDetails);\n }\n\n if (error) {\n associateErrorWithRunningSteps(error);\n }\n};\n\nconst associateErrorWithRunningSteps = (error: Error) => getStepStack().forEach((step) => (step.error = error));\n\nconst stopStep = (step: StepDescriptor, status?: Status, statusDetails?: StatusDetails) => {\n reportStepStop(step, status, statusDetails);\n\n if (isApiStep(step) && step.error) {\n setupStepFinalization(step);\n }\n};\n"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAQA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AASA,IAAAK,OAAA,GAAAL,OAAA;AAEO,IAAMM,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,CAAC,CAAC;AAElC,IAAME,SAAS,GAAIC,UAA0B,IAAsC;EACxF,OAAOA,UAAU,CAACC,IAAI,KAAK,KAAK;AAClC,CAAC;AAACH,OAAA,CAAAC,SAAA,GAAAA,SAAA;AAEK,IAAMG,SAAS,GAAIF,UAA0B,IAAsC;EACxF,OAAOA,UAAU,CAACC,IAAI,KAAK,KAAK;AAClC,CAAC;AAACH,OAAA,CAAAI,SAAA,GAAAA,SAAA;AAEK,IAAMC,kBAAkB,GAAIC,IAAY,IAAK,IAAAC,0BAAe,EAACC,cAAc,CAAC,CAAC,EAAEF,IAAI,CAAC;AAACN,OAAA,CAAAK,kBAAA,GAAAA,kBAAA;AAErF,IAAMG,cAAc,GAAGA,CAAA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AAC;AAED,IAAMiC,8BAA8B,GAAGA,CAACd,IAAoB,EAAEe,cAAiC,KAAK;EAClG,IAAI9C,SAAS,CAAC+B,IAAI,CAAC,EAAE;IACnB,IAAMtB,KAAK,GAAGsB,IAAI,CAACgB,GAAG,CAACC,UAAU,CAACvC,KAAK;IACvC,IAAIA,KAAK,EAAE;MACT,OAAQsB,IAAI,CAACtB,KAAK,GAAGA,KAAK;IAC5B;EACF;EAEA,IAAIqC,cAAc,EAAE;IAClBf,IAAI,CAACtB,KAAK,GAAGqC,cAAc;EAC7B;EAEA,OAAOf,IAAI,CAACtB,KAAK;AACnB,CAAC;AAED,IAAMW,iBAAiB,GAAGA,CAAC6B,KAAgC,EAAEvC,MAAe,EAAEE,aAA6B,KAAK;EAC9G,IAAIH,KAAwB;EAC5B,KAAK,IAAMyC,SAAS,IAAID,KAAK,EAAE;IAC7BxC,KAAK,GAAGoC,8BAA8B,CAACK,SAAS,EAAEzC,KAAK,CAAC;IACxD0C,QAAQ,CAACD,SAAS,EAAExC,MAAM,EAAEE,aAAa,CAAC;EAC5C;EAEA,IAAIH,KAAK,EAAE;IACTM,8BAA8B,CAACN,KAAK,CAAC;EACvC;AACF,CAAC;AAED,IAAMM,8BAA8B,GAAIN,KAAY,IAAK,IAAAa,mBAAY,EAAC,CAAC,CAACK,OAAO,CAAEI,IAAI,IAAMA,IAAI,CAACtB,KAAK,GAAGA,KAAM,CAAC;AAE/G,IAAM0C,QAAQ,GAAGA,CAACpB,IAAoB,EAAErB,MAAe,EAAEE,aAA6B,KAAK;EACzF,IAAAwC,yBAAc,EAACrB,IAAI,EAAErB,MAAM,EAAEE,aAAa,CAAC;EAE3C,IAAIf,SAAS,CAACkC,IAAI,CAAC,IAAIA,IAAI,CAACtB,KAAK,EAAE;IACjC,IAAA4C,4BAAqB,EAACtB,IAAI,CAAC;EAC7B;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"steps.js","names":["_allureJsCommons","require","_sdk","_utils","_lifecycle","_state","_utils2","ALLURE_STEP_CMD_SUBJECT","exports","isApiStep","descriptor","type","isLogStep","startAllureApiStep","name","reportStepStart","pushAllureStep","id","generateApiStepId","pushStep","reportStepError","error","status","getStatusFromError","statusDetails","getMessageAndTraceFromError","stopAllureApiStepStackTip","associateErrorWithRunningSteps","stopCurrentAllureApiStep","findAndStopStepWithSubsteps","stepDescriptor","pred","stopSelectedSteps","popUntilFindIncluded","getStepStack","stopAllSteps","popAllSteps","finalizeSteps","getStepsToFinalize","forEach","finalizeOneStep","clearStepsToFinalize","resolveStepStatus","step","Status","PASSED","_ref","finalizer","data","enqueueRuntimeMessage","stepStack","firstApiStepAfterLastLogStep","at","findLastIndex","logEntryOrMessage","Object","is","propagateErrorToStepDescriptor","errorOfSubstep","log","attributes","steps","stepEntry","stopStep","reportStepStop","setupStepFinalization"],"sources":["../../../src/browser/steps.ts"],"sourcesContent":["import type { StatusDetails } from \"allure-js-commons\";\nimport { Status } from \"allure-js-commons\";\nimport { getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\n\nimport type {\n ApiStepDescriptor,\n CypressStepFinalizeMessage,\n LogStepDescriptor,\n StepDescriptor,\n StepFinalizer,\n} from \"../types.js\";\nimport { popUntilFindIncluded } from \"../utils.js\";\nimport { reportStepStart, reportStepStop } from \"./lifecycle.js\";\nimport {\n clearStepsToFinalize,\n enqueueRuntimeMessage,\n getStepStack,\n getStepsToFinalize,\n popAllSteps,\n pushStep,\n setupStepFinalization,\n} from \"./state.js\";\nimport { generateApiStepId } from \"./utils.js\";\n\nexport const ALLURE_STEP_CMD_SUBJECT = {};\n\nexport const isApiStep = (descriptor: StepDescriptor): descriptor is ApiStepDescriptor => {\n return descriptor.type === \"api\";\n};\n\nexport const isLogStep = (descriptor: StepDescriptor): descriptor is LogStepDescriptor => {\n return descriptor.type === \"log\";\n};\n\nexport const startAllureApiStep = (name: string) => reportStepStart(pushAllureStep(), name);\n\nexport const pushAllureStep = () => {\n const id = generateApiStepId();\n pushStep({ id, type: \"api\" });\n return id;\n};\n\nexport const reportStepError = (error: Error) => {\n const status = getStatusFromError(error);\n const statusDetails = getMessageAndTraceFromError(error);\n\n // Cypress will abort the test/hook execution soon. No subsequent commands will be run, including the ones that\n // have been scheduled by `allure.step` to stop the currently running steps.\n // Additionally, we can't tell in advance if the current command log steps will be stopped normally or not.\n //\n // Given that, this function will stop all consecutive Allure API steps at the tip of the step stack.\n // The command log steps will be given a chance to stop normally to get the most correct timings.\n //\n // The command log steps that won't stop normally (and Allure API substeps thereof) will be stopped during the\n // test/hook finalization phase.\n stopAllureApiStepStackTip(status, statusDetails);\n\n // It's not guaranteed for command log steps and intermediate Allure API steps to have access to the error at the\n // moment they are stopped.\n // Additionally, Cypress may not update the stack trace of the error at that time. Until that happens, the stack\n // trace points deep in the bundled code, which is little to no use for the user. Therefore, we need to associate\n // the remaining steps with the error object to grab the updated stack trace later.\n associateErrorWithRunningSteps(error);\n};\n\nexport const stopCurrentAllureApiStep = (status?: Status, statusDetails?: StatusDetails) =>\n findAndStopStepWithSubsteps((stepDescriptor) => isApiStep(stepDescriptor), status, statusDetails);\n\nexport const findAndStopStepWithSubsteps = (\n pred: (stepEntry: StepDescriptor) => boolean,\n status?: Status,\n statusDetails?: StatusDetails,\n) => stopSelectedSteps(popUntilFindIncluded(getStepStack(), pred), status, statusDetails);\n\nexport const stopAllSteps = (status?: Status, statusDetails?: StatusDetails) =>\n stopSelectedSteps(popAllSteps(), status, statusDetails);\n\nexport const finalizeSteps = () => {\n // This will stop all dangling steps (like log groups with missing endGroup calls or logs that haven't been\n // finished by Cypress due to an error).\n stopAllSteps();\n\n getStepsToFinalize().forEach(finalizeOneStep);\n clearStepsToFinalize();\n};\n\nexport const resolveStepStatus = (step: StepDescriptor) =>\n step.error ? getStatusFromError(step.error) : Status.PASSED;\n\nconst finalizeOneStep = ([step, finalizer]: [StepDescriptor, StepFinalizer | undefined]) => {\n const { id, error } = step;\n const data: CypressStepFinalizeMessage[\"data\"] = { id };\n\n if (error) {\n // Cypress rewrites the stack trace of an error to point to the location in the test file. Until then, the stack\n // trace points inside the messy bundle, which is not helpful. There are circumstances when we can't be sure this\n // has happened when a step is about to stop. That's why we defer setting the status details until we are sure\n // Cypress does its job.\n data.statusDetails = getMessageAndTraceFromError(error);\n }\n\n finalizer?.(data);\n\n enqueueRuntimeMessage({\n type: \"cypress_step_finalize\",\n data,\n });\n};\n\nconst stopAllureApiStepStackTip = (status: Status, statusDetails: StatusDetails) => {\n const stepStack = getStepStack();\n const firstApiStepAfterLastLogStep = stepStack.at(stepStack.findLastIndex(isLogStep) + 1);\n if (firstApiStepAfterLastLogStep) {\n findAndStopStepWithSubsteps(\n (logEntryOrMessage) => Object.is(logEntryOrMessage, firstApiStepAfterLastLogStep),\n status,\n statusDetails,\n );\n }\n};\n\nconst propagateErrorToStepDescriptor = (step: StepDescriptor, errorOfSubstep: Error | undefined) => {\n if (isLogStep(step)) {\n const error = step.log.attributes.error;\n if (error) {\n return (step.error = error);\n }\n }\n\n if (errorOfSubstep) {\n step.error = errorOfSubstep;\n }\n\n return step.error;\n};\n\nconst stopSelectedSteps = (steps: readonly StepDescriptor[], status?: Status, statusDetails?: StatusDetails) => {\n let error: Error | undefined;\n for (const stepEntry of steps) {\n error = propagateErrorToStepDescriptor(stepEntry, error);\n stopStep(stepEntry, status, statusDetails);\n }\n\n if (error) {\n associateErrorWithRunningSteps(error);\n }\n};\n\nconst associateErrorWithRunningSteps = (error: Error) => getStepStack().forEach((step) => (step.error = error));\n\nconst stopStep = (step: StepDescriptor, status?: Status, statusDetails?: StatusDetails) => {\n reportStepStop(step, status, statusDetails);\n\n if (isApiStep(step) && step.error) {\n setupStepFinalization(step);\n }\n};\n"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AASA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AASA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,8BAA8B,CAACN,KAAK,CAAC;EACvC;AACF,CAAC;AAED,IAAMM,8BAA8B,GAAIN,KAAY,IAAK,IAAAa,mBAAY,EAAC,CAAC,CAACK,OAAO,CAAEI,IAAI,IAAMA,IAAI,CAACtB,KAAK,GAAGA,KAAM,CAAC;AAE/G,IAAM0C,QAAQ,GAAGA,CAACpB,IAAoB,EAAErB,MAAe,EAAEE,aAA6B,KAAK;EACzF,IAAAwC,yBAAc,EAACrB,IAAI,EAAErB,MAAM,EAAEE,aAAa,CAAC;EAE3C,IAAIf,SAAS,CAACkC,IAAI,CAAC,IAAIA,IAAI,CAACtB,KAAK,EAAE;IACjC,IAAA4C,4BAAqB,EAACtB,IAAI,CAAC;EAC7B;AACF,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"testplan.js","names":["_allureJsCommons","require","_state","_utils","applyTestPlan","spec","root","testPlan","getAllureTestPlan","specPath","resolveSpecRelativePath","suite","iterateSuites","indicesToRemove","getIndicesOfDeselectedTests","tests","removeSortedIndices","exports","parent","suiteStack","s","pop","i","suites","length","push","forEach","test","index","_labels$find","fullNameSuffix","labels","getTestMetadata","fullName","concat","allureId","find","_ref","name","LabelName","ALLURE_ID","value","includedInTestPlan","arr","indices","splice","some","_test$id","id","toString","selector"],"sources":["../../../src/browser/testplan.ts"],"sourcesContent":["import { LabelName } from \"allure-js-commons\";\nimport type { TestPlanV1 } from \"allure-js-commons/sdk\";\nimport type { CypressSuite, CypressTest } from \"../types.js\";\nimport { getAllureTestPlan } from \"./state.js\";\nimport { getTestMetadata, resolveSpecRelativePath } from \"./utils.js\";\n\nexport const applyTestPlan = (spec: Cypress.Spec, root: CypressSuite) => {\n const testPlan = getAllureTestPlan();\n if (testPlan) {\n const specPath = resolveSpecRelativePath(spec);\n for (const suite of iterateSuites(root)) {\n const indicesToRemove = getIndicesOfDeselectedTests(testPlan, spec, specPath, suite.tests);\n removeSortedIndices(suite.tests, indicesToRemove);\n }\n }\n};\n\nconst iterateSuites = function* (parent: CypressSuite) {\n const suiteStack: CypressSuite[] = [];\n for (let s: CypressSuite | undefined = parent; s; s = suiteStack.pop()) {\n yield s;\n\n // Pushing in reverse allows us to maintain depth-first pre-order traversal -\n // the same order as used by Mocha & Cypress.\n for (let i = s.suites.length - 1; i >= 0; i--) {\n suiteStack.push(s.suites[i]);\n }\n }\n};\n\nconst getIndicesOfDeselectedTests = (\n testPlan: TestPlanV1,\n spec: Cypress.Spec,\n specPath: string,\n tests: readonly CypressTest[],\n) => {\n const indicesToRemove: number[] = [];\n tests.forEach((test, index) => {\n const { fullNameSuffix, labels } = getTestMetadata(test);\n const fullName = `${specPath}#${fullNameSuffix}`;\n const allureId = labels.find(({ name }) => name === LabelName.ALLURE_ID)?.value;\n\n if (!includedInTestPlan(testPlan, fullName, allureId)) {\n indicesToRemove.push(index);\n }\n });\n return indicesToRemove;\n};\n\nconst removeSortedIndices = <T>(arr: T[], indices: readonly number[]) => {\n for (let i = indices.length - 1; i >= 0; i--) {\n arr.splice(indices[i], 1);\n }\n};\n\nconst includedInTestPlan = (testPlan: TestPlanV1, fullName: string, allureId: string | undefined): boolean =>\n testPlan.tests.some((test) => (allureId && test.id?.toString() === allureId) || test.selector === fullName);\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,IAAMG,aAAa,GAAGA,CAACC,IAAkB,EAAEC,IAAkB,KAAK;EACvE,IAAMC,QAAQ,GAAG,IAAAC,wBAAiB,EAAC,CAAC;EACpC,IAAID,QAAQ,EAAE;IACZ,IAAME,QAAQ,GAAG,IAAAC,8BAAuB,EAACL,IAAI,CAAC;IAC9C,KAAK,IAAMM,KAAK,IAAIC,aAAa,CAACN,IAAI,CAAC,EAAE;MACvC,IAAMO,eAAe,GAAGC,2BAA2B,CAACP,QAAQ,EAAEF,IAAI,EAAEI,QAAQ,EAAEE,KAAK,CAACI,KA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Q,EAAEE,QAAQ,CAAC,EAAE;MACrDtB,eAAe,CAACY,IAAI,CAACG,KAAK,CAAC;IAC7B;EACF,CAAC,CAAC;EACF,OAAOf,eAAe;AACxB,CAAC;AAED,IAAMG,mBAAmB,GAAGA,CAAI2B,GAAQ,EAAEC,OAA0B,KAAK;EACvE,KAAK,IAAItB,CAAC,GAAGsB,OAAO,CAACpB,MAAM,GAAG,CAAC,EAAEF,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC5CqB,GAAG,CAACE,MAAM,CAACD,OAAO,CAACtB,CAAC,CAAC,EAAE,CAAC,CAAC;EAC3B;AACF,CAAC;AAED,IAAMoB,kBAAkB,GAAGA,CAACnC,QAAoB,EAAE0B,QAAgB,EAAEE,QAA4B,KAC9F5B,QAAQ,CAACQ,KAAK,CAAC+B,IAAI,CAAEnB,IAAI;EAAA,IAAAoB,QAAA;EAAA,OAAMZ,QAAQ,IAAI,EAAAY,QAAA,GAAApB,IAAI,CAACqB,EAAE,cAAAD,QAAA,uBAAPA,QAAA,CAASE,QAAQ,CAAC,CAAC,MAAKd,QAAQ,IAAKR,IAAI,CAACuB,QAAQ,KAAKjB,QAAQ;AAAA,EAAC","ignoreList":[]}
1
+ {"version":3,"file":"testplan.js","names":["_allureJsCommons","require","_state","_utils","applyTestPlan","spec","root","testPlan","getAllureTestPlan","specPath","resolveSpecRelativePath","suite","iterateSuites","indicesToRemove","getIndicesOfDeselectedTests","tests","removeSortedIndices","exports","parent","suiteStack","s","pop","i","suites","length","push","forEach","test","index","_labels$find","fullNameSuffix","labels","getTestMetadata","fullName","concat","allureId","find","_ref","name","LabelName","ALLURE_ID","value","includedInTestPlan","arr","indices","splice","some","_test$id","id","toString","selector"],"sources":["../../../src/browser/testplan.ts"],"sourcesContent":["import { LabelName } from \"allure-js-commons\";\nimport type { TestPlanV1 } from \"allure-js-commons/sdk\";\n\nimport type { CypressSuite, CypressTest } from \"../types.js\";\nimport { getAllureTestPlan } from \"./state.js\";\nimport { getTestMetadata, resolveSpecRelativePath } from \"./utils.js\";\n\nexport const applyTestPlan = (spec: Cypress.Spec, root: CypressSuite) => {\n const testPlan = getAllureTestPlan();\n if (testPlan) {\n const specPath = resolveSpecRelativePath(spec);\n for (const suite of iterateSuites(root)) {\n const indicesToRemove = getIndicesOfDeselectedTests(testPlan, spec, specPath, suite.tests);\n removeSortedIndices(suite.tests, indicesToRemove);\n }\n }\n};\n\nconst iterateSuites = function* (parent: CypressSuite) {\n const suiteStack: CypressSuite[] = [];\n for (let s: CypressSuite | undefined = parent; s; s = suiteStack.pop()) {\n yield s;\n\n // Pushing in reverse allows us to maintain depth-first pre-order traversal -\n // the same order as used by Mocha & Cypress.\n for (let i = s.suites.length - 1; i >= 0; i--) {\n suiteStack.push(s.suites[i]);\n }\n }\n};\n\nconst getIndicesOfDeselectedTests = (\n testPlan: TestPlanV1,\n spec: Cypress.Spec,\n specPath: string,\n tests: readonly CypressTest[],\n) => {\n const indicesToRemove: number[] = [];\n tests.forEach((test, index) => {\n const { fullNameSuffix, labels } = getTestMetadata(test);\n const fullName = `${specPath}#${fullNameSuffix}`;\n const allureId = labels.find(({ name }) => name === LabelName.ALLURE_ID)?.value;\n\n if (!includedInTestPlan(testPlan, fullName, allureId)) {\n indicesToRemove.push(index);\n }\n });\n return indicesToRemove;\n};\n\nconst removeSortedIndices = <T>(arr: T[], indices: readonly number[]) => {\n for (let i = indices.length - 1; i >= 0; i--) {\n arr.splice(indices[i], 1);\n }\n};\n\nconst includedInTestPlan = (testPlan: TestPlanV1, fullName: string, allureId: string | undefined): boolean =>\n testPlan.tests.some((test) => (allureId && test.id?.toString() === allureId) || test.selector === fullName);\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,IAAMG,aAAa,GAAGA,CAACC,IAAkB,EAAEC,IAAkB,KAAK;EACvE,IAAMC,QAAQ,GAA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