@reportportal/client-javascript 5.1.2 → 5.1.4

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
@@ -64,7 +64,7 @@ When creating a client instance, you need to specify the following options:
64
64
  | isLaunchMergeRequired | Optional | false | Allows client to merge launches into one at the end of the run via saving their UUIDs to the temp files at filesystem . At the end of the run launches can be merged using `mergeLaunches` method. Temp file format: `rplaunch-${launch_uuid}.tmp`. |
65
65
  | restClientConfig | Optional | Not set | `axios` like http client [config](https://github.com/axios/axios#request-config). May contain `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, and other client options eg. `timeout`. For debugging and displaying logs you can set `debug: true`. |
66
66
  | launchUuidPrint | Optional | false | Whether to print the current launch UUID. |
67
- | launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR'. Works only if `launchUuidPrint` set to `true`. |
67
+ | 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`. |
68
68
  | token | Deprecated | Not set | Use `apiKey` instead. |
69
69
 
70
70
  ## Asynchronous reporting
package/VERSION CHANGED
@@ -1 +1 @@
1
- 5.1.3-SNAPSHOT
1
+ 5.1.5-SNAPSHOT
@@ -1,8 +1,13 @@
1
+ const helpers = require('../helpers');
2
+
1
3
  const OUTPUT_TYPES = {
2
4
  // eslint-disable-next-line no-console
3
- STDOUT: console.log,
5
+ STDOUT: (launchUuid) => console.log(`Report Portal Launch UUID: ${launchUuid}`),
4
6
  // eslint-disable-next-line no-console
5
- STDERR: console.error,
7
+ STDERR: (launchUuid) => console.error(`Report Portal Launch UUID: ${launchUuid}`),
8
+ // eslint-disable-next-line no-return-assign
9
+ ENVIRONMENT: (launchUuid) => (process.env.RP_LAUNCH_UUID = launchUuid),
10
+ FILE: helpers.saveLaunchUuidToFile,
6
11
  };
7
12
 
8
13
  module.exports = { OUTPUT_TYPES };
package/lib/helpers.js CHANGED
@@ -89,4 +89,13 @@ module.exports = {
89
89
 
90
90
  return `${codeRef}[${parameters}]`;
91
91
  },
92
+
93
+ saveLaunchUuidToFile(launchUuid) {
94
+ const filename = `rp-launch-uuid-${launchUuid}.tmp`;
95
+ fs.open(filename, 'w', (err) => {
96
+ if (err) {
97
+ throw err;
98
+ }
99
+ });
100
+ },
92
101
  };
@@ -7,7 +7,6 @@ const { getClientConfig } = require('./commons/config');
7
7
  const Statistics = require('../statistics/statistics');
8
8
  const { EVENT_NAME } = require('../statistics/constants');
9
9
  const { RP_STATUSES } = require('./constants/statuses');
10
- require('./polyfills');
11
10
 
12
11
  const MULTIPART_BOUNDARY = Math.floor(Math.random() * 10000000000).toString();
13
12
 
@@ -207,7 +206,7 @@ class RPClient {
207
206
  this.map[tempId].realId = response.id;
208
207
  this.launchUuid = response.id;
209
208
  if (this.config.launchUuidPrint) {
210
- this.config.launchUuidPrintOutput(`Report Portal Launch UUID: ${this.launchUuid}`);
209
+ this.config.launchUuidPrintOutput(this.launchUuid);
211
210
  }
212
211
 
213
212
  if (this.isLaunchMergeRequired) {
@@ -333,7 +332,8 @@ class RPClient {
333
332
  'filter.in.uuid': launchUUIds,
334
333
  'page.size': launchUUIds.length,
335
334
  });
336
- const launchSearchUrl = `launch?${params.toString()}`;
335
+ const launchSearchUrl = this.config.mode === 'DEBUG' ?
336
+ `launch/mode?${params.toString()}` : `launch?${params.toString()}`;
337
337
  this.logDebug(`Find launches with UUIDs to merge: ${launchUUIds}`);
338
338
  return this.restClient
339
339
  .retrieveSyncAPI(launchSearchUrl, { headers: this.headers })
@@ -354,8 +354,11 @@ class RPClient {
354
354
  const mergeURL = 'launch/merge';
355
355
  return this.restClient.create(mergeURL, request, { headers: this.headers });
356
356
  })
357
- .then(() => {
357
+ .then((response) => {
358
358
  this.logDebug(`Launches with UUIDs: ${launchUUIds} were successfully merged!`);
359
+ if (this.config.launchUuidPrint) {
360
+ this.config.launchUuidPrintOutput(response.uuid);
361
+ }
359
362
  })
360
363
  .catch((error) => {
361
364
  this.logDebug(`Error merging launches with UUIDs: ${launchUUIds}`, error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reportportal/client-javascript",
3
- "version": "5.1.2",
3
+ "version": "5.1.4",
4
4
  "description": "ReportPortal client for Node.js",
5
5
  "author": "ReportPortal.io",
6
6
  "scripts": {
@@ -24,9 +24,9 @@
24
24
  "node": ">=12.x"
25
25
  },
26
26
  "dependencies": {
27
- "axios": "^1.6.5",
28
- "axios-retry": "^4.0.0",
29
- "glob": "^7.2.3",
27
+ "axios": "^1.6.8",
28
+ "axios-retry": "^4.1.0",
29
+ "glob": "^8.1.0",
30
30
  "ini": "^2.0.0",
31
31
  "uniqid": "^5.4.0",
32
32
  "uuid": "^9.0.1"
package/lib/polyfills.js DELETED
@@ -1,19 +0,0 @@
1
- //! Was added to support NodeJS 10.
2
- if (!Promise.allSettled) {
3
- Promise.allSettled = function (promises) {
4
- return Promise.all(
5
- promises.map((p) =>
6
- Promise.resolve(p).then(
7
- (value) => ({
8
- status: 'fulfilled',
9
- value,
10
- }),
11
- (error) => ({
12
- status: 'rejected',
13
- reason: error,
14
- }),
15
- ),
16
- ),
17
- );
18
- };
19
- }