diff --git a/.pnp.cjs b/.pnp.cjs index e704b147c..84681f018 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -3967,7 +3967,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["chai", "npm:4.3.8"],\ ["chai-like", "virtual:606d5fd11adc18cba076ddb26a9b3adaf466a45eef985b60ea990c3ead5fe6bcc20990b0ed8d0763c4a8c861cdc2277964415bf12191df7c6923d8e78816abf5#npm:1.1.1"],\ ["chai-things", "npm:0.2.0"],\ - ["chromedriver", "npm:114.0.3"],\ + ["chromedriver", "npm:120.0.1"],\ ["codecov", "npm:3.8.2"],\ ["download-chromium", "npm:3.0.0"],\ ["eslint", "npm:8.49.0"],\ @@ -5863,10 +5863,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["chromedriver", [\ - ["npm:114.0.3", {\ - "packageLocation": "./.yarn/unplugged/chromedriver-npm-114.0.3-71185e4637/node_modules/chromedriver/",\ + ["npm:120.0.1", {\ + "packageLocation": "./.yarn/unplugged/chromedriver-npm-120.0.1-5544a83bc3/node_modules/chromedriver/",\ "packageDependencies": [\ - ["chromedriver", "npm:114.0.3"],\ + ["chromedriver", "npm:120.0.1"],\ ["@testim/chrome-version", "npm:1.1.4"],\ ["axios", "npm:1.6.5"],\ ["compare-versions", "npm:6.1.0"],\ diff --git a/.yarn/cache/chromedriver-npm-114.0.3-71185e4637-a7e5f5f686.zip b/.yarn/cache/chromedriver-npm-114.0.3-71185e4637-a7e5f5f686.zip deleted file mode 100644 index 303073c2f..000000000 Binary files a/.yarn/cache/chromedriver-npm-114.0.3-71185e4637-a7e5f5f686.zip and /dev/null differ diff --git a/.yarn/cache/chromedriver-npm-120.0.1-5544a83bc3-7498e9c625.zip b/.yarn/cache/chromedriver-npm-120.0.1-5544a83bc3-7498e9c625.zip new file mode 100644 index 000000000..2e2865375 Binary files /dev/null and b/.yarn/cache/chromedriver-npm-120.0.1-5544a83bc3-7498e9c625.zip differ diff --git a/.yarn/versions/a924678a.yml b/.yarn/versions/a924678a.yml new file mode 100644 index 000000000..5ffb5961e --- /dev/null +++ b/.yarn/versions/a924678a.yml @@ -0,0 +1,12 @@ +undecided: + - allure-js + - allure-codeceptjs + - allure-cucumberjs + - allure-decorators + - allure-hermione + - allure-jasmine + - allure-jest + - allure-js-commons + - allure-mocha + - allure-playwright + - allure-vitest diff --git a/package.json b/package.json index 0404eca42..5182cd048 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "allure-js", - "version": "2.11.0", + "version": "2.11.1", "private": true, "workspaces": [ "packages/*" diff --git a/packages/allure-codeceptjs/package.json b/packages/allure-codeceptjs/package.json index dea7aebaa..3ddb29af7 100644 --- a/packages/allure-codeceptjs/package.json +++ b/packages/allure-codeceptjs/package.json @@ -1,6 +1,6 @@ { "name": "allure-codeceptjs", - "version": "2.11.0", + "version": "2.11.1", "description": "Allure codeceptjs integration", "keywords": [ "codeceptjs", diff --git a/packages/allure-cucumberjs/package.json b/packages/allure-cucumberjs/package.json index 23f904cc8..86afabfb5 100644 --- a/packages/allure-cucumberjs/package.json +++ b/packages/allure-cucumberjs/package.json @@ -1,6 +1,6 @@ { "name": "allure-cucumberjs", - "version": "2.11.0", + "version": "2.11.1", "description": "Allure Cucumber.JS integration", "homepage": "https://allurereport.org/", "repository": { diff --git a/packages/allure-decorators/package.json b/packages/allure-decorators/package.json index 15822aaf0..08ce9fb34 100644 --- a/packages/allure-decorators/package.json +++ b/packages/allure-decorators/package.json @@ -1,6 +1,6 @@ { "name": "allure-decorators", - "version": "2.11.0", + "version": "2.11.1", "description": "Write your tests in a Java-like annotation-driven manner via JS decorators.", "keywords": [ "typescript", diff --git a/packages/allure-hermione/package.json b/packages/allure-hermione/package.json index 21d160b83..5ad6234e2 100644 --- a/packages/allure-hermione/package.json +++ b/packages/allure-hermione/package.json @@ -1,6 +1,6 @@ { "name": "allure-hermione", - "version": "2.11.0", + "version": "2.11.1", "keywords": [ "hermione", "typescript", @@ -49,7 +49,7 @@ "chai": "^4.3.8", "chai-like": "^1.1.1", "chai-things": "^0.2.0", - "chromedriver": "114.0.3", + "chromedriver": "120.0.1", "codecov": "^3.6.5", "download-chromium": "^3.0.0", "eslint": "^8.49.0", diff --git a/packages/allure-jasmine/package.json b/packages/allure-jasmine/package.json index 2a431dd50..7fb1bd3c7 100644 --- a/packages/allure-jasmine/package.json +++ b/packages/allure-jasmine/package.json @@ -1,6 +1,6 @@ { "name": "allure-jasmine", - "version": "2.11.0", + "version": "2.11.1", "description": "Allure Jasmine integration", "homepage": "https://allurereport.org/", "repository": { diff --git a/packages/allure-jest/package.json b/packages/allure-jest/package.json index 3211bc7f1..08faf5ae8 100644 --- a/packages/allure-jest/package.json +++ b/packages/allure-jest/package.json @@ -1,6 +1,6 @@ { "name": "allure-jest", - "version": "2.11.0", + "version": "2.11.1", "description": "Allure Jest integration", "keywords": [ "jest", diff --git a/packages/allure-js-commons/package.json b/packages/allure-js-commons/package.json index 3c59b72bc..a2fd5c201 100644 --- a/packages/allure-js-commons/package.json +++ b/packages/allure-js-commons/package.json @@ -1,6 +1,6 @@ { "name": "allure-js-commons", - "version": "2.11.0", + "version": "2.11.1", "description": "Allure JS Commons", "homepage": "https://allurereport.org/", "repository": { diff --git a/packages/allure-mocha/package.json b/packages/allure-mocha/package.json index 74fd4a9e2..ecc4fbc35 100644 --- a/packages/allure-mocha/package.json +++ b/packages/allure-mocha/package.json @@ -1,6 +1,6 @@ { "name": "allure-mocha", - "version": "2.11.0", + "version": "2.11.1", "description": "Allure Mocha integration", "keywords": [ "mocha", diff --git a/packages/allure-playwright/package.json b/packages/allure-playwright/package.json index f11981ff4..4136cbfbc 100644 --- a/packages/allure-playwright/package.json +++ b/packages/allure-playwright/package.json @@ -1,6 +1,6 @@ { "name": "allure-playwright", - "version": "2.11.0", + "version": "2.11.1", "description": "Allure Playwright integration", "keywords": [ "playwright", diff --git a/packages/allure-vitest/README.md b/packages/allure-vitest/README.md index 60801b8db..2d8e43580 100644 --- a/packages/allure-vitest/README.md +++ b/packages/allure-vitest/README.md @@ -29,13 +29,13 @@ yarn add -D vitest allure-vitest Add instance of the reporter to the [`reporters` section](https://vitest.dev/config/#reporters) of your Vitest config: ```js -import AllureReporter from "allure-vitest"; +import AllureReporter from "allure-vitest/reporter"; import { defineConfig } from "vitest/config"; export default defineConfig({ test: { // add setup file to be able to use Allure API via `this.allure` in your tests - setupFiles: ["allure-vitest/setup], + setupFiles: ["allure-vitest/setup"], reporters: [ // do not forget to keep the "default" if you want to see something in the console "default", @@ -75,7 +75,7 @@ to Allure Runtime API: import { test } from "vitest"; test("sample test", async () => { - await this.allure.label("foo", "bar"); + await allure.label("foo", "bar"); }); ``` diff --git a/packages/allure-vitest/package.json b/packages/allure-vitest/package.json index 084c2868f..edb4bdd02 100644 --- a/packages/allure-vitest/package.json +++ b/packages/allure-vitest/package.json @@ -1,6 +1,6 @@ { "name": "allure-vitest", - "version": "2.11.0", + "version": "2.11.1", "description": "Allure Vitest integration", "keywords": [ "vitest", @@ -21,12 +21,22 @@ }, "type": "module", "exports": { - ".": "./dist/src/index.js", - "./setup": "./dist/src/setup.js", - "./reporter": "./dist/src/reporter.js" + ".": { + "import": "./dist/index.js", + "types": "./dist/index.d.ts" + }, + "./reporter": { + "import": "./dist/reporter.js", + "types": "./dist/reporter.d.ts" + }, + "./setup": { + "require": "./dist/setup.js", + "import": "./dist/setup.js", + "types": "./dist/setup.d.ts" + } }, - "main": "./dist/src/index.js", - "types": "./dist/src/index.d.ts", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", "files": [ "dist" ], diff --git a/packages/allure-vitest/src/index.ts b/packages/allure-vitest/src/index.ts index 9bc7b1708..85179a293 100644 --- a/packages/allure-vitest/src/index.ts +++ b/packages/allure-vitest/src/index.ts @@ -1,3 +1,4 @@ +/* eslint @typescript-eslint/require-await: 0 */ import * as vitest from "vitest"; import { LabelName, LinkType, MetadataMessage, ParameterOptions, Stage, Status, StepMetadata } from "allure-js-commons"; @@ -27,82 +28,87 @@ const injectAllureMeta = (context: vitest.TaskContext) => { }; }; -export const label = (context: vitest.TaskContext, name: string, value: string) => { +export const label = async (context: vitest.TaskContext, name: string, value: string) => { injectAllureMeta(context); (context.task.meta as AllureTestMeta).currentTest.labels.push({ name, value }); }; -export const link = (context: vitest.TaskContext, type: LinkType, url: string, name?: string) => { +export const link = async (context: vitest.TaskContext, type: LinkType, url: string, name?: string) => { injectAllureMeta(context); (context.task.meta as AllureTestMeta).currentTest.links.push({ type, url, name }); }; -export const epic = (context: vitest.TaskContext, value: string) => { +export const epic = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.EPIC, value); }; -export const feature = (context: vitest.TaskContext, value: string) => { +export const feature = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.FEATURE, value); }; -export const story = (context: vitest.TaskContext, value: string) => { +export const story = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.STORY, value); }; -export const suite = (context: vitest.TaskContext, value: string) => { +export const suite = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.SUITE, value); }; -export const parentSuite = (context: vitest.TaskContext, value: string) => { +export const parentSuite = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.PARENT_SUITE, value); }; -export const subSuite = (context: vitest.TaskContext, value: string) => { +export const subSuite = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.SUB_SUITE, value); }; -export const owner = (context: vitest.TaskContext, value: string) => { +export const owner = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.OWNER, value); }; -export const severity = (context: vitest.TaskContext, value: string) => { +export const severity = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.SEVERITY, value); }; -export const layer = (context: vitest.TaskContext, value: string) => { +export const layer = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.LAYER, value); }; -export const tag = (context: vitest.TaskContext, value: string) => { +export const tag = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.TAG, value); }; -export const allureId = (context: vitest.TaskContext, value: string) => { +export const allureId = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); label(context, LabelName.ALLURE_ID, value); }; -export const issue = (context: vitest.TaskContext, name: string, url: string) => { +export const issue = async (context: vitest.TaskContext, name: string, url: string) => { injectAllureMeta(context); link(context, LinkType.ISSUE, url, name); }; -export const tms = (context: vitest.TaskContext, name: string, url: string) => { +export const tms = async (context: vitest.TaskContext, name: string, url: string) => { injectAllureMeta(context); link(context, LinkType.TMS, url, name); }; -export const parameter = (context: vitest.TaskContext, name: string, value: string, options?: ParameterOptions) => { +export const parameter = async ( + context: vitest.TaskContext, + name: string, + value: string, + options?: ParameterOptions, +) => { injectAllureMeta(context); (context.task.meta as AllureTestMeta).currentTest.parameter.push({ name, @@ -111,32 +117,32 @@ export const parameter = (context: vitest.TaskContext, name: string, value: stri }); }; -export const description = (context: vitest.TaskContext, markdown: string) => { +export const description = async (context: vitest.TaskContext, markdown: string) => { injectAllureMeta(context); (context.task.meta as AllureTestMeta).currentTest.description = markdown; }; -export const descriptionHtml = (context: vitest.TaskContext, html: string) => { +export const descriptionHtml = async (context: vitest.TaskContext, html: string) => { injectAllureMeta(context); (context.task.meta as AllureTestMeta).currentTest.descriptionHtml = html; }; -export const displayName = (context: vitest.TaskContext, name: string) => { +export const displayName = async (context: vitest.TaskContext, name: string) => { injectAllureMeta(context); (context.task.meta as AllureTestMeta).currentTest.displayName = name; }; -export const historyId = (context: vitest.TaskContext, value: string) => { +export const historyId = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); (context.task.meta as AllureTestMeta).currentTest.historyId = value; }; -export const testCaseId = (context: vitest.TaskContext, value: string) => { +export const testCaseId = async (context: vitest.TaskContext, value: string) => { injectAllureMeta(context); (context.task.meta as AllureTestMeta).currentTest.testCaseId = value; }; -export const attachment = (context: vitest.TaskContext, name: string, content: Buffer | string, type: string) => { +export const attachment = async (context: vitest.TaskContext, name: string, content: Buffer | string, type: string) => { injectAllureMeta(context); const { currentTest, currentStep } = context.task.meta as AllureTestMeta; @@ -185,74 +191,30 @@ export const step = async (context: vitest.TaskContext, name: string, body: () = export const bindAllureApi = (task: vitest.Task) => { return { - label: (name: string, value: string) => { - label({ task } as vitest.TaskContext, name, value); - }, - link: (type: LinkType, url: string, name?: string) => { - link({ task } as vitest.TaskContext, type, url, name); - }, - parameter: (name: string, value: string, options?: ParameterOptions) => { - parameter({ task } as vitest.TaskContext, name, value, options); - }, - description: (markdown: string) => { - description({ task } as vitest.TaskContext, markdown); - }, - descriptionHtml: (html: string) => { - descriptionHtml({ task } as vitest.TaskContext, html); - }, - testCaseId: (id: string) => { - testCaseId({ task } as vitest.TaskContext, id); - }, - historyId: (id: string) => { - historyId({ task } as vitest.TaskContext, id); - }, - allureId: (id: string) => { - allureId({ task } as vitest.TaskContext, id); - }, - displayName: (name: string) => { - displayName({ task } as vitest.TaskContext, name); - }, - attachment: (name: string, content: Buffer | string, type: string) => { - attachment({ task } as vitest.TaskContext, name, content, type); - }, - issue: (name: string, url: string) => { - issue({ task } as vitest.TaskContext, name, url); - }, - tms: (name: string, url: string) => { - tms({ task } as vitest.TaskContext, name, url); - }, - epic: (name: string) => { - epic({ task } as vitest.TaskContext, name); - }, - feature: (name: string) => { - feature({ task } as vitest.TaskContext, name); - }, - story: (name: string) => { - story({ task } as vitest.TaskContext, name); - }, - suite: (name: string) => { - suite({ task } as vitest.TaskContext, name); - }, - parentSuite: (name: string) => { - parentSuite({ task } as vitest.TaskContext, name); - }, - subSuite: (name: string) => { - subSuite({ task } as vitest.TaskContext, name); - }, - owner: (name: string) => { - owner({ task } as vitest.TaskContext, name); - }, - severity: (name: string) => { - severity({ task } as vitest.TaskContext, name); - }, - layer: (name: string) => { - layer({ task } as vitest.TaskContext, name); - }, - tag: (name: string) => { - tag({ task } as vitest.TaskContext, name); - }, - step: (name: string, body: () => Promise) => { - step({ task } as vitest.TaskContext, name, body); - }, + label: (name: string, value: string) => label({ task } as vitest.TaskContext, name, value), + link: (type: LinkType, url: string, name?: string) => link({ task } as vitest.TaskContext, type, url, name), + parameter: (name: string, value: string, options?: ParameterOptions) => + parameter({ task } as vitest.TaskContext, name, value, options), + description: (markdown: string) => description({ task } as vitest.TaskContext, markdown), + descriptionHtml: (html: string) => descriptionHtml({ task } as vitest.TaskContext, html), + testCaseId: (id: string) => testCaseId({ task } as vitest.TaskContext, id), + historyId: (id: string) => historyId({ task } as vitest.TaskContext, id), + allureId: (id: string) => allureId({ task } as vitest.TaskContext, id), + displayName: (name: string) => displayName({ task } as vitest.TaskContext, name), + attachment: (name: string, content: Buffer | string, type: string) => + attachment({ task } as vitest.TaskContext, name, content, type), + issue: (name: string, url: string) => issue({ task } as vitest.TaskContext, name, url), + tms: (name: string, url: string) => tms({ task } as vitest.TaskContext, name, url), + epic: (name: string) => epic({ task } as vitest.TaskContext, name), + feature: (name: string) => feature({ task } as vitest.TaskContext, name), + story: (name: string) => story({ task } as vitest.TaskContext, name), + suite: (name: string) => suite({ task } as vitest.TaskContext, name), + parentSuite: (name: string) => parentSuite({ task } as vitest.TaskContext, name), + subSuite: (name: string) => subSuite({ task } as vitest.TaskContext, name), + owner: (name: string) => owner({ task } as vitest.TaskContext, name), + severity: (name: string) => severity({ task } as vitest.TaskContext, name), + layer: (name: string) => layer({ task } as vitest.TaskContext, name), + tag: (name: string) => tag({ task } as vitest.TaskContext, name), + step: (name: string, body: () => Promise) => step({ task } as vitest.TaskContext, name, body), }; }; diff --git a/packages/allure-vitest/src/setup.ts b/packages/allure-vitest/src/setup.ts index 9e0e451a2..3222b57bd 100644 --- a/packages/allure-vitest/src/setup.ts +++ b/packages/allure-vitest/src/setup.ts @@ -13,13 +13,9 @@ beforeEach((ctx) => { attachments: [], }; - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - this.allure = bindAllureApi(ctx.task); + global.allure = bindAllureApi(ctx.task); }); afterEach(() => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - this.allure = undefined; + global.allure = undefined; }); diff --git a/packages/allure-vitest/test/spec/setup/attachments.test.ts b/packages/allure-vitest/test/spec/setup/attachments.test.ts index 1d2212e9e..3ca82da00 100644 --- a/packages/allure-vitest/test/spec/setup/attachments.test.ts +++ b/packages/allure-vitest/test/spec/setup/attachments.test.ts @@ -5,8 +5,8 @@ it("adds attachments", async () => { const { tests, attachments } = await runVitestInlineTest(` import { test } from "vitest"; - test("text attachment", () => { - this.allure.attachment("foo.txt", Buffer.from("bar"), "text/plain"); + test("text attachment", async () => { + await allure.attachment("foo.txt", Buffer.from("bar"), "text/plain"); }); `); diff --git a/packages/allure-vitest/test/spec/setup/description.test.ts b/packages/allure-vitest/test/spec/setup/description.test.ts index df1fb8310..6610dac0b 100644 --- a/packages/allure-vitest/test/spec/setup/description.test.ts +++ b/packages/allure-vitest/test/spec/setup/description.test.ts @@ -5,8 +5,8 @@ it("sets description", async () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("description", () => { - this.allure.description("foo"); + test("description", async () => { + await allure.description("foo"); }); `); @@ -18,8 +18,8 @@ it("sets html description", async () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("description html", () => { - this.allure.descriptionHtml("foo"); + test("description html", async () => { + await allure.descriptionHtml("foo"); }); `); diff --git a/packages/allure-vitest/test/spec/setup/displayName.test.ts b/packages/allure-vitest/test/spec/setup/displayName.test.ts index 3867a8a9d..eeb95d80a 100644 --- a/packages/allure-vitest/test/spec/setup/displayName.test.ts +++ b/packages/allure-vitest/test/spec/setup/displayName.test.ts @@ -5,8 +5,8 @@ it("sets test display name", async () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("display name", () => { - this.allure.displayName("foo"); + test("display name", async () => { + await allure.displayName("foo"); }); `); diff --git a/packages/allure-vitest/test/spec/setup/historyId.test.ts b/packages/allure-vitest/test/spec/setup/historyId.test.ts index c0828f1a5..8e0f90bab 100644 --- a/packages/allure-vitest/test/spec/setup/historyId.test.ts +++ b/packages/allure-vitest/test/spec/setup/historyId.test.ts @@ -5,8 +5,8 @@ it("sets test history id", async () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("history id", () => { - this.allure.historyId("foo"); + test("history id", async () => { + await allure.historyId("foo"); }); `); diff --git a/packages/allure-vitest/test/spec/setup/labels.test.ts b/packages/allure-vitest/test/spec/setup/labels.test.ts index ec89b103e..dbcf1520a 100644 --- a/packages/allure-vitest/test/spec/setup/labels.test.ts +++ b/packages/allure-vitest/test/spec/setup/labels.test.ts @@ -7,8 +7,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("label", () => { - this.allure.label("foo", "bar"); + test("label", async () => { + await allure.label("foo", "bar"); }); `); @@ -20,8 +20,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("epic", () => { - this.allure.epic("foo"); + test("epic", async () => { + await allure.epic("foo"); }); `); @@ -33,8 +33,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("feature", () => { - this.allure.feature("foo"); + test("feature", async () => { + await allure.feature("foo"); }); `); @@ -46,8 +46,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("story", () => { - this.allure.story("foo"); + test("story", async () => { + await allure.story("foo"); }); `); @@ -59,8 +59,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("suite", () => { - this.allure.suite("foo"); + test("suite", async () => { + await allure.suite("foo"); }); `); @@ -72,8 +72,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("parentSuite", () => { - this.allure.parentSuite("foo"); + test("parentSuite", async () => { + await allure.parentSuite("foo"); }); `); @@ -85,8 +85,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("subSuite", () => { - this.allure.subSuite("foo"); + test("subSuite", async () => { + await allure.subSuite("foo"); }); `); @@ -98,8 +98,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("owner", () => { - this.allure.owner("foo"); + test("owner", async () => { + await allure.owner("foo"); }); `); @@ -111,8 +111,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("severity", () => { - this.allure.severity("foo"); + test("severity", async () => { + await allure.severity("foo"); }); `); @@ -124,8 +124,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("layer", () => { - this.allure.layer("foo"); + test("layer", async () => { + await allure.layer("foo"); }); `); @@ -137,8 +137,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("allureId", () => { - this.allure.allureId("foo"); + test("allureId", async () => { + await allure.allureId("foo"); }); `); @@ -150,8 +150,8 @@ describe("labels", () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("tag", () => { - this.allure.tag("foo"); + test("tag", async () => { + await allure.tag("foo"); }); `); diff --git a/packages/allure-vitest/test/spec/setup/links.test.ts b/packages/allure-vitest/test/spec/setup/links.test.ts index 12cd031b0..78e425326 100644 --- a/packages/allure-vitest/test/spec/setup/links.test.ts +++ b/packages/allure-vitest/test/spec/setup/links.test.ts @@ -1,36 +1,7 @@ -import { join } from "node:path"; import { describe, expect, it } from "vitest"; import { LinkType } from "allure-js-commons"; import { runVitestInlineTest } from "../../utils.js"; -const config = (testDir: string) => ` - import AllureReporter from "allure-vitest/reporter"; - import { defineConfig } from "vitest/config"; - - export default defineConfig({ - test: { - setupFiles: ["allure-vitest/setup"], - reporters: [ - "default", - new AllureReporter({ - testMode: true, - links: [ - { - type: "issue", - urlTemplate: "https://example.org/issue/%s", - }, - { - type: "tms", - urlTemplate: "https://example.org/tms/%s", - }, - ], - resultsDir: "${join(testDir, "allure-results")}", - }), - ], - }, - }); -`; - describe("links", () => { it("link", async () => { const { tests } = await runVitestInlineTest( @@ -38,7 +9,7 @@ describe("links", () => { import { test } from "vitest"; test("link", async (t) => { - await this.allure.link("foo", "https://example.org", "bar"); + await allure.link("foo", "https://example.org", "bar"); }); `, ); @@ -57,11 +28,10 @@ describe("links", () => { import { test } from "vitest"; test("issue", async () => { - await this.allure.issue("foo", "https://example.org/issue/1"); - await this.allure.issue("bar", "2"); + await allure.issue("foo", "https://example.org/issue/1"); + await allure.issue("bar", "2"); }); `, - config, ); expect(tests).toHaveLength(1); @@ -82,12 +52,11 @@ describe("links", () => { ` import { test } from "vitest"; - test("tms", async (t) => { - await this.allure.tms("foo", "https://example.org/tms/1"); - await this.allure.tms("bar", "2"); + test("tms", async () => { + await allure.tms("foo", "https://example.org/tms/1"); + await allure.tms("bar", "2"); }); `, - config, ); expect(tests).toHaveLength(1); diff --git a/packages/allure-vitest/test/spec/setup/parameters.test.ts b/packages/allure-vitest/test/spec/setup/parameters.test.ts index 6cfbcd309..a45ab4f50 100644 --- a/packages/allure-vitest/test/spec/setup/parameters.test.ts +++ b/packages/allure-vitest/test/spec/setup/parameters.test.ts @@ -5,8 +5,8 @@ it("sets parameters", async () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("parameter", () => { - this.allure.parameter("foo", "bar", { mode: "hidden", excluded: true }); + test("parameter", async () => { + await allure.parameter("foo", "bar", { mode: "hidden", excluded: true }); }); `); diff --git a/packages/allure-vitest/test/spec/setup/steps.test.ts b/packages/allure-vitest/test/spec/setup/steps.test.ts index d8d63af69..d314eb5fe 100644 --- a/packages/allure-vitest/test/spec/setup/steps.test.ts +++ b/packages/allure-vitest/test/spec/setup/steps.test.ts @@ -7,7 +7,7 @@ it("handles single lambda step", async () => { import { test } from "vitest"; test("steps", async () => { - await this.allure.step("step", () => {}); + await allure.step("step", () => {}); }); `); @@ -25,8 +25,8 @@ it("handles single lambda step with attachment", async () => { import { test } from "vitest"; test("steps", async () => { - await this.allure.step("step", () => { - this.allure.attachment("foo.txt", Buffer.from("bar"), "text/plain"); + await allure.step("step", () => { + allure.attachment("foo.txt", Buffer.from("bar"), "text/plain"); }); }); `); @@ -47,9 +47,9 @@ it("handles nested lambda steps", async () => { import { test } from "vitest"; test("steps", async () => { - await this.allure.step("step 1", async () => { - await this.allure.step("step 2", async () => { - await this.allure.step("step 3", () => { + await allure.step("step 1", async () => { + await allure.step("step 2", async () => { + await allure.step("step 3", () => { }); }); }); diff --git a/packages/allure-vitest/test/spec/setup/testCaseId.test.ts b/packages/allure-vitest/test/spec/setup/testCaseId.test.ts index a38768c08..d7857afb6 100644 --- a/packages/allure-vitest/test/spec/setup/testCaseId.test.ts +++ b/packages/allure-vitest/test/spec/setup/testCaseId.test.ts @@ -5,8 +5,8 @@ it("sets test case id", async () => { const { tests } = await runVitestInlineTest(` import { test } from "vitest"; - test("test case id", () => { - this.allure.testCaseId("foo"); + test("test case id", async () => { + await allure.testCaseId("foo"); }); `); diff --git a/packages/allure-vitest/test/utils.ts b/packages/allure-vitest/test/utils.ts index b7639c124..84b2fcb89 100644 --- a/packages/allure-vitest/test/utils.ts +++ b/packages/allure-vitest/test/utils.ts @@ -7,7 +7,7 @@ import type { AllureResults, TestResult, TestResultContainer } from "allure-js-c const fileDirname = dirname(fileURLToPath(import.meta.url)); -export const runVitestInlineTest = async (test: string, config?: (cwd: string) => string): Promise => { +export const runVitestInlineTest = async (test: string): Promise => { const res: AllureResults = { tests: [], groups: [], @@ -16,24 +16,32 @@ export const runVitestInlineTest = async (test: string, config?: (cwd: string) = const testDir = join(fileDirname, "fixtures", randomUUID()); const configFilePath = join(testDir, "vitest.config.ts"); const testFilePath = join(testDir, "sample.test.ts"); - const configContent = config - ? config(testDir) - : ` - import AllureReporter from "allure-vitest/reporter"; - import { defineConfig } from "vitest/config"; + const configContent = ` + import AllureReporter from "allure-vitest/reporter"; + import { defineConfig } from "vitest/config"; - export default defineConfig({ - test: { - setupFiles: ["allure-vitest/setup"], - reporters: [ - "default", - new AllureReporter({ - testMode: true, - resultsDir: "${join(testDir, "allure-results")}", - }), - ], - }, - }); + export default defineConfig({ + test: { + setupFiles: ["allure-vitest/setup"], + reporters: [ + "default", + new AllureReporter({ + testMode: true, + links: [ + { + type: "issue", + urlTemplate: "https://example.org/issue/%s", + }, + { + type: "tms", + urlTemplate: "https://example.org/tms/%s", + }, + ], + resultsDir: "${join(testDir, "allure-results")}", + }), + ], + }, + }); `; await mkdir(testDir, { recursive: true }); diff --git a/packages/allure-vitest/tsconfig.json b/packages/allure-vitest/tsconfig.json index 2ef5fab48..3e464d690 100644 --- a/packages/allure-vitest/tsconfig.json +++ b/packages/allure-vitest/tsconfig.json @@ -4,11 +4,12 @@ "lib": ["es2022"], "types": [], "skipLibCheck": true, - "module": "nodenext", - "moduleResolution": "nodenext", + "module": "NodeNext", "declaration": true, - "rootDir": ".", - "outDir": "dist" + "rootDir": "./src", + "outDir": "./dist" }, - "include": ["src"] + "include": [ + "./src/**/*", + ], } diff --git a/packages/allure-vitest/vitest.config.ts b/packages/allure-vitest/vitest.config.ts index 7d71b70db..ed182e86f 100644 --- a/packages/allure-vitest/vitest.config.ts +++ b/packages/allure-vitest/vitest.config.ts @@ -1,5 +1,5 @@ -import AllureReporter from "allure-vitest/reporter"; import { defineConfig } from "vitest/config"; +import AllureReporter from "allure-vitest/reporter"; export default defineConfig({ test: { diff --git a/packages/newman-reporter-allure/package.json b/packages/newman-reporter-allure/package.json index 5cf71e0e9..f6c4dce04 100644 --- a/packages/newman-reporter-allure/package.json +++ b/packages/newman-reporter-allure/package.json @@ -1,6 +1,6 @@ { "name": "newman-reporter-allure", - "version": "2.11.0", + "version": "2.11.1", "description": "Allure Newman integration", "keywords": [ "allure", diff --git a/yarn.lock b/yarn.lock index 257b33afd..f91cbbdb6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1808,7 +1808,7 @@ __metadata: languageName: node linkType: hard -"@testim/chrome-version@npm:^1.1.3": +"@testim/chrome-version@npm:^1.1.4": version: 1.1.4 resolution: "@testim/chrome-version@npm:1.1.4" checksum: 63817db694ab4a49d240217063a30dc2aac9799561132b51da97699207c47cb3355ae043ad1f8b15b770447834cbf36202133641b078f3944d0a502435b40827 @@ -2990,7 +2990,7 @@ __metadata: chai: ^4.3.8 chai-like: ^1.1.1 chai-things: ^0.2.0 - chromedriver: 114.0.3 + chromedriver: 120.0.1 codecov: ^3.6.5 download-chromium: ^3.0.0 eslint: ^8.49.0 @@ -3707,7 +3707,7 @@ __metadata: languageName: node linkType: hard -"axios@npm:^1.4.0": +"axios@npm:^1.6.0": version: 1.6.5 resolution: "axios@npm:1.6.5" dependencies: @@ -4623,20 +4623,20 @@ __metadata: languageName: node linkType: hard -"chromedriver@npm:114.0.3": - version: 114.0.3 - resolution: "chromedriver@npm:114.0.3" +"chromedriver@npm:120.0.1": + version: 120.0.1 + resolution: "chromedriver@npm:120.0.1" dependencies: - "@testim/chrome-version": ^1.1.3 - axios: ^1.4.0 - compare-versions: ^6.0.0 + "@testim/chrome-version": ^1.1.4 + axios: ^1.6.0 + compare-versions: ^6.1.0 extract-zip: ^2.0.1 https-proxy-agent: ^5.0.1 proxy-from-env: ^1.1.0 - tcp-port-used: ^1.0.1 + tcp-port-used: ^1.0.2 bin: chromedriver: bin/chromedriver - checksum: a7e5f5f686cd5074e6b71b8fc93d362d1db991beaa4e2391e2e82008eadb93fb170edb5f5daad4aabefe73bf997b698d4cf65a2b5d826a9b28dad04b30fb99db + checksum: 7498e9c62583c56641905181b3500354d7597354b5126d8971b81a2f3fed93ab1a5e7c10c54ee76634b651b278527343653f0d9a956e7a4ade8ae395eed79396 languageName: node linkType: hard @@ -5124,7 +5124,7 @@ __metadata: languageName: node linkType: hard -"compare-versions@npm:^6.0.0": +"compare-versions@npm:^6.1.0": version: 6.1.0 resolution: "compare-versions@npm:6.1.0" checksum: d4e2a45706a023d8d0b6680338b66b79e20bd02d1947f0ac6531dab634cbed89fa373b3f03d503c5e489761194258d6e1bae67a07f88b1efc61648454f2d47e7 @@ -14333,7 +14333,7 @@ __metadata: languageName: node linkType: hard -"tcp-port-used@npm:^1.0.1": +"tcp-port-used@npm:^1.0.2": version: 1.0.2 resolution: "tcp-port-used@npm:1.0.2" dependencies: