@testomatio/reporter 2.3.7-beta.1-xml-import → 2.3.7-beta.100

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.
@@ -0,0 +1,364 @@
1
+ declare module '@testomatio/reporter' {
2
+ /**
3
+ * Stores path to file as artifact and uploads it to the S3 storage
4
+ * @param data - path to file or object with path, type and name
5
+ * @param context - optional context parameter
6
+ */
7
+ export function artifact(data: string | ArtifactData, context?: any): void;
8
+
9
+ /**
10
+ * Attach log message(s) to the test report
11
+ * @param args - log messages
12
+ */
13
+ export function log(...args: any[]): void;
14
+
15
+ /**
16
+ * Similar to "log" function but marks message in report as a step
17
+ * @param message - step message
18
+ */
19
+ export function step(message: string): void;
20
+
21
+ /**
22
+ * Add key-value pair(s) to the test report
23
+ * @param keyValue - object { key: value } (multiple props allowed) or key (string)
24
+ * @param value - optional value when keyValue is a string
25
+ */
26
+ export function meta(keyValue: Record<string, string> | string, value?: string | null): void;
27
+
28
+ /**
29
+ * Add a single label to the test report
30
+ * @param key - label key (e.g. 'severity', 'feature', or just 'smoke' for labels without values)
31
+ * @param value - optional label value (e.g. 'high', 'login')
32
+ */
33
+ export function label(key: string, value?: string | null): void;
34
+
35
+ /**
36
+ * Add link(s) to the test report
37
+ * @param testIds - test IDs to link
38
+ */
39
+ export function linkTest(...testIds: string[]): void;
40
+
41
+ /**
42
+ * Add JIRA issue link(s) to the test report
43
+ * @param jiraIds - JIRA issue IDs to link
44
+ */
45
+ export function linkJira(...jiraIds: string[]): void;
46
+
47
+ /**
48
+ * Logger service for intercepting and managing logs
49
+ */
50
+ export const logger: Logger;
51
+
52
+ interface ArtifactData {
53
+ path: string;
54
+ type: string;
55
+ name: string;
56
+ }
57
+
58
+ interface Logger {
59
+ logLevel: string;
60
+ prettyObjects: boolean;
61
+
62
+ /**
63
+ * Define a step inside a test. Step name is attached to the report
64
+ * @param strings - template literal strings
65
+ * @param values - template literal values
66
+ */
67
+ step(strings: any, ...values: any[]): void;
68
+
69
+ /**
70
+ * Get logs for a specific context
71
+ * @param context - testId or test context from test runner
72
+ */
73
+ getLogs(context: string): string[];
74
+
75
+ /**
76
+ * Template literal log function
77
+ * @param strings - template literal strings or message
78
+ * @param args - arguments
79
+ */
80
+ _templateLiteralLog(strings: any, ...args: any[]): void;
81
+
82
+ // Console methods
83
+ assert(...args: any[]): void;
84
+ debug(...args: any[]): void;
85
+ error(...args: any[]): void;
86
+ info(...args: any[]): void;
87
+ log(...args: any[]): void;
88
+ trace(...args: any[]): void;
89
+ warn(...args: any[]): void;
90
+
91
+ /**
92
+ * Intercept user logger messages
93
+ * @param userLogger - user's logger instance
94
+ */
95
+ intercept(userLogger: any): void;
96
+
97
+ /**
98
+ * Stop logger interception
99
+ */
100
+ stopInterception(): void;
101
+
102
+ /**
103
+ * Configure logger settings
104
+ * @param config - configuration options
105
+ */
106
+ configure(config?: LoggerConfig): void;
107
+ }
108
+
109
+ interface LoggerConfig {
110
+ logLevel?: string;
111
+ prettyObjects?: boolean;
112
+ }
113
+
114
+ const _default: {
115
+ /**
116
+ * @deprecated Use `log` or `testomat.log`
117
+ */
118
+ testomatioLogger: Logger;
119
+ artifact: typeof artifact;
120
+ log: typeof log;
121
+ logger: Logger;
122
+ meta: typeof meta;
123
+ step: typeof step;
124
+ label: typeof label;
125
+ linkTest: typeof linkTest;
126
+ linkJira: typeof linkJira;
127
+ };
128
+
129
+ export default _default;
130
+ }
131
+
132
+ export interface FileType {
133
+ path: string;
134
+ type: string;
135
+ title?: string;
136
+ testId?: string;
137
+ }
138
+
139
+ /**
140
+ * Object representing a unit test result that can be sent to a reporting service.
141
+ */
142
+ export interface TestData {
143
+ /** Unique ID of test report data to send to multiple times. */
144
+ rid?: string;
145
+
146
+ /** The title of the test case being reported. */
147
+ title?: string;
148
+
149
+ /** The title of the test suite to which the test case belongs. Required when creating a new test suite inside Testomat.io. */
150
+ suite_title?: string;
151
+
152
+ /** file in which test is located */
153
+ file?: string;
154
+
155
+ /** The unique identifier from Testomat.io of the test suite to which the test case belongs. */
156
+ suite_id?: string;
157
+
158
+ /** The unique identifier from Testomat.io of the test case. If provided, updates the existing test case with the given ID. */
159
+ test_id?: string;
160
+
161
+ /** An object representing an error that occurred during the execution of the test case. */
162
+ error?: Error;
163
+
164
+ /** The time it took to execute the test case, in milliseconds. */
165
+ time?: number;
166
+
167
+ /** Timestamp when the test was reported, in microseconds since Unix epoch. */
168
+ timestamp?: number;
169
+
170
+ /** Additional data associated with the test case. Used for parametrized tests. */
171
+ example?: any;
172
+
173
+ /** An array of file paths or objects representing files associated with the test case. */
174
+ files?: (string | FileType)[];
175
+
176
+ /** An array of `Buffer` objects representing files associated with the test case. */
177
+ filesBuffers?: Buffer[];
178
+
179
+ /** The steps taken or logs printed during the execution of the test case. */
180
+ steps?: Step[] | string;
181
+
182
+ /** The stack taken or logs printed during the execution of the test case. */
183
+ stack?: string;
184
+
185
+ tags?: string[];
186
+
187
+ /** The current source code of a test. Used only for JUnit or Newman reports, when we create tests from a run */
188
+ code?: string;
189
+
190
+ /** A one-line result message, usually error.message. */
191
+ message?: string;
192
+
193
+ /** Logs catched by logger */
194
+ logs?: string;
195
+
196
+ /** Manually attached artifacts */
197
+ manuallyAttachedArtifacts?: (string | { path: string; type: string })[];
198
+
199
+ /** Meta information (key: value) */
200
+ meta?: { [key: string]: any } | {};
201
+
202
+ /** Links array (e.g. [{test: 'TEST-123'}, {label: 'smoke'}]) */
203
+ links?: object[];
204
+
205
+ /** Whether to overwrite status of this test to avoid saving as retry (defaults to false) */
206
+ overwrite?: boolean;
207
+ }
208
+
209
+ /**
210
+ * Object representing a result of a Run.
211
+ */
212
+ export interface RunData {
213
+ /** The status of the test run. */
214
+ status: RunStatus;
215
+
216
+ /** is this run a part of parallel run */
217
+ parallel: boolean;
218
+
219
+ /** mark tests not included in report as detached */
220
+ detach: boolean;
221
+
222
+ /** A boolean indicating whether new test cases should be created in Testomat.io when submitting the test run. */
223
+ create_tests?: boolean;
224
+
225
+ /** The total number of test cases in the test run. Used in JUnit report. */
226
+ tests_count?: number;
227
+
228
+ /** The number of test cases that passed in the test run. Used in JUnit report. */
229
+ passed_count?: number;
230
+
231
+ /** The number of test cases that failed in the test run. Used in JUnit report. */
232
+ failed_count?: number;
233
+
234
+ /** The number of test cases that were skipped in the test run. */
235
+ skipped_count?: number;
236
+
237
+ /** If duration is pre-set value as in XML tests set it */
238
+ duration?: number;
239
+
240
+ /**
241
+ * An array of `TestData` objects representing the individual test cases in the test run.
242
+ * Used for JUNit report when we don't send the tests in realtime but in a batch as a part of final result */
243
+ tests?: TestData[];
244
+ }
245
+
246
+ export enum TestStatus {
247
+ Passed = 'passed',
248
+ Failed = 'failed',
249
+ Skipped = 'skipped',
250
+ }
251
+
252
+ export enum RunStatus {
253
+ Passed = 'passed',
254
+ Failed = 'failed',
255
+ Finished = 'finished',
256
+ }
257
+
258
+ export interface Pipe {
259
+ isEnabled: boolean;
260
+ store: {};
261
+
262
+ /** starts run */
263
+ createRun(): Promise<void>;
264
+
265
+ /** adds a test to the current run */
266
+ addTest(test: TestData): any;
267
+
268
+ /** ends the run */
269
+ finishRun(runParams: RunData): Promise<void>;
270
+
271
+ /** name of this pipe */
272
+ toString(): string;
273
+ }
274
+
275
+ export interface PipeResult {
276
+ /** Name of the pipe: Pipe.toString() */
277
+ pipe: string;
278
+
279
+ /** the result that pipe returned */
280
+ result?: any;
281
+ }
282
+
283
+ /**
284
+ * Represents a step in a test.
285
+ */
286
+ interface Step {
287
+ category: string;
288
+ title: string;
289
+ duration: number;
290
+ steps?: Step[];
291
+ error?: any;
292
+ }
293
+
294
+ declare global {
295
+ namespace NodeJS {
296
+ interface Global {
297
+ testomatioArtifacts?: any;
298
+ testomatioDataStore?: any;
299
+ TESTOMATIO_LOGGER_CONSOLE_INTERCEPTED?: boolean;
300
+ testomatioTestTitle?: string;
301
+ }
302
+ }
303
+ }
304
+
305
+ interface WebdriverIOError {
306
+ name: string;
307
+ message: string;
308
+ stack: string;
309
+ }
310
+
311
+ interface WebdriverIOBDDTest {
312
+ type: string;
313
+ start: string;
314
+ end: string;
315
+ _duration: number;
316
+ uid: string;
317
+ cid: string;
318
+ title: string;
319
+ fullTitle: string;
320
+ output: string[];
321
+ retries: number;
322
+ parent: string;
323
+ state: string;
324
+ errors: WebdriverIOError[];
325
+ error: WebdriverIOError;
326
+ }
327
+
328
+ interface WebdriverIOHook {
329
+ type: string;
330
+ start: string;
331
+ end: string;
332
+ _duration: number;
333
+ uid: string;
334
+ cid: string;
335
+ title: string;
336
+ parent: string;
337
+ errors: string[];
338
+ }
339
+
340
+ export interface WebdriverIOScenario {
341
+ type: string;
342
+ start: string;
343
+ end: string;
344
+ _duration: number;
345
+ uid: string;
346
+ cid: string;
347
+ file: string;
348
+ title: string;
349
+ fullTitle: string;
350
+ tags: { name: string; astNodeId: string }[];
351
+ tests: WebdriverIOBDDTest[];
352
+ hooks: WebdriverIOHook[];
353
+ suites: any[];
354
+ parent: string;
355
+ hooksAndTests: (WebdriverIOHook | WebdriverIOBDDTest)[];
356
+ description: string;
357
+ }
358
+
359
+ export type {
360
+ Suite as VitestSuite,
361
+ Test as VitestTest,
362
+ File as VitestTestFile,
363
+ TestLogs as VitestTestLogs,
364
+ } from './vitest.types';
@@ -0,0 +1,93 @@
1
+ type RunMode = 'run' | 'skip' | 'only' | 'todo';
2
+ type TaskState = RunMode | 'pass' | 'fail';
3
+ type Task = Test | Suite | File;
4
+
5
+ interface File extends Suite {
6
+ filepath: string;
7
+ collectDuration?: number;
8
+ setupDuration?: number;
9
+ }
10
+
11
+ interface Suite extends TaskBase {
12
+ type: 'suite';
13
+ tasks: Task[];
14
+ filepath?: string;
15
+ projectName: string;
16
+ }
17
+
18
+ type ErrorWithDiff = {
19
+ cause: string;
20
+ message: string;
21
+ name: string;
22
+ nameStr?: string;
23
+ stack?: string;
24
+ stackStr?: string;
25
+ stacks?: {
26
+ method: string;
27
+ file: string;
28
+ line: number;
29
+ column: number;
30
+ };
31
+ showDiff?: boolean;
32
+ actual?: any;
33
+ expected?: any;
34
+ operator?: string;
35
+ type?: string;
36
+ frame?: string;
37
+ diff?: string;
38
+ codeFrame?: string;
39
+ };
40
+
41
+ interface TaskResult {
42
+ state: TaskState;
43
+ duration?: number;
44
+ startTime?: number;
45
+ heap?: number;
46
+ errors?: ErrorWithDiff[];
47
+ htmlError?: string;
48
+ hooks?: Partial<Record<'beforeAll' | 'afterAll' | 'beforeEach' | 'afterEach', TaskState>>;
49
+ retryCount?: number;
50
+ repeatCount?: number;
51
+ }
52
+
53
+ interface TaskBase {
54
+ id: string;
55
+ name: string;
56
+ mode: RunMode;
57
+ meta: {};
58
+ each?: boolean;
59
+ concurrent?: boolean;
60
+ shuffle?: boolean;
61
+ suite?: Suite;
62
+ file?: File;
63
+ result?: TaskResult;
64
+ retry?: number;
65
+ repeats?: number;
66
+ location?: {
67
+ line: number;
68
+ column: number;
69
+ };
70
+ }
71
+
72
+ export type TestLogs = {
73
+ content: string;
74
+ size: number;
75
+ taskId: string;
76
+ time: number;
77
+ type: 'stdout' | 'stderr';
78
+ };
79
+
80
+ type FileResult = {
81
+ duration: number;
82
+ hooks: {
83
+ beforeEach: TaskState;
84
+ afterEach: TaskState;
85
+ };
86
+ startTime: number;
87
+ state: TaskState;
88
+ };
89
+
90
+ export type Test = TaskBase & {
91
+ logs: TestLogs[];
92
+ type: 'test';
93
+ };
@@ -1,82 +0,0 @@
1
- /**
2
- * Enhanced NUnit XML Parser that properly handles test-suite hierarchy
3
- * and parameterized tests
4
- */
5
- export class NUnitXmlParser {
6
- constructor(options?: {});
7
- options: {};
8
- tests: any[];
9
- stats: {
10
- total: number;
11
- passed: number;
12
- failed: number;
13
- skipped: number;
14
- inconclusive: number;
15
- };
16
- /**
17
- * Parse NUnit XML test-run structure
18
- * @param {Object} testRun - Parsed XML test-run object
19
- * @returns {Object} - Parsed test results
20
- */
21
- parseTestRun(testRun: any): any;
22
- /**
23
- * Recursively parse test-suite elements based on their type
24
- * @param {Object|Array} testSuite - Test suite object or array
25
- * @param {Array} parentPath - Current path in the hierarchy
26
- */
27
- parseTestSuite(testSuite: any | any[], parentPath?: any[]): void;
28
- /**
29
- * Process child elements of a test suite
30
- * @param {Object} testSuite - Test suite object
31
- * @param {Array} currentPath - Current path in hierarchy
32
- */
33
- processChildren(testSuite: any, currentPath: any[]): void;
34
- /**
35
- * Parse test-case elements (actual tests)
36
- * @param {Object|Array} testCases - Test case object or array
37
- * @param {Array} suitePath - Path to the test suite
38
- * @param {Object} parentSuite - Parent test suite for context
39
- */
40
- parseTestCases(testCases: any | any[], suitePath: any[], parentSuite: any): void;
41
- /**
42
- * Parse individual test case
43
- * @param {Object} testCase - Test case object
44
- * @param {Array} suitePath - Path to the test suite
45
- * @param {Object} parentSuite - Parent test suite for context
46
- * @returns {Object|null} - Parsed test object
47
- */
48
- parseTestCase(testCase: any, suitePath: any[], parentSuite: any): any | null;
49
- /**
50
- * Extract method name and parameters from test name
51
- * @param {string} testName - Full test name
52
- * @returns {Object} - Extracted information
53
- */
54
- extractParameters(testName: string): any;
55
- /**
56
- * Parse parameter string into array of parameters
57
- * @param {string} paramString - Parameter string
58
- * @returns {Array} - Array of parameters
59
- */
60
- parseParameterString(paramString: string): any[];
61
- /**
62
- * Extract method name from test name (fallback)
63
- * @param {string} testName - Test name
64
- * @returns {string} - Method name
65
- */
66
- extractMethodName(testName: string): string;
67
- /**
68
- * Build file path from suite path and class name
69
- * @param {Array} suitePath - Suite path array
70
- * @param {string} className - Class name
71
- * @param {Object} parentSuite - Parent suite for context
72
- * @returns {string} - File path
73
- */
74
- buildFilePath(suitePath: any[], className: string, parentSuite: any): string;
75
- /**
76
- * Group parameterized tests by base method name
77
- * @param {Array} tests - Array of parsed tests
78
- * @returns {Object} - Grouped tests
79
- */
80
- groupParameterizedTests(tests: any[]): any;
81
- }
82
- export default NUnitXmlParser;