@allurereport/plugin-api 3.17.0 → 3.19.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 +3 -1
- package/dist/plugin.d.ts +11 -0
- package/dist/qualityGate.d.ts +4 -0
- package/dist/report.d.ts +3 -1
- package/dist/store.d.ts +2 -2
- package/dist/store.js +1 -1
- package/dist/utils/summary.d.ts +1 -0
- package/dist/utils/summary.js +21 -2
- package/package.json +2 -2
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AllureServiceConfig, CategoriesConfig, DefaultLabelsConfig, EnvironmentsConfig, PerformanceConfig, ReportVariables, ResolutionsConfig } from "@allurereport/core-api";
|
|
1
|
+
import type { AllureServiceConfig, CategoriesConfig, DefaultLabelsConfig, EnvironmentsConfig, FlakyDetectionConfig, PerformanceConfig, ReportVariables, ResolutionsConfig } from "@allurereport/core-api";
|
|
2
2
|
import type { PluginDescriptor } from "./plugin.js";
|
|
3
3
|
import type { QualityGateConfig } from "./qualityGate.js";
|
|
4
4
|
export interface Config {
|
|
@@ -8,7 +8,9 @@ export interface Config {
|
|
|
8
8
|
port?: string;
|
|
9
9
|
hideLabels?: (string | RegExp)[];
|
|
10
10
|
historyPath?: string;
|
|
11
|
+
historyBaseUrl?: string;
|
|
11
12
|
historyLimit?: number;
|
|
13
|
+
flakyDetection?: FlakyDetectionConfig;
|
|
12
14
|
resolutions?: ResolutionsConfig;
|
|
13
15
|
defaultLabels?: DefaultLabelsConfig;
|
|
14
16
|
dump?: string;
|
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;
|
package/dist/qualityGate.d.ts
CHANGED
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;
|
|
@@ -102,7 +104,7 @@ export type ReportSearchDocument = {
|
|
|
102
104
|
nodeId: string;
|
|
103
105
|
name: string;
|
|
104
106
|
fullName?: string;
|
|
105
|
-
|
|
107
|
+
retryHash?: string | null;
|
|
106
108
|
labels?: string;
|
|
107
109
|
owner?: string;
|
|
108
110
|
tags?: string;
|
package/dist/store.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ export interface AllureStoreDump {
|
|
|
84
84
|
qualityGateResults: QualityGateValidationResult[];
|
|
85
85
|
metrics?: MetricSample[];
|
|
86
86
|
indexAttachmentByTestResult: Record<string, string[]>;
|
|
87
|
-
|
|
87
|
+
indexTestResultByRetryHash: Record<string, string[]>;
|
|
88
88
|
indexTestResultByTestCase: Record<string, string[]>;
|
|
89
89
|
indexTestResultByResolutionIssue: Record<string, string[]>;
|
|
90
90
|
indexAttachmentByFixture: Record<string, string[]>;
|
|
@@ -103,7 +103,7 @@ export declare enum AllureStoreDumpFiles {
|
|
|
103
103
|
ReportVariables = "report-variables.json",
|
|
104
104
|
ResolutionIssues = "resolution-issues.json",
|
|
105
105
|
IndexAttachmentsByTestResults = "index-attachments-by-test-results.json",
|
|
106
|
-
|
|
106
|
+
IndexTestResultsByRetryHash = "index-test-results-by-retry-hash.json",
|
|
107
107
|
IndexTestResultsByTestCase = "index-test-results-by-test-case.json",
|
|
108
108
|
IndexTestResultsByResolutionIssue = "index-test-results-by-resolution-issue.json",
|
|
109
109
|
IndexAttachmentsByFixture = "index-attachments-by-fixture.json",
|
package/dist/store.js
CHANGED
|
@@ -11,7 +11,7 @@ export var AllureStoreDumpFiles;
|
|
|
11
11
|
AllureStoreDumpFiles["ReportVariables"] = "report-variables.json";
|
|
12
12
|
AllureStoreDumpFiles["ResolutionIssues"] = "resolution-issues.json";
|
|
13
13
|
AllureStoreDumpFiles["IndexAttachmentsByTestResults"] = "index-attachments-by-test-results.json";
|
|
14
|
-
AllureStoreDumpFiles["
|
|
14
|
+
AllureStoreDumpFiles["IndexTestResultsByRetryHash"] = "index-test-results-by-retry-hash.json";
|
|
15
15
|
AllureStoreDumpFiles["IndexTestResultsByTestCase"] = "index-test-results-by-test-case.json";
|
|
16
16
|
AllureStoreDumpFiles["IndexTestResultsByResolutionIssue"] = "index-test-results-by-resolution-issue.json";
|
|
17
17
|
AllureStoreDumpFiles["IndexAttachmentsByFixture"] = "index-attachments-by-fixture.json";
|
package/dist/utils/summary.d.ts
CHANGED
|
@@ -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;
|
package/dist/utils/summary.js
CHANGED
|
@@ -14,28 +14,47 @@ 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();
|
|
20
37
|
const allTrs = await store.allTestResults({ filter });
|
|
38
|
+
const currentIds = new Set(allTrs.map(({ id }) => id));
|
|
21
39
|
const mainBranchHistory = (await history?.readHistory?.({ branch: "" })) ?? [];
|
|
22
40
|
const newTrs = await store.allNewTestResults(filter, mainBranchHistory);
|
|
23
41
|
const retryFlags = await Promise.all(allTrs.map(async (tr) => (await store.retriesByTr(tr)).length > 0));
|
|
24
42
|
const retryTrs = allTrs.filter((_, index) => retryFlags[index]);
|
|
25
43
|
const flakyTrs = allTrs.filter((tr) => !!tr?.flaky);
|
|
26
|
-
const duration = allTrs
|
|
44
|
+
const duration = calculateRunDuration(allTrs);
|
|
27
45
|
const worstStatus = getWorstStatus(allTrs.map(({ status }) => status));
|
|
28
46
|
const createdAt = allTrs.reduce((acc, { stop }) => Math.max(acc, stop || 0), 0);
|
|
29
47
|
return {
|
|
30
48
|
stats: await store.testsStatistic(filter),
|
|
31
49
|
status: worstStatus ?? "passed",
|
|
32
|
-
newTests: newTrs.map(({ id }) => id),
|
|
50
|
+
newTests: newTrs.filter(({ id }) => currentIds.has(id)).map(({ id }) => id),
|
|
33
51
|
flakyTests: flakyTrs.map(({ id }) => id),
|
|
34
52
|
retryTests: retryTrs.map(({ id }) => id),
|
|
35
53
|
checks: allChecks.map(convertToSummaryCheckResult),
|
|
36
54
|
name,
|
|
37
55
|
duration,
|
|
38
56
|
createdAt,
|
|
57
|
+
...(filter ? { filtered: true } : {}),
|
|
39
58
|
plugin,
|
|
40
59
|
meta,
|
|
41
60
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.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.
|
|
32
|
+
"@allurereport/core-api": "3.19.0",
|
|
33
33
|
"tar-stream": "3.1.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|