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 b8dd06d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/allure-mocha/src/AllureMochaReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { setGlobalTestRuntime } from "allure-js-commons/sdk/runtime";
import { MochaTestRuntime } from "./MochaTestRuntime.js";
import { setLegacyApiRuntime } from "./legacyUtils.js";
import type { TestPlanIndices } from "./types.js";
import {
applyTestPlan,
createTestPlanIndices,
Expand All @@ -30,7 +31,6 @@ import {
resolveParallelModeSetupFile,
setTestScope,
} from "./utils.js";
import type { TestPlanIndices } from "./utils.js";

const {
EVENT_SUITE_BEGIN,
Expand Down
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 b8dd06d

Please sign in to comment.