@allurereport/plugin-api 3.17.0 → 3.18.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
@@ -8,6 +8,7 @@ export interface Config {
8
8
  port?: string;
9
9
  hideLabels?: (string | RegExp)[];
10
10
  historyPath?: string;
11
+ historyBaseUrl?: string;
11
12
  historyLimit?: number;
12
13
  resolutions?: ResolutionsConfig;
13
14
  defaultLabels?: DefaultLabelsConfig;
package/dist/plugin.d.ts CHANGED
@@ -56,6 +56,7 @@ export interface PluginSummary {
56
56
  retryTests?: string[];
57
57
  checks?: SummaryCheckResult[];
58
58
  createdAt?: number;
59
+ filtered?: boolean;
59
60
  meta?: Record<string, any>;
60
61
  }
61
62
  export interface PluginReportFile {
@@ -103,8 +104,15 @@ export interface RealtimeSubscriber {
103
104
  fileName?: string;
104
105
  environment?: string;
105
106
  }) => RealtimeListenerResult): () => void;
107
+ onProcessGlobalAttachment(listener: (payload: {
108
+ attachment: ResultFile;
109
+ fileName?: string;
110
+ environment?: string;
111
+ }) => RealtimeListenerResult): () => void;
106
112
  onGlobalExitCode(listener: (payload: ExitCode) => RealtimeListenerResult): () => void;
107
113
  onGlobalError(listener: (error: PluginGlobalError) => RealtimeListenerResult): () => void;
114
+ onProcessGlobalError(listener: (error: PluginGlobalError) => RealtimeListenerResult): () => void;
115
+ onProcessGlobalsReset(listener: () => RealtimeListenerResult): () => void;
108
116
  onQualityGateResults(listener: (payload: QualityGateValidationResult[]) => RealtimeListenerResult): () => void;
109
117
  onTestResults(listener: (trIds: string[]) => RealtimeListenerResult, options?: BatchOptions): () => void;
110
118
  onTestFixtureResults(listener: (tfrIds: string[]) => RealtimeListenerResult, options?: BatchOptions): () => void;
@@ -112,8 +120,11 @@ export interface RealtimeSubscriber {
112
120
  }
113
121
  export interface RealtimeEventsDispatcher {
114
122
  sendGlobalAttachment(attachment: ResultFile, fileName?: string, environment?: string): void;
123
+ sendProcessGlobalAttachment(attachment: ResultFile, fileName?: string, environment?: string): void;
115
124
  sendGlobalExitCode(payload: ExitCode): void;
116
125
  sendGlobalError(error: PluginGlobalError): void;
126
+ sendProcessGlobalError(error: PluginGlobalError): void;
127
+ sendProcessGlobalsReset(): void;
117
128
  sendQualityGateResults(payload: QualityGateValidationResult[]): void;
118
129
  sendTestResult(trId: string): void;
119
130
  sendTestFixtureResult(tfrId: string): void;
@@ -33,6 +33,10 @@ export type QualityGateRule<T = unknown, K = T> = {
33
33
  expected: T;
34
34
  actual: K;
35
35
  }) => string;
36
+ successMessage?: (payload: {
37
+ expected: T;
38
+ actual: K;
39
+ }) => string;
36
40
  validate: (payload: {
37
41
  expected: T;
38
42
  trs: TestResult[];
package/dist/report.d.ts CHANGED
@@ -34,6 +34,7 @@ export type ReportOptions = {
34
34
  ci?: CiDescriptor;
35
35
  executor?: ReportExecutorInfo;
36
36
  runSummary?: ReportRunSummary;
37
+ runSummaryByEnv?: Record<string, ReportRunSummary>;
37
38
  stepTreeExpansion?: StepTreeExpansion;
38
39
  defaultSortBy?: string;
39
40
  };
@@ -88,6 +89,7 @@ export type ReportTreeLeaf = Pick<ReportTestResult, "duration" | "name" | "start
88
89
  tooltips?: Record<string, string>;
89
90
  tags?: string[];
90
91
  categories?: string[];
92
+ severity?: string;
91
93
  };
92
94
  export type ReportTreeGroup = WithChildren & DefaultTreeGroup & {
93
95
  nodeId: string;
@@ -4,6 +4,7 @@ import type { AllureStore } from "../store.js";
4
4
  export declare const convertToTestResultSummary: (tr: TestResult) => TestResultSummary;
5
5
  export declare const createTestResultRegistry: (testResults: TestResult[]) => TestResultRegistry;
6
6
  export declare const convertToSummaryCheckResult: (check: AllureCheckResult) => SummaryCheckResult;
7
+ export declare const calculateRunDuration: (testResults: Pick<TestResult, "start" | "stop" | "duration">[]) => number;
7
8
  export declare const createPluginSummary: (params: {
8
9
  filter?: (testResult: TestResult) => boolean;
9
10
  name: string;
@@ -14,6 +14,23 @@ export const convertToSummaryCheckResult = (check) => ({
14
14
  name: check.name,
15
15
  status: check.status,
16
16
  });
17
+ export const calculateRunDuration = (testResults) => {
18
+ let start = Infinity;
19
+ let stop = -Infinity;
20
+ for (const { start: trStart, stop: trStop } of testResults) {
21
+ if (typeof trStart === "number" &&
22
+ Number.isFinite(trStart) &&
23
+ typeof trStop === "number" &&
24
+ Number.isFinite(trStop)) {
25
+ start = Math.min(start, trStart);
26
+ stop = Math.max(stop, trStop);
27
+ }
28
+ }
29
+ if (Number.isFinite(start) && Number.isFinite(stop)) {
30
+ return Math.max(0, stop - start);
31
+ }
32
+ return testResults.reduce((acc, { duration = 0 }) => acc + duration, 0);
33
+ };
17
34
  export const createPluginSummary = async (params) => {
18
35
  const { name, filter, plugin, store, history, meta } = params;
19
36
  const allChecks = await store.allCheckResults();
@@ -23,7 +40,7 @@ export const createPluginSummary = async (params) => {
23
40
  const retryFlags = await Promise.all(allTrs.map(async (tr) => (await store.retriesByTr(tr)).length > 0));
24
41
  const retryTrs = allTrs.filter((_, index) => retryFlags[index]);
25
42
  const flakyTrs = allTrs.filter((tr) => !!tr?.flaky);
26
- const duration = allTrs.reduce((acc, { duration: trDuration = 0 }) => acc + trDuration, 0);
43
+ const duration = calculateRunDuration(allTrs);
27
44
  const worstStatus = getWorstStatus(allTrs.map(({ status }) => status));
28
45
  const createdAt = allTrs.reduce((acc, { stop }) => Math.max(acc, stop || 0), 0);
29
46
  return {
@@ -36,6 +53,7 @@ export const createPluginSummary = async (params) => {
36
53
  name,
37
54
  duration,
38
55
  createdAt,
56
+ ...(filter ? { filtered: true } : {}),
39
57
  plugin,
40
58
  meta,
41
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-api",
3
- "version": "3.17.0",
3
+ "version": "3.18.0",
4
4
  "description": "Allure Plugin API",
5
5
  "keywords": [
6
6
  "allure"
@@ -29,7 +29,7 @@
29
29
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
30
30
  },
31
31
  "dependencies": {
32
- "@allurereport/core-api": "3.17.0",
32
+ "@allurereport/core-api": "3.18.0",
33
33
  "tar-stream": "3.1.7"
34
34
  },
35
35
  "devDependencies": {