allure-cypress 3.0.6 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/cjs/browser/commandLog.js +216 -0
  2. package/dist/cjs/browser/commandLog.js.map +1 -0
  3. package/dist/cjs/browser/events/cypress.js +45 -0
  4. package/dist/cjs/browser/events/cypress.js.map +1 -0
  5. package/dist/cjs/browser/events/index.js +23 -0
  6. package/dist/cjs/browser/events/index.js.map +1 -0
  7. package/dist/cjs/browser/events/mocha.js +76 -0
  8. package/dist/cjs/browser/events/mocha.js.map +1 -0
  9. package/dist/cjs/browser/index.js +18 -0
  10. package/dist/cjs/browser/index.js.map +1 -0
  11. package/dist/cjs/browser/lifecycle.js +243 -0
  12. package/dist/cjs/browser/lifecycle.js.map +1 -0
  13. package/dist/cjs/browser/patching.js +126 -0
  14. package/dist/cjs/browser/patching.js.map +1 -0
  15. package/dist/cjs/browser/runtime.js +214 -0
  16. package/dist/cjs/browser/runtime.js.map +1 -0
  17. package/dist/cjs/browser/serialize.js +44 -0
  18. package/dist/cjs/browser/serialize.js.map +1 -0
  19. package/dist/cjs/browser/state.js +84 -0
  20. package/dist/cjs/browser/state.js.map +1 -0
  21. package/dist/cjs/browser/steps.js +130 -0
  22. package/dist/cjs/browser/steps.js.map +1 -0
  23. package/dist/cjs/browser/testplan.js +63 -0
  24. package/dist/cjs/browser/testplan.js.map +1 -0
  25. package/dist/cjs/browser/utils.js +153 -0
  26. package/dist/cjs/browser/utils.js.map +1 -0
  27. package/dist/cjs/index.js +1 -1
  28. package/dist/cjs/index.js.map +4 -4
  29. package/dist/cjs/reporter.js +75 -34
  30. package/dist/cjs/reporter.js.map +1 -1
  31. package/dist/cjs/types.js +2 -0
  32. package/dist/cjs/types.js.map +1 -0
  33. package/dist/cjs/utils.js +19 -173
  34. package/dist/cjs/utils.js.map +1 -1
  35. package/dist/esm/browser/commandLog.js +205 -0
  36. package/dist/esm/browser/commandLog.js.map +1 -0
  37. package/dist/esm/browser/events/cypress.js +37 -0
  38. package/dist/esm/browser/events/cypress.js.map +1 -0
  39. package/dist/esm/browser/events/index.js +11 -0
  40. package/dist/esm/browser/events/index.js.map +1 -0
  41. package/dist/esm/browser/events/mocha.js +68 -0
  42. package/dist/esm/browser/events/mocha.js.map +1 -0
  43. package/dist/esm/browser/index.js +11 -0
  44. package/dist/esm/browser/index.js.map +1 -0
  45. package/dist/esm/browser/lifecycle.js +218 -0
  46. package/dist/esm/browser/lifecycle.js.map +1 -0
  47. package/dist/esm/browser/patching.js +119 -0
  48. package/dist/esm/browser/patching.js.map +1 -0
  49. package/dist/esm/browser/runtime.js +206 -0
  50. package/dist/esm/browser/runtime.js.map +1 -0
  51. package/dist/esm/browser/serialize.js +36 -0
  52. package/dist/esm/browser/serialize.js.map +1 -0
  53. package/dist/esm/{state.js → browser/state.js} +20 -2
  54. package/dist/esm/browser/state.js.map +1 -0
  55. package/dist/esm/browser/steps.js +114 -0
  56. package/dist/esm/browser/steps.js.map +1 -0
  57. package/dist/esm/browser/testplan.js +56 -0
  58. package/dist/esm/browser/testplan.js.map +1 -0
  59. package/dist/esm/browser/utils.js +130 -0
  60. package/dist/esm/browser/utils.js.map +1 -0
  61. package/dist/esm/index.js +1 -1
  62. package/dist/esm/index.js.map +4 -4
  63. package/dist/esm/reporter.js +75 -34
  64. package/dist/esm/reporter.js.map +1 -1
  65. package/dist/esm/types.js +2 -0
  66. package/dist/esm/types.js.map +1 -0
  67. package/dist/esm/utils.js +15 -157
  68. package/dist/esm/utils.js.map +1 -1
  69. package/dist/types/browser/commandLog.d.ts +10 -0
  70. package/dist/types/browser/events/cypress.d.ts +2 -0
  71. package/dist/types/browser/events/index.d.ts +2 -0
  72. package/dist/types/browser/events/mocha.d.ts +3 -0
  73. package/dist/types/browser/index.d.ts +1 -0
  74. package/dist/types/browser/lifecycle.d.ts +22 -0
  75. package/dist/types/browser/patching.d.ts +5 -0
  76. package/dist/types/browser/runtime.d.ts +26 -0
  77. package/dist/types/browser/serialize.d.ts +2 -0
  78. package/dist/types/{state.d.ts → browser/state.d.ts} +11 -1
  79. package/dist/types/browser/steps.d.ts +14 -0
  80. package/dist/types/browser/testplan.d.ts +2 -0
  81. package/dist/types/browser/utils.d.ts +52 -0
  82. package/dist/types/reporter.d.ts +1 -1
  83. package/dist/types/{model.d.ts → types.d.ts} +61 -11
  84. package/dist/types/utils.d.ts +9 -43
  85. package/package.json +8 -8
  86. package/dist/cjs/model.js +0 -9
  87. package/dist/cjs/model.js.map +0 -1
  88. package/dist/cjs/runtime.js +0 -649
  89. package/dist/cjs/runtime.js.map +0 -1
  90. package/dist/cjs/state.js +0 -56
  91. package/dist/cjs/state.js.map +0 -1
  92. package/dist/esm/model.js +0 -3
  93. package/dist/esm/model.js.map +0 -1
  94. package/dist/esm/runtime.js +0 -620
  95. package/dist/esm/runtime.js.map +0 -1
  96. package/dist/esm/state.js.map +0 -1
  97. package/dist/types/runtime.d.ts +0 -50
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["LabelName","Status","extractMetadataFromString","getMessageAndTraceFromError","getStatusFromError","ALLURE_REPORT_STEP_COMMAND","ALLURE_REPORT_SYSTEM_HOOK","getAllureTestPlan","getProjectDir","DEFAULT_RUNTIME_CONFIG","stepsFromCommands","maxArgumentLength","maxArgumentDepth","uint8ArrayToBase64","data","u8arrayLike","Array","isArray","buffer","btoa","String","fromCharCode","apply","getSuites","test","suites","s","parent","push","reverse","getSuitePath","filter","title","map","shouldCommandBeSkipped","command","_last","last","attributes","args","log","name","toReversed","arr","result","i","length","resolveSpecRelativePath","spec","projectDir","specPath","absolute","substring","relative","win","Cypress","platform","replaceAll","getNamesAndLabels","rawName","cleanTitle","labels","titlePath","slice","fullNameSuffix","concat","join","getTestStartData","_test$wallClockStarte","_objectSpread","start","wallClockStartedAt","getTime","Date","now","getTestStopData","_test$duration","_retries","duration","retries","getTestSkipData","statusDetails","message","applyTestPlan","root","testPlan","suite","iterateSuites","indicesToRemove","getIndicesOfDeselectedTests","tests","removeSortedIndices","resolveStatusWithDetails","error","status","PASSED","testReportedKey","Symbol","markTestAsReported","isTestReported","suiteStack","pop","iterateTests","isAllureHook","hook","includes","isRootAfterAllHook","hookName","includedInTestPlan","fullName","allureId","some","_test$id","id","toString","selector","forEach","index","_labels$find","find","_ref","ALLURE_ID","value","indices","splice"],"sources":["../../src/utils.ts"],"sourcesContent":["import { LabelName, Status } from \"allure-js-commons\";\nimport { extractMetadataFromString, getMessageAndTraceFromError, getStatusFromError } from \"allure-js-commons/sdk\";\nimport type { TestPlanV1 } from \"allure-js-commons/sdk\";\nimport { ALLURE_REPORT_STEP_COMMAND, ALLURE_REPORT_SYSTEM_HOOK } from \"./model.js\";\nimport type { CypressCommand, CypressHook, CypressSuite, CypressTest } from \"./model.js\";\nimport { getAllureTestPlan, getProjectDir } from \"./state.js\";\n\nexport const DEFAULT_RUNTIME_CONFIG = {\n stepsFromCommands: {\n maxArgumentLength: 128,\n maxArgumentDepth: 3,\n },\n};\n\nexport const uint8ArrayToBase64 = (data: unknown) => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (!u8arrayLike) {\n return data as string;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return btoa(String.fromCharCode.apply(null, data as number[]));\n};\n\nexport const getSuites = (test: CypressTest) => {\n const suites: CypressSuite[] = [];\n for (let s: CypressSuite | undefined = test.parent; s; s = s.parent) {\n suites.push(s);\n }\n suites.reverse();\n return suites;\n};\n\nexport const getSuitePath = (test: CypressTest): string[] =>\n getSuites(test)\n .filter((s) => s.title)\n .map((s) => s.title);\n\nexport const shouldCommandBeSkipped = (command: CypressCommand) => {\n if (last(command.attributes.args)?.log === false) {\n return true;\n }\n\n if (command.attributes.name === \"task\" && command.attributes.args[0] === \"reportAllureRuntimeMessages\") {\n return true;\n }\n\n // we don't need to report then commands because it's just a promise handle\n if (command.attributes.name === \"then\") {\n return true;\n }\n\n // we should skip artificial wrap from allure steps\n if (command.attributes.name === \"wrap\" && command.attributes.args[0] === ALLURE_REPORT_STEP_COMMAND) {\n return true;\n }\n\n return false;\n};\n\nexport const toReversed = <T = unknown>(arr: T[]): T[] => {\n const result: T[] = [];\n\n for (let i = arr.length - 1; i >= 0; i--) {\n result.push(arr[i]);\n }\n\n return result;\n};\n\nexport const last = <T = unknown>(arr: T[]): T | undefined => {\n return arr[arr.length - 1];\n};\n\nconst resolveSpecRelativePath = (spec: Cypress.Spec) => {\n const projectDir = getProjectDir();\n const specPath = projectDir ? spec.absolute.substring(projectDir.length + 1) : spec.relative;\n const win = Cypress.platform === \"win32\";\n return win ? specPath.replaceAll(\"\\\\\", \"/\") : specPath;\n};\n\nexport const getNamesAndLabels = (spec: Cypress.Spec, test: CypressTest) => {\n const rawName = test.title;\n const { cleanTitle: name, labels } = extractMetadataFromString(rawName);\n const suites = test.titlePath().slice(0, -1);\n const fullNameSuffix = `${[...suites, name].join(\" \")}`;\n return { name, labels, fullNameSuffix };\n};\n\nexport const getTestStartData = (test: CypressTest) => ({\n ...getNamesAndLabels(Cypress.spec, test),\n start: test.wallClockStartedAt?.getTime() || Date.now(),\n});\n\nexport const getTestStopData = (test: CypressTest) => ({\n duration: test.duration ?? 0,\n retries: (test as any)._retries ?? 0,\n});\n\nexport const getTestSkipData = () => ({\n statusDetails: { message: \"This is a pending test\" },\n});\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\nexport const resolveStatusWithDetails = (error: Error | undefined) =>\n error\n ? {\n status: getStatusFromError(error),\n statusDetails: getMessageAndTraceFromError(error),\n }\n : { status: Status.PASSED };\n\nconst testReportedKey = Symbol(\"The test was reported to Allure\");\n\nexport const markTestAsReported = (test: CypressTest) => {\n (test as any)[testReportedKey] = true;\n};\n\nexport const isTestReported = (test: CypressTest) => (test as any)[testReportedKey] === true;\n\nexport const 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\nexport const iterateTests = function* (parent: CypressSuite) {\n for (const suite of iterateSuites(parent)) {\n yield* suite.tests;\n }\n};\n\nexport const isAllureHook = (hook: CypressHook) => hook.title.includes(ALLURE_REPORT_SYSTEM_HOOK);\n\nexport const isRootAfterAllHook = (hook: CypressHook) => hook.parent!.root && hook.hookName === \"after all\";\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\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 } = getNamesAndLabels(spec, 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"],"mappings":";;;;;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,mBAAmB;AACrD,SAASC,yBAAyB,EAAEC,2BAA2B,EAAEC,kBAAkB,QAAQ,uBAAuB;AAElH,SAASC,0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EAAExB,IAAI,CAAC;IAChE,IAAMqF,QAAQ,MAAA5C,MAAA,CAAMf,QAAQ,OAAAe,MAAA,CAAID,cAAc,CAAE;IAChD,IAAM8C,QAAQ,IAAAQ,YAAA,GAAGzD,MAAM,CAAC0D,IAAI,CAACC,IAAA;MAAA,IAAC;QAAE/E;MAAK,CAAC,GAAA+E,IAAA;MAAA,OAAK/E,IAAI,KAAKzC,SAAS,CAACyH,SAAS;IAAA,EAAC,cAAAH,YAAA,uBAAvDA,YAAA,CAAyDI,KAAK;IAE/E,IAAI,CAACd,kBAAkB,CAACvB,QAAQ,EAAEwB,QAAQ,EAAEC,QAAQ,CAAC,EAAE;MACrDtB,eAAe,CAAC5D,IAAI,CAACyF,KAAK,CAAC;IAC7B;EACF,CAAC,CAAC;EACF,OAAO7B,eAAe;AACxB,CAAC;AAED,IAAMG,mBAAmB,GAAGA,CAAIhD,GAAQ,EAAEgF,OAA0B,KAAK;EACvE,KAAK,IAAI9E,CAAC,GAAG8E,OAAO,CAAC7E,MAAM,GAAG,CAAC,EAAED,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC5CF,GAAG,CAACiF,MAAM,CAACD,OAAO,CAAC9E,CAAC,CAAC,EAAE,CAAC,CAAC;EAC3B;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":["DEFAULT_RUNTIME_CONFIG","stepsFromCommands","maxArgumentLength","maxArgumentDepth","popUntilFindIncluded","items","pred","index","findIndex","toReversed","splice","arr","len","length","result","Array","i","last","isDefined","value"],"sources":["../../src/utils.ts"],"sourcesContent":["export const DEFAULT_RUNTIME_CONFIG = {\n stepsFromCommands: {\n maxArgumentLength: 128,\n maxArgumentDepth: 3,\n },\n};\n\n/**\n * Pops items from an array into a new one. The item that matches the predicate is the last item to pop.\n * If there is no such item in the array, the array is left unmodified.\n * @param items An array to pop the items from.\n * @param pred A predicate that defines the last item to pop.\n * @returns An array of popped items. The first popped item becomes the first element of this array.\n */\nexport const popUntilFindIncluded = <T>(items: T[], pred: (value: T) => boolean) => {\n const index = items.findIndex(pred);\n return index !== -1 ? toReversed(items.splice(index)) : [];\n};\n\nexport const toReversed = <T = unknown>(arr: T[]): T[] => {\n const len = arr.length;\n const result: T[] = new Array(len);\n\n for (let i = 0; i < len; i++) {\n result[len - i - 1] = arr[i];\n }\n\n return result;\n};\n\nexport const last = <T = unknown>(arr: T[]): T | undefined => {\n return arr[arr.length - 1];\n};\n\nexport const isDefined = <T>(value: T | undefined): value is T => typeof value !== \"undefined\";\n"],"mappings":"AAAA,OAAO,IAAMA,sBAAsB,GAAG;EACpCC,iBAAiB,EAAE;IACjBC,iBAAiB,EAAE,GAAG;IACtBC,gBAAgB,EAAE;EACpB;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,oBAAoB,GAAGA,CAAIC,KAAU,EAAEC,IAA2B,KAAK;EAClF,IAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAACF,IAAI,CAAC;EACnC,OAAOC,KAAK,KAAK,CAAC,CAAC,GAAGE,UAAU,CAACJ,KAAK,CAACK,MAAM,CAACH,KAAK,CAAC,CAAC,GAAG,EAAE;AAC5D,CAAC;AAED,OAAO,IAAME,UAAU,GAAiBE,GAAQ,IAAU;EACxD,IAAMC,GAAG,GAAGD,GAAG,CAACE,MAAM;EACtB,IAAMC,MAAW,GAAG,IAAIC,KAAK,CAACH,GAAG,CAAC;EAElC,KAAK,IAAII,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,GAAG,EAAEI,CAAC,EAAE,EAAE;IAC5BF,MAAM,CAACF,GAAG,GAAGI,CAAC,GAAG,CAAC,CAAC,GAAGL,GAAG,CAACK,CAAC,CAAC;EAC9B;EAEA,OAAOF,MAAM;AACf,CAAC;AAED,OAAO,IAAMG,IAAI,GAAiBN,GAAQ,IAAoB;EAC5D,OAAOA,GAAG,CAACA,GAAG,CAACE,MAAM,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,OAAO,IAAMK,SAAS,GAAOC,KAAoB,IAAiB,OAAOA,KAAK,KAAK,WAAW","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import type { CypressLogEntry } from "../types.js";
2
+ export declare const shouldCreateStepFromCommandLogEntry: (entry: CypressLogEntry) => boolean;
3
+ /**
4
+ * Checks if the current step represents a cy.screenshot command log entry. If this is the case, associates the name
5
+ * of the screenshot with the step. Later, that will allow converting the step with the attachment into the attachment
6
+ * step.
7
+ */
8
+ export declare const setupScreenshotAttachmentStep: (originalName: string | undefined, name: string) => void;
9
+ export declare const startCommandLogStep: (entry: CypressLogEntry) => void;
10
+ export declare const stopCommandLogStep: (entryId: string) => void;
@@ -0,0 +1,2 @@
1
+ export declare const registerCypressEventListeners: () => Cypress.Cypress;
2
+ export declare const enableReportingOfCypressScreenshots: () => void;
@@ -0,0 +1,2 @@
1
+ export declare const enableAllure: () => void;
2
+ export { enableReportingOfCypressScreenshots } from "./cypress.js";
@@ -0,0 +1,3 @@
1
+ export declare const ALLURE_REPORT_SYSTEM_HOOK = "__allure_report_system_hook__";
2
+ export declare const registerMochaEventListeners: () => void;
3
+ export declare const injectFlushMessageHooks: () => void;
@@ -0,0 +1 @@
1
+ export declare const initializeAllure: () => void;
@@ -0,0 +1,22 @@
1
+ import { Status } from "allure-js-commons";
2
+ import type { StatusDetails } from "allure-js-commons";
3
+ import type { CypressHook, CypressSuite, CypressTest, StepDescriptor } from "../types.js";
4
+ export declare const reportRunStart: () => void;
5
+ export declare const reportSuiteStart: (suite: CypressSuite) => void;
6
+ export declare const reportSuiteEnd: (suite: CypressSuite) => void;
7
+ export declare const reportHookStart: (hook: CypressHook, start?: number) => void;
8
+ export declare const reportHookEnd: (hook: CypressHook) => void;
9
+ export declare const reportTestStart: (test: CypressTest) => void;
10
+ export declare const reportStepStart: (id: string, name: string) => void;
11
+ export declare const reportStepStop: (step: StepDescriptor, status?: Status, statusDetails?: StatusDetails) => void;
12
+ export declare const reportTestPass: () => void;
13
+ export declare const reportTestOrHookFail: (err: Error) => void;
14
+ export declare const completeHookErrorReporting: (hook: CypressHook, err: Error) => void;
15
+ export declare const reportTestSkip: (test: CypressTest) => void;
16
+ export declare const reportTestEnd: (test: CypressTest) => void;
17
+ export declare const reportScreenshot: (path: string, name: string) => void;
18
+ export declare const completeSpecIfNoAfterHookLeft: (context: Mocha.Context) => Cypress.Chainable<unknown> | undefined;
19
+ export declare const completeSpecOnAfterHookFailure: (context: Mocha.Context, hookError: Error) => Cypress.Chainable<unknown> | undefined;
20
+ export declare const throwAfterSpecCompletion: (context: Mocha.Context, err: any) => void;
21
+ export declare const flushRuntimeMessages: () => void;
22
+ export declare const completeSpecAsync: () => Cypress.Chainable<unknown> | undefined;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Patches the `after` function, to inject reporting of spec-level
3
+ * `after` hooks defined by the user.
4
+ */
5
+ export declare const enableScopeLevelAfterHookReporting: () => void;
@@ -0,0 +1,26 @@
1
+ import { Status } from "allure-js-commons";
2
+ import type { AttachmentOptions, Label, Link, ParameterMode, ParameterOptions } from "allure-js-commons";
3
+ import type { TestRuntime } from "allure-js-commons/sdk/runtime";
4
+ export declare const initTestRuntime: () => void;
5
+ export declare const getTestRuntime: () => AllureCypressTestRuntime;
6
+ declare class AllureCypressTestRuntime implements TestRuntime {
7
+ #private;
8
+ constructor();
9
+ labels(...labels: Label[]): PromiseLike<void>;
10
+ links(...links: Link[]): PromiseLike<void>;
11
+ parameter(name: string, value: string, options?: ParameterOptions): PromiseLike<void>;
12
+ description(markdown: string): PromiseLike<void>;
13
+ descriptionHtml(html: string): PromiseLike<void>;
14
+ displayName(name: string): PromiseLike<void>;
15
+ historyId(value: string): PromiseLike<void>;
16
+ testCaseId(value: string): PromiseLike<void>;
17
+ attachment(name: string, content: string, options: AttachmentOptions): PromiseLike<void>;
18
+ attachmentFromPath(name: string, path: string, options: Omit<AttachmentOptions, "encoding">): PromiseLike<void>;
19
+ logStep(name: string, status?: Status, error?: Error): Cypress.Chainable<void>;
20
+ step<T = void>(name: string, body: () => T | PromiseLike<T>): Cypress.ThenReturn<T, T>;
21
+ stepDisplayName(name: string): PromiseLike<void>;
22
+ stepParameter(name: string, value: string, mode?: ParameterMode): PromiseLike<void>;
23
+ flushAllureMessagesToTask(taskName: string): void;
24
+ flushAllureMessagesToTaskAsync(taskName: string): Cypress.Chainable<unknown> | undefined;
25
+ }
26
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: (value: unknown) => string;
2
+ export default _default;
@@ -1,4 +1,4 @@
1
- import type { AllureSpecState, CypressMessage, CypressTest } from "./model.js";
1
+ import type { AllureSpecState, CypressMessage, CypressTest, StepDescriptor, StepFinalizer } from "../types.js";
2
2
  export declare const getAllureState: () => AllureSpecState;
3
3
  export declare const isAllureInitialized: () => boolean;
4
4
  export declare const setAllureInitialized: () => void;
@@ -16,3 +16,13 @@ export declare const getConfig: () => {
16
16
  maxArgumentDepth: number;
17
17
  };
18
18
  };
19
+ export declare const getStepStack: () => StepDescriptor[];
20
+ export declare const getCurrentStep: () => StepDescriptor | undefined;
21
+ export declare const pushStep: (step: StepDescriptor) => number;
22
+ export declare const popStep: () => StepDescriptor | undefined;
23
+ export declare const popSteps: (index: number) => StepDescriptor[];
24
+ export declare const popAllSteps: () => StepDescriptor[];
25
+ export declare const clearStepStack: () => void;
26
+ export declare const setupStepFinalization: <T extends StepDescriptor>(step: T, finalizer?: StepFinalizer) => number;
27
+ export declare const getStepsToFinalize: () => [step: StepDescriptor, finalizer: StepFinalizer | undefined][];
28
+ export declare const clearStepsToFinalize: () => void;
@@ -0,0 +1,14 @@
1
+ import type { StatusDetails } from "allure-js-commons";
2
+ import { Status } from "allure-js-commons";
3
+ import type { ApiStepDescriptor, LogStepDescriptor, StepDescriptor } from "../types.js";
4
+ export declare const ALLURE_STEP_CMD_SUBJECT: {};
5
+ export declare const isApiStep: (descriptor: StepDescriptor) => descriptor is ApiStepDescriptor;
6
+ export declare const isLogStep: (descriptor: StepDescriptor) => descriptor is LogStepDescriptor;
7
+ export declare const startAllureApiStep: (name: string) => void;
8
+ export declare const pushAllureStep: () => string;
9
+ export declare const reportStepError: (error: Error) => void;
10
+ export declare const stopCurrentAllureApiStep: (status?: Status, statusDetails?: StatusDetails) => void;
11
+ export declare const findAndStopStepWithSubsteps: (pred: (stepEntry: StepDescriptor) => boolean, status?: Status, statusDetails?: StatusDetails) => void;
12
+ export declare const stopAllSteps: (status?: Status, statusDetails?: StatusDetails) => void;
13
+ export declare const finalizeSteps: () => void;
14
+ export declare const resolveStepStatus: (step: StepDescriptor) => Status;
@@ -0,0 +1,2 @@
1
+ import type { CypressSuite } from "../types.js";
2
+ export declare const applyTestPlan: (spec: Cypress.Spec, root: CypressSuite) => void;
@@ -0,0 +1,52 @@
1
+ import { Status } from "allure-js-commons";
2
+ import type { StatusDetails } from "allure-js-commons";
3
+ import type { CypressHook, CypressSuite, CypressTest, StepDescriptor } from "../types.js";
4
+ export declare const getFileNameFromPath: (path: string) => string;
5
+ export declare const resolveSpecRelativePath: (spec: Cypress.Spec) => string;
6
+ export declare const uint8ArrayToBase64: (data: unknown) => string;
7
+ export declare const getTestStartData: (test: CypressTest) => {
8
+ start: number;
9
+ name: string;
10
+ labels: import("allure-js-commons").Label[];
11
+ fullNameSuffix: string;
12
+ };
13
+ export declare const getTestStopData: (test: CypressTest) => {
14
+ duration: number;
15
+ retries: any;
16
+ };
17
+ export declare const getTestSkipData: () => {
18
+ statusDetails: {
19
+ message: string;
20
+ };
21
+ };
22
+ export declare const getStepStopData: (step: StepDescriptor, status?: Status, statusDetails?: StatusDetails) => {
23
+ id: string;
24
+ status: Status;
25
+ statusDetails?: StatusDetails | undefined;
26
+ stop: number;
27
+ };
28
+ export declare const markTestAsReported: (test: CypressTest) => void;
29
+ export declare const isTestReported: (test: CypressTest) => boolean;
30
+ export declare const iterateSuites: (parent: CypressSuite) => Generator<CypressSuite, void, unknown>;
31
+ export declare const iterateTests: (parent: CypressSuite) => Generator<Mocha.Test & {
32
+ wallClockStartedAt?: Date | undefined;
33
+ parent: CypressSuite | undefined;
34
+ }, void, undefined>;
35
+ export declare const getSuitePath: (test: CypressTest) => CypressSuite[];
36
+ export declare const getSuiteTitlePath: (test: CypressTest) => string[];
37
+ export declare const generateApiStepId: () => string;
38
+ export declare const getNamesAndLabels: (spec: Cypress.Spec, test: CypressTest) => {
39
+ name: string;
40
+ labels: import("allure-js-commons").Label[];
41
+ fullNameSuffix: string;
42
+ };
43
+ export declare const isAllureHook: (hook: CypressHook) => boolean;
44
+ export declare const isRootAfterAllHook: (hook: CypressHook) => boolean;
45
+ export declare const isLastRootAfterHook: (context: Mocha.Context) => boolean;
46
+ export declare const getStatusDataOfTestSkippedByHookError: (hookTitle: string, isEachHook: boolean, err: Error, suite: CypressSuite) => {
47
+ status: Status;
48
+ statusDetails: {
49
+ message: string | undefined;
50
+ trace: string | undefined;
51
+ };
52
+ };
@@ -1,6 +1,6 @@
1
1
  import type Cypress from "cypress";
