-
Notifications
You must be signed in to change notification settings - Fork 24
/
types.d.ts
228 lines (183 loc) · 5.51 KB
/
types.d.ts
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
declare module '@testomatio/reporter';
export interface FileType {
path: string;
type: string;
title?: string;
testId?: string;
}
/**
* Object representing a unit test result that can be sent to a reporting service.
*/
export interface TestData {
/** Unique ID of test report data to send to multiple times. */
rid: string;
/** The title of the test case being reported. */
title?: string;
/** The title of the test suite to which the test case belongs. Required when creating a new test suite inside Testomat.io. */
suite_title?: string;
/** file in which test is located */
file?: string;
/** The unique identifier from Testomat.io of the test suite to which the test case belongs. */
suite_id?: string;
/** The unique identifier from Testomat.io of the test case. If provided, updates the existing test case with the given ID. */
test_id?: string;
/** An object representing an error that occurred during the execution of the test case. */
error?: Error;
/** The time it took to execute the test case, in milliseconds. */
time?: number;
/** Additional data associated with the test case. Used for parametrized tests. */
example?: any;
/** An array of file paths or objects representing files associated with the test case. */
files?: (string | FileType)[];
/** An array of `Buffer` objects representing files associated with the test case. */
filesBuffers?: Buffer[];
/** The steps taken or logs printed during the execution of the test case. */
steps?: Step[];
/** The stack taken or logs printed during the execution of the test case. */
stack?: string;
tags?: string[];
/** The current source code of a test. Used only for JUnit or Newman reports, when we create tests from a run */
code?: string;
/** A one-line result message, usually error.message. */
message?: string;
/** Logs catched by logger */
logs?: string;
/** Manually attached artifacts */
manuallyAttachedArtifacts?: (string | { path: string; type: string })[];
/** Meta information (key: value) */
meta?: { [key: string]: any } | {};
}
/**
* Object representing a result of a Run.
*/
export interface RunData {
/** The status of the test run. */
status: RunStatus;
/** is this run a part of parallel run */
parallel: boolean;
/** mark tests not included in report as detached */
detach: boolean;
/** A boolean indicating whether new test cases should be created in Testomat.io when submitting the test run. */
create_tests?: boolean;
/** The total number of test cases in the test run. Used in JUnit report. */
tests_count?: number;
/** The number of test cases that passed in the test run. Used in JUnit report. */
passed_count?: number;
/** The number of test cases that failed in the test run. Used in JUnit report. */
failed_count?: number;
/** The number of test cases that were skipped in the test run. */
skipped_count?: number;
/** If duration is pre-set value as in XML tests set it */
duration?: number;
/**
* An array of `TestData` objects representing the individual test cases in the test run.
* Used for JUNit report when we don't send the tests in realtime but in a batch as a part of final result */
tests?: TestData[];
}
export enum TestStatus {
Passed = 'passed',
Failed = 'failed',
Skipped = 'skipped',
}
// TODO: there is a RunStatus object in constants.js; no need to use enum here;
// because it becomes complicated to infer the type
// also RunStatus enum type and RunStatus object has the same name which is confusing
export enum RunStatus {
Passed = 'passed',
Failed = 'failed',
Finished = 'finished',
}
export interface Pipe {
isEnabled: boolean;
store: {};
/** starts run */
createRun(): Promise<void>;
/** adds a test to the current run */
addTest(test: TestData): any;
/** ends the run */
finishRun(runParams: RunData): Promise<void>;
/** name of this pipe */
toString(): string;
}
export interface PipeResult {
/** Name of the pipe: Pipe.toString() */
pipe: string;
/** the result that pipe returned */
result?: any;
}
/**
* Represents a step in a test.
*/
interface Step {
category: string;
title: string;
duration: number;
steps?: Step[];
error?: any;
}
declare global {
namespace NodeJS {
interface Global {
testomatioArtifacts?: any;
testomatioDataStore?: any;
TESTOMATIO_LOGGER_CONSOLE_INTERCEPTED?: boolean;
testomatioTestTitle?: string;
}
}
}
interface WebdriverIOError {
name: string;
message: string;
stack: string;
}
interface WebdriverIOBDDTest {
type: string;
start: string;
end: string;
_duration: number;
uid: string;
cid: string;
title: string;
fullTitle: string;
output: string[];
retries: number;
parent: string;
state: string;
errors: WebdriverIOError[];
error: WebdriverIOError;
}
interface WebdriverIOHook {
type: string;
start: string;
end: string;
_duration: number;
uid: string;
cid: string;
title: string;
parent: string;
errors: string[];
}
export interface WebdriverIOScenario {
type: string;
start: string;
end: string;
_duration: number;
uid: string;
cid: string;
file: string;
title: string;
fullTitle: string;
tags: { name: string; astNodeId: string }[];
tests: WebdriverIOBDDTest[];
hooks: WebdriverIOHook[];
suites: any[];
parent: string;
hooksAndTests: (WebdriverIOHook | WebdriverIOBDDTest)[];
description: string;
}
export type {
Suite as VitestSuite,
Test as VitestTest,
File as VitestTestFile,
TestLogs as VitestTestLogs,
} from './vitest.types';