-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathplugin.ts
More file actions
125 lines (96 loc) · 3.17 KB
/
Copy pathplugin.ts
File metadata and controls
125 lines (96 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import type {
AttachmentLink,
CiDescriptor,
Statistic,
TestError,
TestResult,
TestStatus,
} from "@allurereport/core-api";
import type { QualityGateValidationResult } from "./qualityGate.js";
import type { ResultFile } from "./resultFile.js";
import type { AllureStore } from "./store.js";
export interface PluginDescriptor {
import?: string;
enabled?: boolean;
options?: Record<string, any>;
}
export interface ReportFiles {
addFile(path: string, data: Buffer): Promise<string>;
}
export interface PluginState {
set(key: string, value: any): Promise<void>;
get<T>(key: string): Promise<T>;
unset(key: string): Promise<void>;
}
export interface PluginContext {
id: string;
publish: boolean;
state: PluginState;
allureVersion: string;
reportUuid: string;
reportName: string;
reportFiles: ReportFiles;
reportUrl?: string;
ci?: CiDescriptor;
}
/**
* Reduced test result information that can be used in summary
*/
export type SummaryTestResult = Pick<TestResult, "name" | "id" | "status" | "duration">;
export interface AllureSummary {
href?: string;
remoteHref?: string;
jobHref?: string;
pullRequestHref?: string;
name: string;
stats: Statistic;
status: TestStatus;
duration: number;
plugin?: string;
newTests?: SummaryTestResult[];
flakyTests?: SummaryTestResult[];
retryTests?: SummaryTestResult[];
createdAt?: number;
}
export interface ExitCode {
/**
* Actual exit code the allure command exited with
*/
actual?: number;
/**
* Original exit code of the process inside the allure command exited with
*/
original: number;
}
export interface PluginGlobals {
exitCode: ExitCode;
errors: TestError[];
attachments: AttachmentLink[];
}
export interface BatchOptions {
maxTimeout?: number;
}
export interface RealtimeSubscriber {
onGlobalAttachment(listener: (attachment: ResultFile) => Promise<void>): () => void;
onGlobalExitCode(listener: (payload: ExitCode) => Promise<void>): () => void;
onGlobalError(listener: (error: TestError) => Promise<void>): () => void;
onQualityGateResults(listener: (payload: QualityGateValidationResult[]) => Promise<void>): () => void;
onTestResults(listener: (trIds: string[]) => Promise<void>, options?: BatchOptions): () => void;
onTestFixtureResults(listener: (tfrIds: string[]) => Promise<void>, options?: BatchOptions): () => void;
onAttachmentFiles(listener: (afIds: string[]) => Promise<void>, options?: BatchOptions): () => void;
}
export interface RealtimeEventsDispatcher {
sendGlobalAttachment(attachment: ResultFile): void;
sendGlobalExitCode(payload: ExitCode): void;
sendGlobalError(error: TestError): void;
sendQualityGateResults(payload: QualityGateValidationResult[]): void;
sendTestResult(trId: string): void;
sendTestFixtureResult(tfrId: string): void;
sendAttachmentFile(afId: string): void;
}
export interface Plugin {
start?(context: PluginContext, store: AllureStore, realtime: RealtimeSubscriber): Promise<void>;
update?(context: PluginContext, store: AllureStore): Promise<void>;
done?(context: PluginContext, store: AllureStore): Promise<void>;
info?(context: PluginContext, store: AllureStore): Promise<AllureSummary>;
}