@allurereport/plugin-api 3.0.0-beta.16 → 3.0.0-beta.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export type * from "./store.js";
5
5
  export type * from "./resultFile.js";
6
6
  export * from "./utils/misc.js";
7
7
  export * from "./utils/tree.js";
8
+ export * from "./utils/summary.js";
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./config.js";
2
2
  export * from "./utils/misc.js";
3
3
  export * from "./utils/tree.js";
4
+ export * from "./utils/summary.js";
package/dist/plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Statistic, TestStatus } from "@allurereport/core-api";
1
+ import type { CiDescriptor, Statistic, TestResult, TestStatus } from "@allurereport/core-api";
2
2
  import type { AllureStore } from "./store.js";
3
3
  export interface PluginDescriptor {
4
4
  import?: string;
@@ -21,15 +21,22 @@ export interface PluginContext {
21
21
  reportUuid: string;
22
22
  reportName: string;
23
23
  reportFiles: ReportFiles;
24
+ ci?: CiDescriptor;
24
25
  }
26
+ export type SummaryTestResult = Pick<TestResult, "name" | "id" | "status" | "duration">;
25
27
  export interface PluginSummary {
26
28
  href?: string;
27
29
  remoteHref?: string;
30
+ jobHref?: string;
31
+ pullRequestHref?: string;
28
32
  name: string;
29
33
  stats: Statistic;
30
34
  status: TestStatus;
31
35
  duration: number;
32
36
  plugin?: string;
37
+ newTests?: SummaryTestResult[];
38
+ flakyTests?: SummaryTestResult[];
39
+ retryTests?: SummaryTestResult[];
33
40
  createdAt?: number;
34
41
  }
35
42
  export interface BatchOptions {
package/dist/store.d.ts CHANGED
@@ -11,6 +11,7 @@ export interface AllureStore {
11
11
  allFixtures: () => Promise<TestFixtureResult[]>;
12
12
  allHistoryDataPoints: () => Promise<HistoryDataPoint[]>;
13
13
  allKnownIssues: () => Promise<KnownTestFailure[]>;
14
+ allNewTestResults: () => Promise<TestResult[]>;
14
15
  testCaseById: (tcId: string) => Promise<TestCase | undefined>;
15
16
  testResultById: (trId: string) => Promise<TestResult | undefined>;
16
17
  attachmentById: (attachmentId: string) => Promise<AttachmentLink | undefined>;
@@ -0,0 +1,3 @@
1
+ import type { TestResult } from "@allurereport/core-api";
2
+ import type { SummaryTestResult } from "../plugin.js";
3
+ export declare const convertToSummaryTestResult: (tr: TestResult) => SummaryTestResult;
@@ -0,0 +1,6 @@
1
+ export const convertToSummaryTestResult = (tr) => ({
2
+ id: tr.id,
3
+ name: tr.name,
4
+ status: tr.status,
5
+ duration: tr.duration,
6
+ });
@@ -8,3 +8,4 @@ export declare const preciseTreeLabels: <T = TestResult>(labelNames: string[], t
8
8
  export declare const filterTree: <L, G>(tree: TreeData<L, G>, predicate: (leaf: TreeLeaf<L>) => boolean) => TreeData<L, G>;
9
9
  export declare const sortTree: <L, G>(tree: TreeData<L, G>, comparator: Comparator<TreeLeaf<L>>) => TreeData<L, G>;
10
10
  export declare const transformTree: <L, G>(tree: TreeData<L, G>, transformer: (leaf: TreeLeaf<L>, idx: number) => TreeLeaf<L>) => TreeData<L, G>;
11
+ export declare const createTreeByTitlePath: <T = TestResult, L = DefaultTreeLeaf, G = DefaultTreeGroup>(data: T[], leafFactory?: (item: T) => TreeLeaf<L>, groupFactory?: (parentGroup: string | undefined, groupClassifier: string) => TreeGroup<G>, addLeafToGroup?: (group: TreeGroup<G>, leaf: TreeLeaf<L>) => void) => TreeData<L, G>;
@@ -197,3 +197,22 @@ export const transformTree = (tree, transformer) => {
197
197
  transformGroupLeaves(root);
198
198
  return tree;
199
199
  };
200
+ export const createTreeByTitlePath = (data, leafFactory, groupFactory, addLeafToGroup = () => { }) => {
201
+ const leafFactoryFn = leafFactory ??
202
+ ((tr) => {
203
+ const { id, name, status, duration } = tr;
204
+ return {
205
+ nodeId: id,
206
+ name,
207
+ status,
208
+ duration,
209
+ };
210
+ });
211
+ const groupFactoryFn = groupFactory ??
212
+ ((parentId, groupClassifier) => ({
213
+ nodeId: md5((parentId ? `${parentId}.` : "") + groupClassifier),
214
+ name: groupClassifier,
215
+ statistic: emptyStatistic(),
216
+ }));
217
+ return createTree(data, (item) => (item.titlePath ?? []).map((segment) => [segment]), leafFactoryFn, groupFactoryFn, addLeafToGroup);
218
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-api",
3
- "version": "3.0.0-beta.16",
3
+ "version": "3.0.0-beta.17",
4
4
  "description": "Allure Plugin API",
5
5
  "keywords": [
6
6
  "allure"
@@ -26,7 +26,7 @@
26
26
  "test": "rimraf ./out && vitest run"
27
27
  },
28
28
  "dependencies": {
29
- "@allurereport/core-api": "3.0.0-beta.16"
29
+ "@allurereport/core-api": "3.0.0-beta.17"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@stylistic/eslint-plugin": "^2.6.1",
@@ -36,7 +36,7 @@
36
36
  "@typescript-eslint/parser": "^8.0.0",
37
37
  "@vitest/runner": "^2.1.9",
38
38
  "@vitest/snapshot": "^2.1.9",
39
- "allure-vitest": "^3.0.9",
39
+ "allure-vitest": "^3.3.0",
40
40
  "eslint": "^8.57.0",
41
41
  "eslint-config-prettier": "^9.1.0",
42
42
  "eslint-plugin-import": "^2.29.1",