@reportportal/client-javascript 5.5.7 → 5.5.9

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/README.md CHANGED
@@ -122,7 +122,7 @@ rpClient.checkConnect().then(() => {
122
122
  | restClientConfig | Optional | Not set | Check the details in the [HTTP client config](#http-client-options). |
123
123
  | launchUuidPrint | Optional | false | Whether to print the current launch UUID. |
124
124
  | launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR', 'FILE', 'ENVIRONMENT'. Works only if `launchUuidPrint` set to `true`. File format: `rp-launch-uuid-${launch_uuid}.tmp`. Env variable: `RP_LAUNCH_UUID`. |
125
- | token | Deprecated | Not set | Use `apiKey` or `oauth` instead. |
125
+ | skippedIsNotIssue | Optional | False | ReportPortal provides feature to mark skipped tests as not 'To Investigate'. Option could be equal boolean values: `true` - skipped tests will not be marked as 'To Investigate' on application. `false` - skipped tests considered as issues and will be marked as 'To Investigate' on application. |
126
126
 
127
127
  ### HTTP client options
128
128
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 5.5.8-SNAPSHOT
1
+ 5.5.10-SNAPSHOT
package/index.d.ts ADDED
@@ -0,0 +1,425 @@
1
+ declare module '@reportportal/client-javascript' {
2
+ /**
3
+ * OAuth 2.0 configuration for password grant flow.
4
+ */
5
+ export interface OAuthConfig {
6
+ /**
7
+ * OAuth 2.0 token endpoint URL for password grant flow.
8
+ */
9
+ tokenEndpoint: string;
10
+ /**
11
+ * Username for OAuth 2.0 password grant.
12
+ */
13
+ username: string;
14
+ /**
15
+ * Password for OAuth 2.0 password grant.
16
+ */
17
+ password: string;
18
+ /**
19
+ * OAuth 2.0 client ID.
20
+ */
21
+ clientId: string;
22
+ /**
23
+ * OAuth 2.0 client secret (optional, depending on your OAuth server configuration).
24
+ */
25
+ clientSecret?: string;
26
+ /**
27
+ * OAuth 2.0 scope (optional, space-separated list of scopes).
28
+ */
29
+ scope?: string;
30
+ }
31
+
32
+ /**
33
+ * Proxy configuration object.
34
+ */
35
+ export interface ProxyConfig {
36
+ /**
37
+ * Protocol for the proxy (http or https).
38
+ */
39
+ protocol?: string;
40
+ /**
41
+ * Proxy host.
42
+ */
43
+ host: string;
44
+ /**
45
+ * Proxy port.
46
+ */
47
+ port: number;
48
+ /**
49
+ * Optional authentication for the proxy.
50
+ */
51
+ auth?: {
52
+ username: string;
53
+ password: string;
54
+ };
55
+ }
56
+
57
+ /**
58
+ * REST client configuration options.
59
+ */
60
+ export interface RestClientConfig {
61
+ /**
62
+ * Request timeout in milliseconds.
63
+ */
64
+ timeout?: number;
65
+ /**
66
+ * Proxy configuration. Can be:
67
+ * - false: Disable proxy
68
+ * - string: Proxy URL (e.g., 'http://proxy.example.com:8080')
69
+ * - ProxyConfig object: Detailed proxy configuration
70
+ */
71
+ proxy?: false | string | ProxyConfig;
72
+ /**
73
+ * Comma-separated list of domains to bypass proxy.
74
+ * Example: 'localhost,127.0.0.1,.example.com'
75
+ * This takes precedence over NO_PROXY environment variable.
76
+ */
77
+ noProxy?: string;
78
+ /**
79
+ * Custom HTTP agent options.
80
+ */
81
+ agent?: Record<string, unknown>;
82
+ /**
83
+ * Retry configuration.
84
+ */
85
+ retry?: number | {
86
+ retries?: number;
87
+ retryDelay?: (retryCount: number) => number;
88
+ retryCondition?: (error: any) => boolean;
89
+ shouldResetTimeout?: boolean;
90
+ };
91
+ /**
92
+ * Enable debug logging.
93
+ */
94
+ debug?: boolean;
95
+ /**
96
+ * Any other axios configuration options.
97
+ */
98
+ [key: string]: unknown;
99
+ }
100
+
101
+ /**
102
+ * Configuration options for initializing the Report Portal client.
103
+ *
104
+ * @example API Key Authentication
105
+ * ```typescript
106
+ * const rp = new ReportPortalClient({
107
+ * endpoint: 'https://your.reportportal.server/api/v1',
108
+ * project: 'your_project_name',
109
+ * apiKey: 'your_api_key',
110
+ * });
111
+ * ```
112
+ *
113
+ * @example OAuth 2.0 Authentication
114
+ * ```typescript
115
+ * const rp = new ReportPortalClient({
116
+ * endpoint: 'https://your.reportportal.server/api/v1',
117
+ * project: 'your_project_name',
118
+ * oauth: {
119
+ * tokenEndpoint: 'https://your-oauth-server.com/oauth/token',
120
+ * username: 'your-username',
121
+ * password: 'your-password',
122
+ * clientId: 'your-client-id',
123
+ * clientSecret: 'your-client-secret', // optional
124
+ * scope: 'reportportal', // optional
125
+ * }
126
+ * });
127
+ * ```
128
+ *
129
+ * @example With Proxy Configuration
130
+ * ```typescript
131
+ * const rp = new ReportPortalClient({
132
+ * endpoint: 'https://your.reportportal.server/api/v1',
133
+ * project: 'your_project_name',
134
+ * apiKey: 'your_api_key',
135
+ * restClientConfig: {
136
+ * proxy: {
137
+ * protocol: 'https',
138
+ * host: '127.0.0.1',
139
+ * port: 8080,
140
+ * },
141
+ * noProxy: 'localhost,.local.domain',
142
+ * }
143
+ * });
144
+ * ```
145
+ */
146
+ export interface ReportPortalConfig {
147
+ apiKey?: string;
148
+ endpoint: string;
149
+ launch: string;
150
+ project: string;
151
+ headers?: Record<string, string>;
152
+ debug?: boolean;
153
+ isLaunchMergeRequired?: boolean;
154
+ launchUuidPrint?: boolean;
155
+ launchUuidPrintOutput?: string;
156
+ restClientConfig?: RestClientConfig;
157
+ token?: string;
158
+ skippedIsNotIssue?: boolean;
159
+ /**
160
+ * OAuth 2.0 configuration object. When provided, OAuth authentication will be used instead of API key.
161
+ */
162
+ oauth?: OAuthConfig;
163
+ }
164
+
165
+ /**
166
+ * Options to start a new launch.
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * const launch = rp.startLaunch({
171
+ * name: 'My Test Launch',
172
+ * startTime: rp.helpers.now(),
173
+ * });
174
+ * ```
175
+ */
176
+ export interface LaunchOptions {
177
+ name?: string;
178
+ startTime?: string;
179
+ description?: string;
180
+ attributes?: Array<{ key: string; value?: string } | string>;
181
+ mode?: string;
182
+ id?: string;
183
+ }
184
+
185
+ /**
186
+ * Options to start a new test item (e.g., test case or suite).
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * const testItem = rp.startTestItem({
191
+ * name: 'My Test Case',
192
+ * type: 'TEST',
193
+ * startTime: rp.helpers.now(),
194
+ * });
195
+ * ```
196
+ */
197
+ export interface StartTestItemOptions {
198
+ name: string;
199
+ type: string;
200
+ description?: string;
201
+ startTime?: string;
202
+ attributes?: Array<{ key: string; value?: string } | string>;
203
+ hasStats?: boolean;
204
+ }
205
+
206
+ /**
207
+ * Options to send logs to Report Portal.
208
+ *
209
+ * @example
210
+ * ```typescript
211
+ * await rp.sendLog(testItem.tempId, {
212
+ * level: 'INFO',
213
+ * message: 'Step executed successfully',
214
+ * time: rp.helpers.now(),
215
+ * });
216
+ * ```
217
+ */
218
+ export interface LogOptions {
219
+ level?: string;
220
+ message?: string;
221
+ time?: string;
222
+ file?: {
223
+ name: string;
224
+ content: string;
225
+ type: string;
226
+ };
227
+ }
228
+
229
+ /**
230
+ * Options to finish a test item.
231
+ *
232
+ * @example
233
+ * ```typescript
234
+ * await rp.finishTestItem(testItem.tempId, {
235
+ * status: 'PASSED',
236
+ * endTime: rp.helpers.now(),
237
+ * });
238
+ * ```
239
+ */
240
+ export interface FinishTestItemOptions {
241
+ status?: string;
242
+ endTime?: string;
243
+ issue?: {
244
+ issueType: string;
245
+ comment?: string;
246
+ externalSystemIssues?: Array<any>
247
+ };
248
+ }
249
+
250
+ /**
251
+ * Options to finish a launch.
252
+ *
253
+ * @example
254
+ * ```typescript
255
+ * await rp.finishLaunch(launch.tempId, {
256
+ * endTime: rp.helpers.now(),
257
+ * });
258
+ * ```
259
+ */
260
+ export interface FinishLaunchOptions {
261
+ endTime?: string;
262
+ status?: string;
263
+ }
264
+
265
+ /**
266
+ * Main Report Portal client for interacting with the API.
267
+ */
268
+ export default class ReportPortalClient {
269
+ /**
270
+ * Initializes a new Report Portal client.
271
+ */
272
+ constructor(config: ReportPortalConfig);
273
+
274
+ /**
275
+ * Starts a new launch.
276
+ * @example
277
+ * ```typescript
278
+ * const launchObj = rpClient.startLaunch({
279
+ * name: 'Client test',
280
+ * startTime: rpClient.helpers.now(),
281
+ * description: 'description of the launch',
282
+ * attributes: [
283
+ * {
284
+ * 'key': 'yourKey',
285
+ * 'value': 'yourValue'
286
+ * },
287
+ * {
288
+ * 'value': 'yourValue'
289
+ * }
290
+ * ],
291
+ * //this param used only when you need client to send data into the existing launch
292
+ * id: 'id'
293
+ * });
294
+ * await launchObj.promise;
295
+ * ```
296
+ */
297
+ startLaunch(options: LaunchOptions): { tempId: string; promise: Promise<any> };
298
+
299
+ /**
300
+ * Finishes an active launch.
301
+ * @example
302
+ * ```typescript
303
+ * const launchFinishObj = rpClient.finishLaunch(launchObj.tempId, {
304
+ * endTime: rpClient.helpers.now()
305
+ * });
306
+ * await launchFinishObj.promise;
307
+ * ```
308
+ */
309
+ finishLaunch(launchId: string, options?: FinishLaunchOptions): Promise<any>;
310
+
311
+ /**
312
+ * Update the launch data
313
+ * @example
314
+ * ```typescript
315
+ * const updateLunch = rpClient.updateLaunch(
316
+ * launchObj.tempId,
317
+ * {
318
+ * description: 'new launch description',
319
+ * attributes: [
320
+ * {
321
+ * key: 'yourKey',
322
+ * value: 'yourValue'
323
+ * },
324
+ * {
325
+ * value: 'yourValue'
326
+ * }
327
+ * ],
328
+ * mode: 'DEBUG'
329
+ * }
330
+ * );
331
+ * await updateLaunch.promise;
332
+ * ```
333
+ */
334
+ updateLaunch(options: LaunchOptions): { tempId: string; promise: Promise<any> };
335
+
336
+ /**
337
+ * Starts a new test item under a launch or parent item.
338
+ * @example
339
+ * ```typescript
340
+ * const suiteObj = rpClient.startTestItem({
341
+ * description: makeid(),
342
+ * name: makeid(),
343
+ * startTime: rpClient.helpers.now(),
344
+ * type: 'SUITE'
345
+ * }, launchObj.tempId);
346
+ * const stepObj = rpClient.startTestItem({
347
+ * description: makeid(),
348
+ * name: makeid(),
349
+ * startTime: rpClient.helpers.now(),
350
+ * attributes: [
351
+ * {
352
+ * key: 'yourKey',
353
+ * value: 'yourValue'
354
+ * },
355
+ * {
356
+ * value: 'yourValue'
357
+ * }
358
+ * ],
359
+ * type: 'STEP'
360
+ * }, launchObj.tempId, suiteObj.tempId);
361
+ * ```
362
+ */
363
+ startTestItem(options: StartTestItemOptions, launchId: string, parentId?: string): {
364
+ tempId: string;
365
+ promise: Promise<any>
366
+ };
367
+
368
+ /**
369
+ * Finishes a test item.
370
+ * @example
371
+ * ```typescript
372
+ * rpClient.finishTestItem(itemObj.tempId, {
373
+ * status: 'failed'
374
+ * });
375
+ * ```
376
+ */
377
+ finishTestItem(itemId: string, options: FinishTestItemOptions): Promise<any>;
378
+
379
+ /**
380
+ * Sends a log entry to a test item.
381
+ * @example
382
+ * ```typescript
383
+ * await rpClient.sendLog(stepObj.tempId, {
384
+ * level: 'INFO',
385
+ * message: 'User clicks login button',
386
+ * time: rpClient.helpers.now()
387
+ * });
388
+ * ```
389
+ */
390
+ sendLog(itemId: string, options: LogOptions): Promise<any>;
391
+
392
+ /**
393
+ * Waits for all test items to be finished.
394
+ * @example
395
+ * ```typescript
396
+ * await agent.getPromiseFinishAllItems(agent.tempLaunchId);
397
+ * ```
398
+ */
399
+ getPromiseFinishAllItems(launchId: string): Promise<any>;
400
+
401
+ /**
402
+ * Check if connection is established
403
+ * @example
404
+ * ```typescript
405
+ * await agent.checkConnect();
406
+ * ```
407
+ */
408
+ checkConnect(): Promise<any>;
409
+
410
+ helpers: {
411
+ /**
412
+ * Generate ISO timestamp
413
+ * @example
414
+ * ```typescript
415
+ * await rpClient.sendLog(stepObj.tempId, {
416
+ * level: 'INFO',
417
+ * message: 'User clicks login button',
418
+ * time: rpClient.helpers.now()
419
+ * });
420
+ * ```
421
+ */
422
+ now(): string
423
+ }
424
+ }
425
+ }
@@ -115,6 +115,7 @@ const getClientConfig = (options) => {
115
115
  description: options.description,
116
116
  launchUuidPrint: options.launchUuidPrint,
117
117
  launchUuidPrintOutput,
118
+ skippedIsNotIssue: !!options.skippedIsNotIssue,
118
119
  };
119
120
  } catch (error) {
120
121
  // don't throw the error up to not break the entire process
@@ -202,6 +202,14 @@ class RPClient {
202
202
  this.launchUuid = launchDataRQ.id;
203
203
  } else {
204
204
  const systemAttr = helpers.getSystemAttribute();
205
+ if (this.config.skippedIsNotIssue === true) {
206
+ const skippedIsNotIssueAttribute = {
207
+ key: 'skippedIssue',
208
+ value: 'false',
209
+ system: true,
210
+ };
211
+ systemAttr.push(skippedIsNotIssueAttribute);
212
+ }
205
213
  const attributes = Array.isArray(launchDataRQ.attributes)
206
214
  ? launchDataRQ.attributes.concat(systemAttr)
207
215
  : systemAttr;
@@ -612,6 +620,13 @@ class RPClient {
612
620
  ...finishTestItemRQ,
613
621
  };
614
622
 
623
+ if (
624
+ finishTestItemData.status === RP_STATUSES.SKIPPED &&
625
+ this.config.skippedIsNotIssue === true
626
+ ) {
627
+ finishTestItemData.issue = { issueType: 'NOT_ISSUE' };
628
+ }
629
+
615
630
  itemObj.finishSend = true;
616
631
  this.logDebug(`Finish all children for test item with tempId ${itemTempId}`);
617
632
  Promise.allSettled(
package/lib/rest.js CHANGED
@@ -150,7 +150,7 @@ method: ${method}`,
150
150
  getRetryConfig() {
151
151
  const retryOption = this.restClientConfig?.retry;
152
152
  const onRetry = (retryCount, error, requestConfig) => {
153
- if (this.restClientConfig.debug) {
153
+ if (this.restClientConfig?.debug) {
154
154
  console.log(`[retry #${retryCount}] ${requestConfig.method?.toUpperCase()} ${requestConfig.url} -> ${error.code || error.message}`);
155
155
  }
156
156
  };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@reportportal/client-javascript",
3
- "version": "5.5.7",
3
+ "version": "5.5.9",
4
4
  "description": "ReportPortal client for Node.js",
5
5
  "author": "ReportPortal.io",
6
6
  "scripts": {
7
7
  "build": "npm run clean && tsc",
8
8
  "clean": "rimraf ./build",
9
- "lint": "eslint ./statistics/**/* ./lib/**/* ./__tests__/**/*",
9
+ "lint": "eslint ./statistics/**/* ./lib/**/*",
10
10
  "format": "npm run lint -- --fix",
11
11
  "test": "jest",
12
12
  "test:coverage": "jest --coverage"
@@ -17,7 +17,8 @@
17
17
  "files": [
18
18
  "/lib",
19
19
  "/statistics",
20
- "/VERSION"
20
+ "/VERSION",
21
+ "index.d.ts"
21
22
  ],
22
23
  "main": "./lib/report-portal-client",
23
24
  "types": "./index.d.ts",
@@ -27,7 +28,7 @@
27
28
  "dependencies": {
28
29
  "axios": "^1.12.2",
29
30
  "axios-retry": "^4.5.0",
30
- "glob": "^11.1.0",
31
+ "glob": "^13.0.1",
31
32
  "http-proxy-agent": "^7.0.2",
32
33
  "https-proxy-agent": "^7.0.6",
33
34
  "ini": "^2.0.0",