Skip to content

Commit

Permalink
Move test plan index type to types.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
delatrie committed Jul 1, 2024
1 parent 6c63bfe commit 6266287
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions packages/allure-mocha/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import type { Label } from "allure-js-commons";

export type TestPlanIndices = {
fullNameIndex: ReadonlySet<string>;
idIndex: ReadonlySet<string>;
};

export type AllureMochaTestData = {
isIncludedInTestRun: boolean;
fullName: string;
Expand Down
7 changes: 1 addition & 6 deletions packages/allure-mocha/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LabelName } from "allure-js-commons";
import type { TestPlanV1, TestPlanV1Test } from "allure-js-commons/sdk";
import { extractMetadataFromString } from "allure-js-commons/sdk";
import { getHostLabel, getRelativePath, getThreadLabel, md5, parseTestPlan } from "allure-js-commons/sdk/reporter";
import type { AllureMochaTestData, HookCategory, HookScope, HookType } from "./types.js";
import type { AllureMochaTestData, HookCategory, HookScope, HookType, TestPlanIndices } from "./types.js";

const filename = fileURLToPath(import.meta.url);

Expand Down Expand Up @@ -41,11 +41,6 @@ const createTestPlanIdIndex = (testplan: TestPlanV1) => createTestPlanIndex((e)
const createTestPlanIndex = <T>(keySelector: (entry: TestPlanV1Test) => T | undefined, testplan: TestPlanV1): Set<T> =>
new Set(testplan.tests.map((e) => keySelector(e)).filter((v) => v)) as Set<T>;

export type TestPlanIndices = {
fullNameIndex: ReadonlySet<string>;
idIndex: ReadonlySet<string>;
};

export const createTestPlanIndices = (): TestPlanIndices | undefined => {
const testplan = parseTestPlan();
if (testplan) {
Expand Down

0 comments on commit 6266287

Please sign in to comment.