Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate prefixes for the commons package #939

Merged
merged 7 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/allure-codeceptjs/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ const dirname = fileURLToPath(new URL(".", import.meta.url));
const createNodeEntry = (inputFile) => {
const outputFileBase = inputFile.replace(/^src/, "dist");
const external = [

"allure-js-commons",
"allure-js-commons/sdk/node",
"strip-ansi",
"codeceptjs",
"node:path",
];

return [
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-codeceptjs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
TestRuntime,
extractMetadataFromString,
setGlobalTestRuntime,
} from "allure-js-commons/new/sdk/node";
} from "allure-js-commons/sdk/node";
import { extractMeta } from "./helpers";
import { CodeceptError, CodeceptHook, CodeceptStep, CodeceptTest } from "./model";
import { AllureCodeceptJSConfig } from "./model.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-codeceptjs/src/model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Config } from "allure-js-commons/new/sdk/browser";
import type { Config } from "allure-js-commons/sdk/browser";

export interface CodeceptError {
params: any;
Expand Down
4 changes: 2 additions & 2 deletions packages/allure-codeceptjs/test/spec/attachments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { runCodeceptJSInlineTest } from "../utils";
it("handles attachments in tests", async () => {
const { tests, attachments } = await runCodeceptJSInlineTest({
"login.test.js": `
const { attachment } = require("allure-js-commons/new");
const { attachment } = require("allure-js-commons");

Feature("sample-feature");
Scenario("sample-scenario", async () => {
Expand All @@ -30,7 +30,7 @@ it("handles attachments in tests", async () => {
it("handles attachments in runtime steps", async () => {
const { tests, attachments } = await runCodeceptJSInlineTest({
"login.test.js": `
const { step, attachment } = require("allure-js-commons/new");
const { step, attachment } = require("allure-js-commons");

Feature("sample-feature");
Scenario("sample-scenario", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-codeceptjs/test/spec/hooks.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { Stage, Status } from "allure-js-commons/new/sdk/node";
import { Stage, Status } from "allure-js-commons/sdk/node";
import { runCodeceptJSInlineTest } from "../utils";

it("handles hooks", async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/allure-codeceptjs/test/spec/labels.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { LabelName } from "allure-js-commons/new/sdk/node";
import { LabelName } from "allure-js-commons/sdk/node";
import { runCodeceptJSInlineTest } from "../utils";

it("adds labels", async () => {
Expand All @@ -19,7 +19,7 @@ it("adds labels", async () => {
severity,
story,
tag,
} = require("allure-js-commons/new");
} = require("allure-js-commons");

Feature("login-feature");
Scenario("login-scenario1", async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/allure-codeceptjs/test/spec/links.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { expect, it } from "vitest";
import { LinkType } from "allure-js-commons/new/sdk/node";
import { LinkType } from "allure-js-commons/sdk/node";
import { runCodeceptJSInlineTest } from "../utils";

it("sets runtime links", async () => {
const results = await runCodeceptJSInlineTest({
"sample.test.js": `
const { link, links, issue, tms } = require('allure-js-commons/new');
const { link, links, issue, tms } = require('allure-js-commons');

Feature("login-feature");
Scenario("login-scenario1", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-codeceptjs/test/spec/parameters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { runCodeceptJSInlineTest } from "../utils";
it("sets parameters", async () => {
const { tests } = await runCodeceptJSInlineTest({
"sample.test.js": `
const { parameter } = require("allure-js-commons/new");
const { parameter } = require("allure-js-commons");

Feature("login-feature");
Scenario("login-scenario1", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-codeceptjs/test/spec/simple.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { Stage, Status } from "allure-js-commons/new/sdk/node";
import { Stage, Status } from "allure-js-commons/sdk/node";
import { runCodeceptJSInlineTest } from "../utils";

it("simple scenarios", async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/allure-codeceptjs/test/spec/steps.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { Stage, Status } from "allure-js-commons/new/sdk/node";
import { Stage, Status } from "allure-js-commons/sdk/node";
import { runCodeceptJSInlineTest } from "../utils";

it("handles codeceptjs steps", async () => {
Expand Down Expand Up @@ -43,7 +43,7 @@ it("handles codeceptjs steps", async () => {
it("handles lambda steps", async () => {
const { tests } = await runCodeceptJSInlineTest({
"sample.test.js": `
const { step } = require("allure-js-commons/new");
const { step } = require("allure-js-commons");

Feature("sample-feature-1");
Scenario("scenario1", async ({ I }) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-codeceptjs/test/spec/tags.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { LabelName } from "allure-js-commons/new/sdk/node";
import { LabelName } from "allure-js-commons/sdk/node";
import { runCodeceptJSInlineTest } from "../utils";

it("supports codecept tags", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-codeceptjs/test/spec/titleMetadata.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { LabelName } from "allure-js-commons/new/sdk/node";
import { LabelName } from "allure-js-commons/sdk/node";
import { runCodeceptJSInlineTest } from "../utils";

it("handles title metadata", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-codeceptjs/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { randomUUID } from "node:crypto";
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { dirname, resolve as resolvePath } from "node:path";
import type { AllureResults, TestResult, TestResultContainer } from "allure-js-commons/new/sdk/node";
import type { AllureResults, TestResult, TestResultContainer } from "allure-js-commons/sdk/node";

const parseJsonResult = <T>(data: string) => {
return JSON.parse(Buffer.from(data, "base64").toString("utf8")) as T;
Expand Down
4 changes: 2 additions & 2 deletions packages/allure-cucumberjs/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const createNodeEntry = (inputFile) => {
"node:os",
"node:fs",
"node:process",
"allure-js-commons/new/sdk/node",
"allure-js-commons/new/internal",
"allure-js-commons/sdk/node",
"allure-js-commons/internal",
];

return [
Expand Down
4 changes: 2 additions & 2 deletions packages/allure-cucumberjs/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Before, World } from "@cucumber/cucumber";
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE } from "allure-js-commons/new/internal";
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE } from "allure-js-commons/internal";
import {
ContentType,
Label,
Expand All @@ -14,7 +14,7 @@ import {
TestRuntime,
getStatusFromError,
setGlobalTestRuntime,
} from "allure-js-commons/new/sdk/node";
} from "allure-js-commons/sdk/node";

export class AllureCucumberTestRuntime extends World implements TestRuntime {
messagesHolder = new MessagesHolder();
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/src/model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Config, LabelName, LinkType } from "allure-js-commons/new/sdk/node";
import { Config, LabelName, LinkType } from "allure-js-commons/sdk/node";

export type LabelConfig = {
pattern: RegExp[];
Expand Down
4 changes: 2 additions & 2 deletions packages/allure-cucumberjs/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as messages from "@cucumber/messages";
import { PickleTag, Tag, TestStepResult, TestStepResultStatus } from "@cucumber/messages";
import os from "node:os";
import process from "node:process";
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE } from "allure-js-commons/new/internal";
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE } from "allure-js-commons/internal";
import {
AllureNodeReporterRuntime,
Config,
Expand All @@ -18,7 +18,7 @@ import {
TestResult,
createStepResult,
getWorstStepResultStatus,
} from "allure-js-commons/new/sdk/node";
} from "allure-js-commons/sdk/node";
import { AllureCucumberReporterConfig, LabelConfig, LinkConfig } from "./model";

const { ALLURE_THREAD_NAME } = process.env;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Feature: dataTableAndExamples
When I add <a> to <b>
Then result is <result>

Examples:
Examples:
| b | result |
| 3 | 4 |
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Feature: Test Scenarios with Examples
When I add a to b
Then result is <result>

Examples:
Examples:
| a | b | result |
| 1 | 3 | 4 |
| 2 | 4 | 6 |
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Given } = require("@cucumber/cucumber");
const { attachment } = require("allure-js-commons/new");
const { attachment } = require("allure-js-commons");

Given("add a text", async () => {
await attachment("Text attachment", "some text", "text/plain");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Given } = require("@cucumber/cucumber");
const { description, descriptionHtml } = require("allure-js-commons/new");
const { description, descriptionHtml } = require("allure-js-commons");

Given("a step", () => {});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const {
severity,
story,
tag,
} = require("allure-js-commons/new");
} = require("allure-js-commons");

Given("a step", () => {});

Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/test/fixtures/support/links.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Given } = require("@cucumber/cucumber");
const { link, issue, tms } = require("allure-js-commons/new");
const { link, issue, tms } = require("allure-js-commons");

Given("a step", () => {});

Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/test/fixtures/support/steps.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Given } = require("@cucumber/cucumber");
const { step, label, epic, attachment } = require("allure-js-commons/new");
const { step, label, epic, attachment } = require("allure-js-commons");

Given("allows to define runtime step", async () => {
await step("first nested step", async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/test/spec/dataTable.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { ContentType } from "allure-js-commons/new/sdk";
import { ContentType } from "allure-js-commons/sdk";
import { runCucumberInlineTest } from "../utils";

it("handles data tables", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { ContentType } from "allure-js-commons/new/sdk";
import { ContentType } from "allure-js-commons/sdk";
import { runCucumberInlineTest } from "../utils";

it("handles both data table and examples for one feature", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/test/spec/examples.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { ContentType } from "allure-js-commons/new/sdk";
import { ContentType } from "allure-js-commons/sdk";
import { runCucumberInlineTest } from "../utils";

it("handles examples table", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/test/spec/labels.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { LabelName } from "allure-js-commons/new/sdk";
import { LabelName } from "allure-js-commons/sdk";
import { runCucumberInlineTest } from "../utils";

it("handles runtime labels", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/test/spec/links.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { LinkType } from "allure-js-commons/new/sdk";
import { LinkType } from "allure-js-commons/sdk";
import { runCucumberInlineTest } from "../utils";

it("handles runtime links", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/test/spec/simple.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { Stage, Status } from "allure-js-commons/new/sdk";
import { Stage, Status } from "allure-js-commons/sdk";
import { runCucumberInlineTest } from "../utils";

it("handles basic cases", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/test/spec/steps.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { LabelName, Stage, Status } from "allure-js-commons/new/sdk/node";
import { LabelName, Stage, Status } from "allure-js-commons/sdk/node";
import { runCucumberInlineTest } from "../utils";

it("handles runtime steps", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/test/spec/tags.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { LabelName } from "allure-js-commons/new/sdk";
import { LabelName } from "allure-js-commons/sdk";
import { runCucumberInlineTest } from "../utils";

it("assigns unmatched tags as tags labels", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it } from "vitest";
import { Stage, Status } from "allure-js-commons/new/sdk";
import { Stage, Status } from "allure-js-commons/sdk";
import { runCucumberInlineTest } from "../utils";

it("reports undefined tests and steps", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fork } from "node:child_process";
import { randomUUID } from "node:crypto";
import { copyFile, mkdir, rm, writeFile } from "node:fs/promises";
import { join, resolve as resolvePath } from "node:path";
import { AllureResults, TestResult, TestResultContainer } from "allure-js-commons/new/sdk";
import { AllureResults, TestResult, TestResultContainer } from "allure-js-commons/sdk";

export const runCucumberInlineTest = async (features: string[], stepsDefs: string[]): Promise<AllureResults> => {
const res: AllureResults = {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cypress/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const dirname = fileURLToPath(new URL(".", import.meta.url));

const createNodeEntry = (inputFile) => {
const outputFileBase = inputFile.replace(/^src/, "dist");
const external = ["node:fs", "allure-js-commons/new/sdk/node"];
const external = ["node:fs", "allure-js-commons/sdk/node"];

return [
defineConfig({
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cypress/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
getUnfinishedStepsMessages,
hasStepMessage,
setGlobalTestRuntime,
} from "allure-js-commons/new/sdk/browser";
} from "allure-js-commons/sdk/browser";
import { CypressRuntimeMessage } from "./model.js";
import { normalizeAttachmentContentEncoding, uint8ArrayToBase64 } from "./utils.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cypress/src/model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeMessage, Stage, Status, StatusDetails } from "allure-js-commons/new/sdk";
import { RuntimeMessage, Stage, Status, StatusDetails } from "allure-js-commons/sdk";

export type CypressTestStartRuntimeMessage = {
type: "cypress_start";
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cypress/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Stage,
extractMetadataFromString,
getSuitesLabels,
} from "allure-js-commons/new/sdk/node";
} from "allure-js-commons/sdk/node";
import { CypressRuntimeMessage, CypressTestEndRuntimeMessage, CypressTestStartRuntimeMessage } from "./model.js";

export type AllureCypressConfig = {
Expand Down
4 changes: 2 additions & 2 deletions packages/allure-cypress/test/spec/screenshots.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ it("attaches screenshots for failed specs", async () => {

expect(attachment.name).toBe("Screenshot");
expect(attachment.type).toBe(ContentType.PNG);
expect(attachments).toHaveProperty(attachment.source as string);
expect(attachments).toHaveProperty(attachment.source);
});

it("attaches runtime screenshots", async () => {
Expand All @@ -37,5 +37,5 @@ it("attaches runtime screenshots", async () => {

expect(attachment.name).toBe("foo");
expect(attachment.type).toBe(ContentType.PNG);
expect(attachments).toHaveProperty(attachment.source as string);
expect(attachments).toHaveProperty(attachment.source);
});
2 changes: 1 addition & 1 deletion packages/allure-cypress/test/spec/video.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ it("attaches same video to each spec in a test", async () => {
expect(attachment.name).toBe("Video");
expect(attachment.type).toBe(ContentType.MP4);
expect(tests[1].attachments).toContainEqual(attachment);
expect(attachments).toHaveProperty(attachment.source as string);
expect(attachments).toHaveProperty(attachment.source);
});
Loading
Loading