diff --git a/packages/core/src/store/convert.ts b/packages/core/src/store/convert.ts index c3a9a3f36..27c98aa5c 100644 --- a/packages/core/src/store/convert.ts +++ b/packages/core/src/store/convert.ts @@ -277,7 +277,7 @@ const convertStep = ( stepId: md5(`${step.name}${step.start}`), name: step.name ?? __unknown, status: step.status ?? defaultStatus, - steps: convertSteps(stateData, step.steps), + steps: subSteps, parameters: convertParameters(step.parameters), ...processTimings(step), type: "step", diff --git a/packages/core/test/store/convert.test.ts b/packages/core/test/store/convert.test.ts index ed287129b..3c0df4f8f 100644 --- a/packages/core/test/store/convert.test.ts +++ b/packages/core/test/store/convert.test.ts @@ -1,6 +1,6 @@ import { md5 } from "@allurereport/plugin-api"; -import { attachment, step } from "allure-js-commons"; -import { beforeEach, describe, expect, it } from "vitest"; +import { attachment, issue, step } from "allure-js-commons"; +import { beforeEach, describe, expect, it, vi } from "vitest"; import type { StateData } from "../../src/store/convert.js"; import { testResultRawToState } from "../../src/store/convert.js"; @@ -180,4 +180,30 @@ describe("testResultRawToState", () => { }, }); }); + + describe("a converted step attachment", () => { + it("should match a visited link", async () => { + await issue("171"); + const visitAttachmentLink = vi.fn(); + + const result = await functionUnderTest( + { ...emptyStateData, visitAttachmentLink }, + { steps: [{ type: "step", steps: [{ type: "attachment", originalFileName: "some-file.txt" }] }] }, + { readerId }, + ); + + const { id } = visitAttachmentLink.mock.calls[0][0]; + expect(result.steps).toMatchObject([ + { + type: "step", + steps: [ + { + type: "attachment", + link: { id }, + }, + ], + }, + ]); + }); + }); }); diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts index e633e1abb..ff2872eab 100644 --- a/packages/core/vitest.config.ts +++ b/packages/core/vitest.config.ts @@ -11,7 +11,16 @@ export default defineConfig({ "default", [ "allure-vitest/reporter", - { resultsDir: "./out/allure-results", globalLabels: [{ name: "module", value: "core" }] }, + { + resultsDir: "./out/allure-results", + globalLabels: [{ name: "module", value: "core" }], + links: { + issue: { + urlTemplate: "https://github.com/allure-framework/allure3/issues/%s", + nameTemplate: "Issue %s", + }, + }, + }, ], ], },