2
2
  import { ReporterRuntime } from "allure-js-commons/sdk/reporter";
3
- import type { AllureCypressConfig, SpecContext } from "./model.js";
3
+ import type { AllureCypressConfig, SpecContext } from "./types.js";
4
4
  export declare class AllureCypress {
5
5
  #private;
6
6
  allureRuntime: ReporterRuntime;
@@ -1,8 +1,6 @@
1
- import type { Label, Status, StatusDetails } from "allure-js-commons";
2
- import type { RuntimeMessage, TestPlanV1 } from "allure-js-commons/sdk";
1
+ import type { Label, Parameter, Status, StatusDetails } from "allure-js-commons";
2
+ import type { RuntimeMessage, RuntimeStartStepMessage, RuntimeStopStepMessage, TestPlanV1 } from "allure-js-commons/sdk";
3
3
  import type { ReporterConfig } from "allure-js-commons/sdk/reporter";
4
- export declare const ALLURE_REPORT_SYSTEM_HOOK = "__allure_report_system_hook__";
5
- export declare const ALLURE_REPORT_STEP_COMMAND = "__allure_report_step_command__";
6
4
  export type AllureCypressConfig = ReporterConfig & {
7
5
  videoOnFailOnly?: boolean;
8
6
  stepsFromCommands?: Partial<AllureSpecState["config"]["stepsFromCommands"]>;
@@ -30,6 +28,30 @@ export type CypressCommand = {
30
28
  };
31
29
  state: "passed" | "failed" | "queued";
32
30
  };
31
+ export type CypressLogEntry = ReturnType<typeof Cypress.log> & {
32
+ attributes: {
33
+ id: string;
34
+ error?: Error;
35
+ name: string;
36
+ message: string;
37
+ displayName?: string;
38
+ event: boolean;
39
+ type: string;
40
+ instrument: string;
41
+ groupStart: boolean;
42
+ createdAtTimestamp: number;
43
+ updatedAtTimestamp: number;
44
+ end?: boolean;
45
+ renderProps: () => {
46
+ message: string;
47
+ };
48
+ consoleProps: () => {
49
+ name: string;
50
+ props: Record<string, unknown>;
51
+ };
52
+ };
53
+ endGroup: () => unknown;
54
+ };
33
55
  export type CupressRunStart = {
34
56
  type: "cypress_run_start";
35
57
  data: object;
@@ -104,28 +126,38 @@ export type CypressTestEndMessage = {
104
126
  retries: number;
105
127
  };
106
128
  };
107
- export type CypressCommandStartMessage = {
108
- type: "cypress_command_start";
129
+ export type CypressStepStartMessage = {
130
+ type: "cypress_step_start";
109
131
  data: {
132
+ id: string;
110
133
  name: string;
111
- args: string[];
112
134
  start: number;
113
135
  };
114
136
  };
115
- export type CypressCommandEndMessage = {
116
- type: "cypress_command_end";
137
+ export type CypressStepStopMessage = {
138
+ type: "cypress_step_stop";
117
139
  data: {
140
+ id: string;
118
141
  status: Status;
119
142
  statusDetails?: StatusDetails;
120
143
  stop: number;
121
144
  };
122
145
  };
123
- export type CypressMessage = RuntimeMessage | CupressRunStart | CypressSuiteStartMessage | CypressSuiteEndMessage | CypressHookStartMessage | CypressHookEndMessage | CypressTestStartMessage | CypressCommandStartMessage | CypressCommandEndMessage | CypressTestPassMessage | CypressFailMessage | CypressTestSkipMessage | CypressSkippedTestMessage | CypressTestEndMessage;
146
+ export type CypressStepFinalizeMessage = {
147
+ type: "cypress_step_finalize";
148
+ data: {
149
+ id: string;
150
+ name?: string;
151
+ parameters?: Parameter[];
152
+ statusDetails?: StatusDetails;
153
+ };
154
+ };
155
+ export type CypressMessage = Exclude<RuntimeMessage, RuntimeStartStepMessage | RuntimeStopStepMessage> | CupressRunStart | CypressSuiteStartMessage | CypressSuiteEndMessage | CypressHookStartMessage | CypressHookEndMessage | CypressTestStartMessage | CypressStepStartMessage | CypressStepStopMessage | CypressStepFinalizeMessage | CypressTestPassMessage | CypressFailMessage | CypressTestSkipMessage | CypressSkippedTestMessage | CypressTestEndMessage;
124
156
  export type SpecContext = {
125
157
  specPath: string;
126
158
  test: string | undefined;
127
159
  fixture: string | undefined;
128
- commandSteps: string[];
160
+ stepsByFrontEndId: Map<string, string>;
129
161
  videoScope: string;
130
162
  suiteIdToScope: Map<string, string>;
131
163
  suiteScopeToId: Map<string, string>;
@@ -134,6 +166,20 @@ export type SpecContext = {
134
166
  suiteNames: string[];
135
167
  failed: boolean;
136
168
  };
169
+ type StepDescriptorBase = {
170
+ id: string;
171
+ error?: Error;
172
+ };
173
+ export type LogStepDescriptor = StepDescriptorBase & {
174
+ type: "log";
175
+ attachmentName?: string;
176
+ log: CypressLogEntry;
177
+ };
178
+ export type ApiStepDescriptor = StepDescriptorBase & {
179
+ type: "api";
180
+ };
181
+ export type StepDescriptor = LogStepDescriptor | ApiStepDescriptor;
182
+ export type StepFinalizer = (message: CypressStepFinalizeMessage["data"]) => void;
137
183
  export type AllureSpecState = {
138
184
  config: {
139
185
  stepsFromCommands: {
@@ -146,6 +192,9 @@ export type AllureSpecState = {
146
192
  projectDir?: string;
147
193
  messages: CypressMessage[];
148
194
  currentTest?: CypressTest;
195
+ stepStack: StepDescriptor[];
196
+ stepsToFinalize: [step: StepDescriptor, finalizer: StepFinalizer | undefined][];
197
+ nextApiStepId: number;
149
198
  };
150
199
  export type AllureCypressTaskArgs = {
151
200
  absolutePath: string;
@@ -155,3 +204,4 @@ export type AllureCypressTaskArgs = {
155
204
  export type CypressSuiteFunction = (title: string, configOrFn?: Cypress.SuiteConfigOverrides | ((this: Mocha.Suite) => void), fn?: (this: Mocha.Suite) => void) => Mocha.Suite;
156
205
  export type DirectHookImplementation = Mocha.AsyncFunc | ((this: Mocha.Context) => void);
157
206
  export type HookImplementation = Mocha.Func | DirectHookImplementation;
207
+ export {};
@@ -1,51 +1,17 @@
1
- import { Status } from "allure-js-commons";
2
- import type { CypressCommand, CypressHook, CypressSuite, CypressTest } from "./model.js";
3
1
  export declare const DEFAULT_RUNTIME_CONFIG: {
4
2
  stepsFromCommands: {
5
3
  maxArgumentLength: number;
6
4
  maxArgumentDepth: number;
7
5
  };
8
6
  };
9
- export declare const uint8ArrayToBase64: (data: unknown) => string;
10
- export declare const getSuites: (test: CypressTest) => CypressSuite[];
11
- export declare const getSuitePath: (test: CypressTest) => string[];
12
- export declare const shouldCommandBeSkipped: (command: CypressCommand) => boolean;
7
+ /**
8
+ * Pops items from an array into a new one. The item that matches the predicate is the last item to pop.
9
+ * If there is no such item in the array, the array is left unmodified.
10
+ * @param items An array to pop the items from.
11
+ * @param pred A predicate that defines the last item to pop.
12
+ * @returns An array of popped items. The first popped item becomes the first element of this array.
13
+ */
14
+ export declare const popUntilFindIncluded: <T>(items: T[], pred: (value: T) => boolean) => T[];
13
15
  export declare const toReversed: <T = unknown>(arr: T[]) => T[];
14
16
  export declare const last: <T = unknown>(arr: T[]) => T | undefined;
15
- export declare const getNamesAndLabels: (spec: Cypress.Spec, test: CypressTest) => {
16
- name: string;
17
- labels: import("allure-js-commons").Label[];
18
- fullNameSuffix: string;
19
- };
20
- export declare const getTestStartData: (test: CypressTest) => {
21
- start: number;
22
- name: string;
23
- labels: import("allure-js-commons").Label[];
24
- fullNameSuffix: string;
25
- };
26
- export declare const getTestStopData: (test: CypressTest) => {
27
- duration: number;
28
- retries: any;
29
- };
30
- export declare const getTestSkipData: () => {
31
- statusDetails: {
32
- message: string;
33
- };
34
- };
35
- export declare const applyTestPlan: (spec: Cypress.Spec, root: CypressSuite) => void;
36
- export declare const resolveStatusWithDetails: (error: Error | undefined) => {
37
- status: Status;
38
- statusDetails: Pick<import("allure-js-commons").StatusDetails, "message" | "trace">;
39
- } | {
40
- status: Status;
41
- statusDetails?: undefined;
42
- };
43
- export declare const markTestAsReported: (test: CypressTest) => void;
44
- export declare const isTestReported: (test: CypressTest) => boolean;
45
- export declare const iterateSuites: (parent: CypressSuite) => Generator<CypressSuite, void, unknown>;
46
- export declare const iterateTests: (parent: CypressSuite) => Generator<Mocha.Test & {
47
- wallClockStartedAt?: Date | undefined;
48
- parent: CypressSuite | undefined;
49
- }, void, undefined>;
50
- export declare const isAllureHook: (hook: CypressHook) => boolean;
51
- export declare const isRootAfterAllHook: (hook: CypressHook) => boolean;
17
+ export declare const isDefined: <T>(value: T | undefined) => value is T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allure-cypress",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "description": "Allure Cypress integration",
5
5
  "keywords": [
6
6
  "allure",
@@ -25,14 +25,14 @@
25
25
  "author": "Qameta Software <allure@qameta.io> (https://qameta.io/)",
26
26
  "exports": {
27
27
  ".": {
28
+ "types": "./dist/types/index.d.ts",
28
29
  "import": "./dist/esm/index.js",
29
- "require": "./dist/cjs/index.js",
30
- "types": "./dist/types/index.d.ts"
30
+ "require": "./dist/cjs/index.js"
31
31
  },
32
32
  "./reporter": {
33
+ "types": "./dist/types/reporter.d.ts",
33
34
  "import": "./dist/esm/reporter.js",
34
- "require": "./dist/cjs/reporter.js",
35
- "types": "./dist/types/reporter.d.ts"
35
+ "require": "./dist/cjs/reporter.js"
36
36
  }
37
37
  },
38
38
  "main": "./dist/cjs/index.js",
@@ -60,7 +60,7 @@
60
60
  "test": "vitest run"
61
61
  },
62
62
  "dependencies": {
63
- "allure-js-commons": "3.0.6"
63
+ "allure-js-commons": "3.0.7"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@babel/cli": "^7.24.6",
@@ -76,7 +76,7 @@
76
76
  "@typescript-eslint/eslint-plugin": "^8.0.0",
77
77
  "@typescript-eslint/parser": "^8.0.0",
78
78
  "allure-commandline": "^2.29.0",
79
- "allure-vitest": "3.0.6",
79
+ "allure-vitest": "3.0.7",
80
80
  "babel-plugin-add-module-exports": "^1.0.4",
81
81
  "cypress": "^13.12.0",
82
82
  "esbuild": "^0.24.0",
@@ -91,7 +91,7 @@
91
91
  "npm-run-all2": "^7.0.0",
92
92
  "rimraf": "^6.0.0",
93
93
  "typescript": "^5.2.2",
94
- "vitest": "^1.6.0"
94
+ "vitest": "^2.1.5"
95
95
  },
96
96
  "peerDependencies": {
97
97
  "cypress": ">=12.17.4"
package/dist/cjs/model.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ALLURE_REPORT_SYSTEM_HOOK = exports.ALLURE_REPORT_STEP_COMMAND = void 0;
7
- var ALLURE_REPORT_SYSTEM_HOOK = exports.ALLURE_REPORT_SYSTEM_HOOK = "__allure_report_system_hook__";
8
- var ALLURE_REPORT_STEP_COMMAND = exports.ALLURE_REPORT_STEP_COMMAND = "__allure_report_step_command__";
9
- //# sourceMappingURL=model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.js","names":["ALLURE_REPORT_SYSTEM_HOOK","exports","ALLURE_REPORT_STEP_COMMAND"],"sources":["../../src/model.ts"],"sourcesContent":["import type { Label, Status, StatusDetails } from \"allure-js-commons\";\nimport type { RuntimeMessage, TestPlanV1 } from \"allure-js-commons/sdk\";\nimport type { ReporterConfig } from \"allure-js-commons/sdk/reporter\";\n\nexport const ALLURE_REPORT_SYSTEM_HOOK = \"__allure_report_system_hook__\";\n\nexport const ALLURE_REPORT_STEP_COMMAND = \"__allure_report_step_command__\";\n\nexport type AllureCypressConfig = ReporterConfig & {\n videoOnFailOnly?: boolean;\n stepsFromCommands?: Partial<AllureSpecState[\"config\"][\"stepsFromCommands\"]>;\n};\n\nexport type CypressSuite = Mocha.Suite & {\n id: string;\n parent: CypressSuite | undefined;\n tests: CypressTest[];\n suites: CypressSuite[];\n};\n\nexport type CypressTest = Mocha.Test & {\n wallClockStartedAt?: Date;\n parent: CypressSuite | undefined;\n};\n\nexport type CypressHook = Mocha.Hook & {\n hookId: string;\n hookName: string;\n parent: CypressSuite | undefined;\n};\n\nexport type CypressCommand = {\n attributes: {\n name: string;\n id: string;\n args: any[];\n };\n state: \"passed\" | \"failed\" | \"queued\";\n};\n\nexport type CupressRunStart = {\n type: \"cypress_run_start\";\n data: object;\n};\n\nexport type CypressSuiteStartMessage = {\n type: \"cypress_suite_start\";\n data: {\n id: string;\n name: string;\n root: boolean;\n start: number;\n };\n};\n\nexport type CypressSuiteEndMessage = {\n type: \"cypress_suite_end\";\n data: {\n root: boolean;\n stop: number;\n };\n};\n\nexport type CypressHookStartMessage = {\n type: \"cypress_hook_start\";\n data: {\n name: string;\n scopeType: \"each\" | \"all\";\n position: \"before\" | \"after\";\n start: number;\n };\n};\n\nexport type CypressHookEndMessage = {\n type: \"cypress_hook_end\";\n data: {\n duration: number;\n };\n};\n\nexport type CypressTestStartMessage = {\n type: \"cypress_test_start\";\n data: {\n name: string;\n fullNameSuffix: string;\n start: number;\n labels: Label[];\n };\n};\n\nexport type CypressFailMessage = {\n type: \"cypress_fail\";\n data: {\n status: Status;\n statusDetails: StatusDetails;\n };\n};\n\nexport type CypressTestSkipMessage = {\n type: \"cypress_test_skip\";\n data: {\n statusDetails?: StatusDetails;\n };\n};\n\nexport type CypressTestPassMessage = {\n type: \"cypress_test_pass\";\n data: object;\n};\n\nexport type CypressSkippedTestMessage = {\n type: \"cypress_skipped_test\";\n data: CypressTestStartMessage[\"data\"] &\n CypressFailMessage[\"data\"] &\n CypressTestEndMessage[\"data\"] & {\n suites: string[];\n };\n};\n\nexport type CypressTestEndMessage = {\n type: \"cypress_test_end\";\n data: {\n duration: number;\n retries: number;\n };\n};\n\nexport type CypressCommandStartMessage = {\n type: \"cypress_command_start\";\n data: {\n name: string;\n args: string[];\n start: number;\n };\n};\n\nexport type CypressCommandEndMessage = {\n type: \"cypress_command_end\";\n data: {\n status: Status;\n statusDetails?: StatusDetails;\n stop: number;\n };\n};\n\nexport type CypressMessage =\n | RuntimeMessage\n | CupressRunStart\n | CypressSuiteStartMessage\n | CypressSuiteEndMessage\n | CypressHookStartMessage\n | CypressHookEndMessage\n | CypressTestStartMessage\n | CypressCommandStartMessage\n | CypressCommandEndMessage\n | CypressTestPassMessage\n | CypressFailMessage\n | CypressTestSkipMessage\n | CypressSkippedTestMessage\n | CypressTestEndMessage;\n\nexport type SpecContext = {\n specPath: string;\n test: string | undefined;\n fixture: string | undefined;\n commandSteps: string[];\n videoScope: string;\n suiteIdToScope: Map<string, string>;\n suiteScopeToId: Map<string, string>;\n suiteScopes: string[];\n testScope: string | undefined;\n suiteNames: string[];\n failed: boolean;\n};\n\nexport type AllureSpecState = {\n config: {\n stepsFromCommands: {\n maxArgumentLength: number;\n maxArgumentDepth: number;\n };\n };\n initialized: boolean;\n testPlan: TestPlanV1 | null | undefined;\n projectDir?: string;\n messages: CypressMessage[];\n currentTest?: CypressTest;\n};\n\nexport type AllureCypressTaskArgs = {\n absolutePath: string;\n messages: readonly CypressMessage[];\n isInteractive: boolean;\n};\n\nexport type CypressSuiteFunction = (\n title: string,\n configOrFn?: Cypress.SuiteConfigOverrides | ((this: Mocha.Suite) => void),\n fn?: (this: Mocha.Suite) => void,\n) => Mocha.Suite;\n\nexport type DirectHookImplementation = Mocha.AsyncFunc | ((this: Mocha.Context) => void);\nexport type HookImplementation = Mocha.Func | DirectHookImplementation;\n"],"mappings":";;;;;;AAIO,IAAMA,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,GAAG,+BAA+B;AAEjE,IAAME,0BAA0B,GAAAD,OAAA,CAAAC,0BAAA,GAAG,gCAAgC","ignoreList":[]}