Skip to content

Commit

Permalink
Fix typo in getSuite(s)Labels
Browse files Browse the repository at this point in the history
  • Loading branch information
delatrie committed Jun 3, 2024
1 parent bb37acd commit 95dd6f7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/allure-cypress/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type Cypress from "cypress";
import { readFileSync } from "node:fs";
import { ContentType, LabelName, Stage } from "allure-js-commons";
import { extractMetadataFromString } from "allure-js-commons/sdk";
import { FileSystemWriter, ReporterRuntime, getSuitesLabels } from "allure-js-commons/sdk/reporter";
import { FileSystemWriter, ReporterRuntime, getSuiteLabels } from "allure-js-commons/sdk/reporter";
import type { CypressRuntimeMessage, CypressTestEndRuntimeMessage, CypressTestStartRuntimeMessage } from "./model.js";

export type AllureCypressConfig = {
Expand Down Expand Up @@ -45,7 +45,7 @@ export class AllureCypress {
throw new Error("INTERNAL ERROR: Invalid message sequence");
}

const suiteLabels = getSuitesLabels(startMessage.data.specPath.slice(0, -1));
const suiteLabels = getSuiteLabels(startMessage.data.specPath.slice(0, -1));
const testTitle = startMessage.data.specPath[startMessage.data.specPath.length - 1];
const titleMetadata = extractMetadataFromString(testTitle);
const testUuid = this.runtime.startTest({
Expand Down
4 changes: 2 additions & 2 deletions packages/allure-jest/src/environmentFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as allure from "allure-js-commons";
import { LabelName, Stage, Status } from "allure-js-commons";
import type { RuntimeMessage } from "allure-js-commons/sdk";
import { getMessageAndTraceFromError, getStatusFromError } from "allure-js-commons/sdk";
import { FileSystemWriter, MessageWriter, ReporterRuntime, getSuitesLabels } from "allure-js-commons/sdk/reporter";
import { FileSystemWriter, MessageWriter, ReporterRuntime, getSuiteLabels } from "allure-js-commons/sdk/reporter";
import { setGlobalTestRuntime } from "allure-js-commons/sdk/runtime";
import { AllureJestTestRuntime } from "./AllureJestTestRuntime.js";
import type { AllureJestConfig, AllureJestEnvironment } from "./model.js";
Expand Down Expand Up @@ -159,7 +159,7 @@ const createJestEnvironment = <T extends typeof JestEnvironment>(Base: T): T =>
result.labels.push({ name: LabelName.HOST, value: hostLabel });
}

result.labels.push(...getSuitesLabels(newTestSuitesPath));
result.labels.push(...getSuiteLabels(newTestSuitesPath));
}, testUuid);

/**
Expand Down
2 changes: 0 additions & 2 deletions packages/allure-js-commons/src/sdk/reporter/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ export const getSuiteLabels = (suites: readonly string[]): Label[] => {
return labels;
};

export const getSuitesLabels = getSuiteLabels;

const suiteLabelNames: readonly string[] = [LabelName.PARENT_SUITE, LabelName.SUITE, LabelName.SUB_SUITE];

export const ensureSuiteLabels = (test: Partial<TestResult>, defaultSuites: readonly string[]) => {
Expand Down
12 changes: 6 additions & 6 deletions packages/allure-js-commons/test/sdk/reporter/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { LabelName } from "../../../src/model.js";
import { getSuitesLabels, serialize, typeToExtension } from "../../../src/sdk/reporter/utils.js";
import { getSuiteLabels, serialize, typeToExtension } from "../../../src/sdk/reporter/utils.js";

describe("typeToExtension", () => {
it("should respect provided file extension", () => {
Expand Down Expand Up @@ -46,16 +46,16 @@ describe("typeToExtension", () => {
});
});

describe("getSuitesLabels", () => {
describe("getSuiteLabels", () => {
describe("with empty suites", () => {
it("returns empty array", () => {
expect(getSuitesLabels([])).toEqual([]);
expect(getSuiteLabels([])).toEqual([]);
});
});

describe("with single suite", () => {
it("returns parent suite label as the first element", () => {
expect(getSuitesLabels(["foo"])).toEqual([
expect(getSuiteLabels(["foo"])).toEqual([
{
name: LabelName.PARENT_SUITE,
value: "foo",
Expand All @@ -66,7 +66,7 @@ describe("getSuitesLabels", () => {

describe("with two suites", () => {
it("returns parent suite and suite labels as the first two elements", () => {
expect(getSuitesLabels(["foo", "bar"])).toEqual([
expect(getSuiteLabels(["foo", "bar"])).toEqual([
{
name: LabelName.PARENT_SUITE,
value: "foo",
Expand All @@ -81,7 +81,7 @@ describe("getSuitesLabels", () => {

describe("with three or more suites", () => {
it("returns list of three elements where last one is a sub suite label", () => {
expect(getSuitesLabels(["foo", "bar", "baz", "beep", "boop"])).toEqual([
expect(getSuiteLabels(["foo", "bar", "baz", "beep", "boop"])).toEqual([
{
name: LabelName.PARENT_SUITE,
value: "foo",
Expand Down
4 changes: 2 additions & 2 deletions packages/allure-vitest/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ReporterRuntime,
getEnvironmentLabels,
getHostLabel,
getSuitesLabels,
getSuiteLabels,
getThreadLabel,
} from "allure-js-commons/sdk/reporter";
import { getSuitePath, getTestFullName } from "./utils.js";
Expand Down Expand Up @@ -107,7 +107,7 @@ export default class AllureVitestReporter implements Reporter {
value: "javascript",
});
result.labels.push(...titleMetadata.labels);
result.labels.push(...getSuitesLabels(suitePath));
result.labels.push(...getSuiteLabels(suitePath));
result.labels.push(...getEnvironmentLabels());
result.labels.push(getHostLabel());
result.labels.push(getThreadLabel(VITEST_POOL_ID && `vitest-worker-${VITEST_POOL_ID}`));
Expand Down

0 comments on commit 95dd6f7

Please sign in to comment.