Skip to content

Commit 9a2c8a5

Browse files
committed
Fix type definitions
1 parent 875f48e commit 9a2c8a5

1 file changed

Lines changed: 45 additions & 27 deletions

File tree

index.d.ts

Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ declare module '@reportportal/client-javascript' {
5252
username: string;
5353
password: string;
5454
};
55+
/**
56+
* Optional debug logs for the proxy.
57+
*/
58+
debug?: boolean;
5559
}
5660

5761
/**
@@ -78,24 +82,19 @@ declare module '@reportportal/client-javascript' {
7882
/**
7983
* Custom HTTP agent options.
8084
*/
81-
agent?: Record<string, unknown>;
85+
agent?: any;
8286
/**
8387
* Retry configuration.
8488
*/
85-
retry?: number | {
86-
retries?: number;
87-
retryDelay?: (retryCount: number) => number;
88-
retryCondition?: (error: any) => boolean;
89-
shouldResetTimeout?: boolean;
90-
};
89+
retry?: number | any;
9190
/**
9291
* Enable debug logging.
9392
*/
9493
debug?: boolean;
9594
/**
9695
* Any other axios configuration options.
9796
*/
98-
[key: string]: unknown;
97+
[key: string]: any;
9998
}
10099

101100
/**
@@ -175,9 +174,9 @@ declare module '@reportportal/client-javascript' {
175174
*/
176175
export interface LaunchOptions {
177176
name?: string;
178-
startTime?: string;
177+
startTime?: string | number;
179178
description?: string;
180-
attributes?: Array<{ key: string; value?: string } | string>;
179+
attributes?: Array<{ key?: string; value?: string } | string>;
181180
mode?: string;
182181
id?: string;
183182
}
@@ -198,8 +197,8 @@ declare module '@reportportal/client-javascript' {
198197
name: string;
199198
type: string;
200199
description?: string;
201-
startTime?: string;
202-
attributes?: Array<{ key: string; value?: string } | string>;
200+
startTime?: string | number;
201+
attributes?: Array<{ key?: string; value?: string } | string>;
203202
hasStats?: boolean;
204203
}
205204

@@ -218,7 +217,7 @@ declare module '@reportportal/client-javascript' {
218217
export interface LogOptions {
219218
level?: string;
220219
message?: string;
221-
time?: string;
220+
time?: string | number;
222221
file?: {
223222
name: string;
224223
content: string;
@@ -239,11 +238,11 @@ declare module '@reportportal/client-javascript' {
239238
*/
240239
export interface FinishTestItemOptions {
241240
status?: string;
242-
endTime?: string;
241+
endTime?: string | number;
243242
issue?: {
244243
issueType: string;
245244
comment?: string;
246-
externalSystemIssues?: Array<any>
245+
externalSystemIssues?: Array<any>;
247246
};
248247
}
249248

@@ -258,7 +257,7 @@ declare module '@reportportal/client-javascript' {
258257
* ```
259258
*/
260259
export interface FinishLaunchOptions {
261-
endTime?: string;
260+
endTime?: string | number;
262261
status?: string;
263262
}
264263

@@ -269,7 +268,7 @@ declare module '@reportportal/client-javascript' {
269268
/**
270269
* Initializes a new Report Portal client.
271270
*/
272-
constructor(config: ReportPortalConfig);
271+
constructor(config: ReportPortalConfig, agentInfo?: { name?: string; version?: string });
273272

274273
/**
275274
* Starts a new launch.
@@ -306,7 +305,10 @@ declare module '@reportportal/client-javascript' {
306305
* await launchFinishObj.promise;
307306
* ```
308307
*/
309-
finishLaunch(launchId: string, options?: FinishLaunchOptions): Promise<any>;
308+
finishLaunch(
309+
launchId: string,
310+
options?: FinishLaunchOptions,
311+
): { tempId: string; promise: Promise<any> };
310312

311313
/**
312314
* Update the launch data
@@ -331,7 +333,10 @@ declare module '@reportportal/client-javascript' {
331333
* await updateLaunch.promise;
332334
* ```
333335
*/
334-
updateLaunch(options: LaunchOptions): { tempId: string; promise: Promise<any> };
336+
updateLaunch(
337+
launchId: string,
338+
options: LaunchOptions,
339+
): { tempId: string; promise: Promise<any> };
335340

336341
/**
337342
* Starts a new test item under a launch or parent item.
@@ -360,34 +365,47 @@ declare module '@reportportal/client-javascript' {
360365
* }, launchObj.tempId, suiteObj.tempId);
361366
* ```
362367
*/
363-
startTestItem(options: StartTestItemOptions, launchId: string, parentId?: string): {
368+
startTestItem(
369+
options: StartTestItemOptions,
370+
launchId: string,
371+
parentId?: string,
372+
): {
364373
tempId: string;
365-
promise: Promise<any>
374+
promise: Promise<any>;
366375
};
367376

368377
/**
369378
* Finishes a test item.
370379
* @example
371380
* ```typescript
372-
* rpClient.finishTestItem(itemObj.tempId, {
381+
* const finishObj = rpClient.finishTestItem(itemObj.tempId, {
373382
* status: 'failed'
374383
* });
384+
* await finishObj.promise;
375385
* ```
376386
*/
377-
finishTestItem(itemId: string, options: FinishTestItemOptions): Promise<any>;
387+
finishTestItem(
388+
itemId: string,
389+
options: FinishTestItemOptions,
390+
): { tempId: string; promise: Promise<any> };
378391

379392
/**
380393
* Sends a log entry to a test item.
381394
* @example
382395
* ```typescript
383-
* await rpClient.sendLog(stepObj.tempId, {
396+
* const logObj = rpClient.sendLog(stepObj.tempId, {
384397
* level: 'INFO',
385398
* message: 'User clicks login button',
386399
* time: rpClient.helpers.now()
387400
* });
401+
* await logObj.promise;
388402
* ```
389403
*/
390-
sendLog(itemId: string, options: LogOptions): Promise<any>;
404+
sendLog(
405+
itemId: string,
406+
options: LogOptions,
407+
file?: { name: string; content: string | Buffer; type: string },
408+
): { tempId: string; promise: Promise<any> };
391409

392410
/**
393411
* Waits for all test items to be finished.
@@ -419,7 +437,7 @@ declare module '@reportportal/client-javascript' {
419437
* });
420438
* ```
421439
*/
422-
now(): string
423-
}
440+
now(): string;
441+
};
424442
}
425443
}

0 commit comments

Comments
 (0)