@allurereport/plugin-api 3.20.0 → 3.21.0

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/config.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface Config {
6
6
  output?: string;
7
7
  open?: boolean;
8
8
  port?: string;
9
+ host?: string;
9
10
  hideLabels?: (string | RegExp)[];
10
11
  historyPath?: string;
11
12
  historyBaseUrl?: string;
package/dist/plugin.d.ts CHANGED
@@ -28,6 +28,7 @@ export interface PluginContext {
28
28
  hideLabels?: (string | RegExp)[];
29
29
  reportFiles: ReportFiles;
30
30
  reportUrl?: string;
31
+ overviewHref?: string;
31
32
  realTime?: boolean;
32
33
  output: string;
33
34
  ci?: CiDescriptor;
@@ -56,6 +57,8 @@ export interface PluginSummary {
56
57
  retryTests?: string[];
57
58
  checks?: SummaryCheckResult[];
58
59
  createdAt?: number;
60
+ exitCode?: ExitCode;
61
+ globalErrorsCount?: number;
59
62
  filtered?: boolean;
60
63
  meta?: Record<string, any>;
61
64
  }
package/dist/report.d.ts CHANGED
@@ -37,6 +37,7 @@ export type ReportOptions = {
37
37
  runSummaryByEnv?: Record<string, ReportRunSummary>;
38
38
  stepTreeExpansion?: StepTreeExpansion;
39
39
  defaultSortBy?: string;
40
+ overviewHref?: string;
40
41
  };
41
42
  export type ReportFixtureResult = Omit<TestFixtureResult, "testResultIds" | "start" | "stop" | "sourceMetadata" | "steps"> & {
42
43
  steps: ReportTestStepResult[];
@@ -67,6 +68,7 @@ export type ReportTestResult = Omit<TestResult, "runSelector" | "sourceMetadata"
67
68
  history: HistoryTestResult[];
68
69
  retries?: TestResult[];
69
70
  retriesCount?: number;
71
+ retriesStatusChange?: boolean;
70
72
  groupedLabels: Record<string, string[]>;
71
73
  attachments?: AttachmentTestStepResult[];
72
74
  breadcrumbs: ReportBreadcrumbItem[];
@@ -82,7 +84,7 @@ export type ReportTestResult = Omit<TestResult, "runSelector" | "sourceMetadata"
82
84
  severity: string;
83
85
  };
84
86
  };
85
- export type ReportTreeLeaf = Pick<ReportTestResult, "duration" | "name" | "start" | "status" | "groupOrder" | "flaky" | "transition" | "retry" | "retriesCount" | "resolution"> & {
87
+ export type ReportTreeLeaf = Pick<ReportTestResult, "duration" | "name" | "start" | "status" | "groupOrder" | "flaky" | "transition" | "retry" | "retriesCount" | "retriesStatusChange" | "resolution"> & {
86
88
  nodeId: string;
87
89
  id?: string;
88
90
  transitionTooltip?: string;
@@ -91,6 +93,7 @@ export type ReportTreeLeaf = Pick<ReportTestResult, "duration" | "name" | "start
91
93
  categories?: string[];
92
94
  severity?: string;
93
95
  resolutionStatus?: ResolutionCategory | "none";
96
+ parameters?: string[];
94
97
  };
95
98
  export type ReportTreeGroup = WithChildren & DefaultTreeGroup & {
96
99
  nodeId: string;
@@ -104,6 +107,7 @@ export type ReportSearchDocument = {
104
107
  id: string;
105
108
  nodeId: string;
106
109
  name: string;
110
+ titlePath?: string;
107
111
  fullName?: string;
108
112
  retryHash?: string | null;
109
113
  labels?: string;
@@ -114,7 +118,7 @@ export type ReportSearchDocument = {
114
118
  statusMessage?: string;
115
119
  links?: string;
116
120
  };
117
- export type ReportResolutionTestResult = Pick<ReportTreeLeaf, "nodeId" | "id" | "name" | "status" | "duration" | "flaky" | "transition" | "retry" | "retriesCount" | "resolution" | "tooltips"> & {
121
+ export type ReportResolutionTestResult = Pick<ReportTreeLeaf, "nodeId" | "id" | "name" | "status" | "duration" | "flaky" | "transition" | "retry" | "retriesCount" | "retriesStatusChange" | "resolution" | "tooltips"> & {
118
122
  groupOrder?: number;
119
123
  };
120
124
  export type ReportResolutionGroup = {
package/dist/store.d.ts CHANGED
@@ -7,6 +7,7 @@ export interface TestResultRelatedData {
7
7
  attachmentsByTrId: Map<string, AttachmentLink[]>;
8
8
  fixturesByTrId: Map<string, TestFixtureResult[]>;
9
9
  historyByTrId: Map<string, HistoryTestResult[] | undefined>;
10
+ resolutionIssuesByTrId?: Map<string, ResolutionIssue | undefined>;
10
11
  retriesByTrId: Map<string, TestResult[]>;
11
12
  }
12
13
  export interface AllureStore {
@@ -1,6 +1,11 @@
1
- import { AllureCheckResult, type AllureHistory, type CiDescriptor, type TestResult } from "@allurereport/core-api";
2
- import type { PluginSummary, SummaryCheckResult, TestResultRegistry, TestResultSummary } from "../plugin.js";
1
+ import { AllureCheckResult, type AllureHistory, type CiDescriptor, type TestResult, type TestStatus } from "@allurereport/core-api";
2
+ import type { ExitCode, PluginSummary, SummaryCheckResult, TestResultRegistry, TestResultSummary } from "../plugin.js";
3
3
  import type { AllureStore } from "../store.js";
4
+ export declare const resolveReportStatus: (params: {
5
+ globalErrorsCount: number;
6
+ exitCode?: ExitCode;
7
+ testStatuses: TestStatus[];
8
+ }) => TestStatus;
4
9
  export declare const convertToTestResultSummary: (tr: TestResult) => TestResultSummary;
5
10
  export declare const createTestResultRegistry: (testResults: TestResult[]) => TestResultRegistry;
6
11
  export declare const convertToSummaryCheckResult: (check: AllureCheckResult) => SummaryCheckResult;
@@ -1,4 +1,14 @@
1
1
  import { getWorstStatus, } from "@allurereport/core-api";
2
+ export const resolveReportStatus = (params) => {
3
+ if (params.globalErrorsCount > 0) {
4
+ return "failed";
5
+ }
6
+ const code = params.exitCode?.actual ?? params.exitCode?.original;
7
+ if (code !== undefined && code !== 0) {
8
+ return "failed";
9
+ }
10
+ return getWorstStatus(params.testStatuses) ?? "passed";
11
+ };
2
12
  export const convertToTestResultSummary = (tr) => ({
3
13
  id: tr.id,
4
14
  name: tr.name,
@@ -43,11 +53,17 @@ export const createPluginSummary = async (params) => {
43
53
  const retryTrs = allTrs.filter(({ retryHash }) => retryHash && retryHashesWithRetries.has(retryHash));
44
54
  const flakyTrs = allTrs.filter((tr) => !!tr?.flaky);
45
55
  const duration = calculateRunDuration(allTrs);
46
- const worstStatus = getWorstStatus(allTrs.map(({ status }) => status));
56
+ const exitCode = await store.globalExitCode();
57
+ const globalErrors = await store.allGlobalErrors();
58
+ const status = resolveReportStatus({
59
+ globalErrorsCount: globalErrors.length,
60
+ exitCode,
61
+ testStatuses: allTrs.map(({ status: testStatus }) => testStatus),
62
+ });
47
63
  const createdAt = allTrs.reduce((acc, { stop }) => Math.max(acc, stop || 0), 0);
48
64
  return {
49
65
  stats: await store.testsStatistic(filter),
50
- status: worstStatus ?? "passed",
66
+ status,
51
67
  newTests: newTrs.filter(({ id }) => currentIds.has(id)).map(({ id }) => id),
52
68
  flakyTests: flakyTrs.map(({ id }) => id),
53
69
  retryTests: retryTrs.map(({ id }) => id),
@@ -55,6 +71,8 @@ export const createPluginSummary = async (params) => {
55
71
  name,
56
72
  duration,
57
73
  createdAt,
74
+ ...(exitCode ? { exitCode } : {}),
75
+ ...(globalErrors.length > 0 ? { globalErrorsCount: globalErrors.length } : {}),
58
76
  ...(filter ? { filtered: true } : {}),
59
77
  plugin,
60
78
  meta,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-api",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "Allure Plugin API",
5
5
  "keywords": [
6
6
  "allure"
@@ -25,16 +25,19 @@
25
25
  "build": "run clean && tsc --project ./tsconfig.json",
26
26
  "clean": "rimraf ./dist",
27
27
  "test": "rimraf ./out && vitest run",
28
+ "test:unit": "yarn test",
28
29
  "lint": "oxlint --import-plugin src test features stories",
29
30
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
30
31
  },
31
32
  "dependencies": {
32
- "@allurereport/core-api": "3.20.0",
33
+ "@allurereport/core-api": "3.21.0",
33
34
  "tar-stream": "3.1.7"
34
35
  },
35
36
  "devDependencies": {
37
+ "@allurereport/test-config": "3.21.0",
36
38
  "@types/node": "^20",
37
39
  "@types/tar-stream": "^3.1.4",
40
+ "@vitest/coverage-istanbul": "^4.1.0",
38
41
  "@vitest/runner": "^2",
39
42
  "@vitest/snapshot": "^5.0.1",
40
43
  "allure-js-commons": "^3",