@reportportal/client-javascript 5.0.5 → 5.0.7

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/CHANGELOG.md CHANGED
@@ -1,4 +1,16 @@
1
1
 
2
+ ## [5.0.7] - 2022-12-26
3
+ ### Added
4
+ - The ability to see verbose logs in debug mode. To enable the debug mode, the `debug: true` flag should be specified in `params`.
5
+ ### Security
6
+ - Updated versions of vulnerable packages (ajv, qs, follow-redirects, minimatch).
7
+
8
+ ## [5.0.6] - 2022-01-13
9
+ ### Fixed
10
+ - Security vulnerabilities (axios, path-parse, minimist)
11
+ ### Changed
12
+ - Package size reduced
13
+
2
14
  ## [5.0.5] - 2021-05-25
3
15
  ### Added
4
16
  - Possibility to change Axios Requests timeout (closes [#115](https://github.com/reportportal/client-javascript/issues/115))
@@ -33,6 +45,5 @@
33
45
  ## [5.0.0] - 2020-06-09
34
46
  ### Added
35
47
  - Full compatibility with ReportPortal version 5.* (see [reportportal releases](https://github.com/reportportal/reportportal/releases))
36
-
37
48
  ### Deprecated
38
49
  - Previous package version (`reportportal-client`) will no longer supported by reportportal.io
package/README.md CHANGED
@@ -12,6 +12,9 @@ Library is used only for implementors of custom listeners for ReportPortal.
12
12
  * [Cucumber integration](https://github.com/reportportal/agent-js-cucumber)
13
13
  * [Codecept integration](https://github.com/reportportal/agent-js-codecept)
14
14
  * [Postman integration](https://github.com/reportportal/agent-js-postman)
15
+ * [TestCafe integration](https://github.com/reportportal/agent-js-testcafe)
16
+ * [Webdriverio integration](https://github.com/reportportal/agent-js-webdriverio)
17
+ * [Playwright integration](https://github.com/reportportal/agent-js-playwright)
15
18
 
16
19
  Examples for test framework integrations from the list above described in [examples](https://github.com/reportportal/examples-js) repository.
17
20
 
@@ -45,14 +48,16 @@ rpClient.checkConnect().then((response) => {
45
48
  ## Settings
46
49
  When creating a client instance, you need to specify the following parameters:
47
50
 
48
- Parameter | Description
49
- --------- | -----------
50
- token | User's token Report Portal from which you want to send requests. It can be found on the profile page of this user.
51
- endpoint | URL of your server. For example, if you visit the page at 'https://server:8080/ui', then endpoint will be equal to 'https://server:8080/api/v1'.
52
- launch | Name of launch at creation.
53
- project | The name of the project in which the launches will be created.
54
- headers | (optional) The object with custom headers for internal http client.
55
- restClientConfig | (optional) The object with `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, may contain other client options eg. `timeout`.
51
+ | Parameter | Description |
52
+ |-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
53
+ | token | User's token Report Portal from which you want to send requests. It can be found on the profile page of this user. |
54
+ | endpoint | URL of your server. For example, if you visit the page at 'https://server:8080/ui', then endpoint will be equal to 'https://server:8080/api/v1'. |
55
+ | launch | Name of launch at creation. |
56
+ | project | The name of the project in which the launches will be created. |
57
+ | headers | (optional) The object with custom headers for internal http client. |
58
+ | debug | (optional) *Default: false.* This flag allows seeing the logs of the client. Useful for debugging. |
59
+ | isLaunchMergeRequired | (optional) *Default: false.* Allows client to merge launches into one at the end of the run via saving their UUIDs to the file system. At the end of the run launches can be merged using `mergeLaunches` method. |
60
+ | restClientConfig | (optional) The object with `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, may contain other client options eg. `timeout`. |
56
61
 
57
62
  ## Asynchronous reporting
58
63
  The client supports an asynchronous reporting.
@@ -71,7 +76,7 @@ The client works synchronously, so it is not necessary to wait for the end of th
71
76
  ### Timeout (30000ms) on axios requests
72
77
  There is a timeout on axios requests. If for instance the server your making a request to is taking too long to load, then axios timeout will work and you will see the error "Error: timeout of 30000ms exceeded".
73
78
 
74
- You can simply change this timeout by adding a `timeout` property to `restClientConfig` with your desired numeric value.
79
+ You can simply change this timeout by adding a `timeout` property to `restClientConfig` with your desired numeric value (in _ms_) or *0* to disable it.
75
80
 
76
81
  ### checkConnect
77
82
  checkConnect - asynchronous method for verifying the correctness of the client connection
package/VERSION CHANGED
@@ -1 +1 @@
1
- 5.0.5
1
+ 5.0.7
@@ -2,14 +2,14 @@ const ua = require('universal-analytics');
2
2
  const { GOOGLE_ANALYTICS_INSTANCE } = require('./constants');
3
3
 
4
4
  class Analytics {
5
- constructor(agentParams) {
6
- this.agentParams = agentParams;
7
- this.visitorInstance = ua(GOOGLE_ANALYTICS_INSTANCE);
8
- }
5
+ constructor(agentParams) {
6
+ this.agentParams = agentParams;
7
+ this.visitorInstance = ua(GOOGLE_ANALYTICS_INSTANCE);
8
+ }
9
9
 
10
- trackEvent(event) {
11
- this.visitorInstance.event(event.category, event.action, event.label).send();
12
- }
10
+ trackEvent(event) {
11
+ this.visitorInstance.event(event.category, event.action, event.label).send();
12
+ }
13
13
  }
14
14
 
15
15
  module.exports = Analytics;
@@ -1,4 +1,4 @@
1
- const pjson = require('./../package.json');
1
+ const pjson = require('../package.json');
2
2
 
3
3
  const PJSON_VERSION = pjson.version;
4
4
  const PJSON_NAME = pjson.name;
@@ -2,15 +2,16 @@ const { PJSON_VERSION, PJSON_NAME } = require('./constants');
2
2
 
3
3
  const CLIENT_JAVASCRIPT = `Client name "${PJSON_NAME}", version "${PJSON_VERSION}"`;
4
4
  const CLIENT_JAVASCRIPT_EVENTS = {
5
- START_LAUNCH: {
6
- category: CLIENT_JAVASCRIPT,
7
- action: 'Start launch',
8
- },
5
+ START_LAUNCH: {
6
+ category: CLIENT_JAVASCRIPT,
7
+ action: 'Start launch',
8
+ },
9
9
  };
10
10
 
11
- const getAgentEventLabel = agentParams => `Agent name "${agentParams.name}", version "${agentParams.version}"`;
11
+ const getAgentEventLabel = (agentParams) =>
12
+ `Agent name "${agentParams.name}", version "${agentParams.version}"`;
12
13
 
13
14
  module.exports = {
14
- CLIENT_JAVASCRIPT_EVENTS,
15
- getAgentEventLabel,
15
+ CLIENT_JAVASCRIPT_EVENTS,
16
+ getAgentEventLabel,
16
17
  };
@@ -1,11 +1,11 @@
1
1
  const EVENTS = {
2
- SET_DESCRIPTION: 'rp:setDescription',
3
- SET_TEST_CASE_ID: 'rp:setTestCaseId',
4
- SET_STATUS: 'rp:setStatus',
5
- SET_LAUNCH_STATUS: 'rp:setLaunchStatus',
6
- ADD_ATTRIBUTES: 'rp:addAttributes',
7
- ADD_LOG: 'rp:addLog',
8
- ADD_LAUNCH_LOG: 'rp:addLaunchLog',
2
+ SET_DESCRIPTION: 'rp:setDescription',
3
+ SET_TEST_CASE_ID: 'rp:setTestCaseId',
4
+ SET_STATUS: 'rp:setStatus',
5
+ SET_LAUNCH_STATUS: 'rp:setLaunchStatus',
6
+ ADD_ATTRIBUTES: 'rp:addAttributes',
7
+ ADD_LOG: 'rp:addLog',
8
+ ADD_LAUNCH_LOG: 'rp:addLaunchLog',
9
9
  };
10
10
 
11
11
  module.exports = { EVENTS };
@@ -1,12 +1,12 @@
1
1
  const RP_STATUSES = {
2
- PASSED: 'passed',
3
- FAILED: 'failed',
4
- SKIPPED: 'skipped',
5
- STOPPED: 'stopped',
6
- INTERRUPTED: 'interrupted',
7
- CANCELLED: 'cancelled',
8
- INFO: 'info',
9
- WARN: 'warn',
2
+ PASSED: 'passed',
3
+ FAILED: 'failed',
4
+ SKIPPED: 'skipped',
5
+ STOPPED: 'stopped',
6
+ INTERRUPTED: 'interrupted',
7
+ CANCELLED: 'cancelled',
8
+ INFO: 'info',
9
+ WARN: 'warn',
10
10
  };
11
11
 
12
12
  module.exports = { RP_STATUSES };
package/lib/helpers.js CHANGED
@@ -2,84 +2,91 @@ const fs = require('fs');
2
2
  const glob = require('glob');
3
3
  const os = require('os');
4
4
  const RestClient = require('./rest');
5
- const pjson = require('./../package.json');
5
+ const pjson = require('../package.json');
6
6
 
7
7
  const MIN = 3;
8
8
  const MAX = 256;
9
9
  const PJSON_VERSION = pjson.version;
10
10
  const PJSON_NAME = pjson.name;
11
11
 
12
- const getUUIDFromFileName = filename => filename.match(/rplaunch-(.*)\.tmp/)[1];
12
+ const getUUIDFromFileName = (filename) => filename.match(/rplaunch-(.*)\.tmp/)[1];
13
13
 
14
14
  module.exports = {
15
- formatName(name) {
16
- const len = name.length;
17
- // eslint-disable-next-line no-mixed-operators
18
- return ((len < MIN) ? (name + new Array(MIN - len + 1).join('.')) : name).slice(-MAX);
19
- },
15
+ formatName(name) {
16
+ const len = name.length;
17
+ // eslint-disable-next-line no-mixed-operators
18
+ return (len < MIN ? name + new Array(MIN - len + 1).join('.') : name).slice(-MAX);
19
+ },
20
20
 
21
- now() {
22
- return new Date().valueOf();
23
- },
21
+ now() {
22
+ return new Date().valueOf();
23
+ },
24
24
 
25
- getServerResult(url, request, options, method) {
26
- return RestClient
27
- .request(method, url, request, options);
28
- },
25
+ getServerResult(url, request, options, method) {
26
+ return RestClient.request(method, url, request, options);
27
+ },
29
28
 
30
- readLaunchesFromFile() {
31
- const files = glob.sync('rplaunch-*.tmp');
32
- const ids = files.map(getUUIDFromFileName);
29
+ readLaunchesFromFile() {
30
+ const files = glob.sync('rplaunch-*.tmp');
31
+ const ids = files.map(getUUIDFromFileName);
33
32
 
34
- return ids;
35
- },
33
+ return ids;
34
+ },
36
35
 
37
- saveLaunchIdToFile(launchId) {
38
- const filename = `rplaunch-${launchId}.tmp`;
39
- fs.open(filename, 'w', (err) => {
40
- if (err) {
41
- throw err;
42
- }
43
- });
44
- },
36
+ saveLaunchIdToFile(launchId) {
37
+ const filename = `rplaunch-${launchId}.tmp`;
38
+ fs.open(filename, 'w', (err) => {
39
+ if (err) {
40
+ throw err;
41
+ }
42
+ });
43
+ },
45
44
 
46
- getSystemAttribute() {
47
- const osType = os.type();
48
- const osArchitecture = os.arch();
49
- const RAMSize = os.totalmem();
50
- const nodeVersion = process.version;
51
- const systemAttr = [{
52
- key: 'client',
53
- value: `${PJSON_NAME}|${PJSON_VERSION}`,
54
- system: true,
55
- }, {
56
- key: 'os',
57
- value: `${osType}|${osArchitecture}`,
58
- system: true,
59
- }, {
60
- key: 'RAMSize',
61
- value: RAMSize,
62
- system: true,
63
- }, {
64
- key: 'nodeJS',
65
- value: nodeVersion,
66
- system: true,
67
- }];
45
+ getSystemAttribute() {
46
+ const osType = os.type();
47
+ const osArchitecture = os.arch();
48
+ const RAMSize = os.totalmem();
49
+ const nodeVersion = process.version;
50
+ const systemAttr = [
51
+ {
52
+ key: 'client',
53
+ value: `${PJSON_NAME}|${PJSON_VERSION}`,
54
+ system: true,
55
+ },
56
+ {
57
+ key: 'os',
58
+ value: `${osType}|${osArchitecture}`,
59
+ system: true,
60
+ },
61
+ {
62
+ key: 'RAMSize',
63
+ value: RAMSize,
64
+ system: true,
65
+ },
66
+ {
67
+ key: 'nodeJS',
68
+ value: nodeVersion,
69
+ system: true,
70
+ },
71
+ ];
68
72
 
69
- return systemAttr;
70
- },
73
+ return systemAttr;
74
+ },
71
75
 
72
- generateTestCaseId(codeRef, params) {
73
- if (!codeRef) {
74
- return;
75
- }
76
+ generateTestCaseId(codeRef, params) {
77
+ if (!codeRef) {
78
+ return;
79
+ }
76
80
 
77
- if (!params) {
78
- return codeRef;
79
- }
81
+ if (!params) {
82
+ return codeRef;
83
+ }
80
84
 
81
- const parameters = params.reduce((result, item) => (item.value ? result.concat(item.value) : result), []);
85
+ const parameters = params.reduce(
86
+ (result, item) => (item.value ? result.concat(item.value) : result),
87
+ [],
88
+ );
82
89
 
83
- return `${codeRef}[${parameters}]`;
84
- },
90
+ return `${codeRef}[${parameters}]`;
91
+ },
85
92
  };
@@ -4,89 +4,89 @@ const { EVENTS } = require('./constants/events');
4
4
  * Public API to emit additional events to RP JS agents.
5
5
  */
6
6
  class PublicReportingAPI {
7
- /**
8
- * Emit set description event.
9
- * @param {String} text - description of current test/suite.
10
- * @param {String} suite - suite description, optional.
11
- */
12
- static setDescription(text, suite) {
13
- process.emit(EVENTS.SET_DESCRIPTION, { text, suite });
14
- }
7
+ /**
8
+ * Emit set description event.
9
+ * @param {String} text - description of current test/suite.
10
+ * @param {String} suite - suite description, optional.
11
+ */
12
+ static setDescription(text, suite) {
13
+ process.emit(EVENTS.SET_DESCRIPTION, { text, suite });
14
+ }
15
15
 
16
- /**
17
- * Emit add attributes event.
18
- * @param {Array} attributes - array of attributes, should looks like this:
19
- * [{
20
- * key: "attrKey",
21
- * value: "attrValue",
22
- * }]
23
- *
24
- * @param {String} suite - suite description, optional.
25
- */
26
- static addAttributes(attributes, suite) {
27
- process.emit(EVENTS.ADD_ATTRIBUTES, { attributes, suite });
28
- }
16
+ /**
17
+ * Emit add attributes event.
18
+ * @param {Array} attributes - array of attributes, should looks like this:
19
+ * [{
20
+ * key: "attrKey",
21
+ * value: "attrValue",
22
+ * }]
23
+ *
24
+ * @param {String} suite - suite description, optional.
25
+ */
26
+ static addAttributes(attributes, suite) {
27
+ process.emit(EVENTS.ADD_ATTRIBUTES, { attributes, suite });
28
+ }
29
29
 
30
- /**
31
- * Emit send log to test item event.
32
- * @param {Object} log - log object should looks like this:
33
- * {
34
- * level: "INFO",
35
- * message: "log message",
36
- * file: {
37
- * name: "filename",
38
- * type: "image/png", // media type
39
- * content: data, // file content represented as 64base string
40
- * },
41
- * }
42
- * @param {String} suite - suite description, optional.
43
- */
44
- static addLog(log, suite) {
45
- process.emit(EVENTS.ADD_LOG, { log, suite });
46
- }
30
+ /**
31
+ * Emit send log to test item event.
32
+ * @param {Object} log - log object should looks like this:
33
+ * {
34
+ * level: "INFO",
35
+ * message: "log message",
36
+ * file: {
37
+ * name: "filename",
38
+ * type: "image/png", // media type
39
+ * content: data, // file content represented as 64base string
40
+ * },
41
+ * }
42
+ * @param {String} suite - suite description, optional.
43
+ */
44
+ static addLog(log, suite) {
45
+ process.emit(EVENTS.ADD_LOG, { log, suite });
46
+ }
47
47
 
48
- /**
49
- * Emit send log to current launch event.
50
- * @param {Object} log - log object should looks like this:
51
- * {
52
- * level: "INFO",
53
- * message: "log message",
54
- * file: {
55
- * name: "filename",
56
- * type: "image/png", // media type
57
- * content: data, // file content represented as 64base string
58
- * },
59
- * }
60
- */
61
- static addLaunchLog(log) {
62
- process.emit(EVENTS.ADD_LAUNCH_LOG, log);
63
- }
48
+ /**
49
+ * Emit send log to current launch event.
50
+ * @param {Object} log - log object should looks like this:
51
+ * {
52
+ * level: "INFO",
53
+ * message: "log message",
54
+ * file: {
55
+ * name: "filename",
56
+ * type: "image/png", // media type
57
+ * content: data, // file content represented as 64base string
58
+ * },
59
+ * }
60
+ */
61
+ static addLaunchLog(log) {
62
+ process.emit(EVENTS.ADD_LAUNCH_LOG, log);
63
+ }
64
64
 
65
- /**
66
- * Emit set testCaseId event.
67
- * @param {String} testCaseId - testCaseId of current test/suite.
68
- * @param {String} suite - suite description, optional.
69
- */
70
- static setTestCaseId(testCaseId, suite) {
71
- process.emit(EVENTS.SET_TEST_CASE_ID, { testCaseId, suite });
72
- }
65
+ /**
66
+ * Emit set testCaseId event.
67
+ * @param {String} testCaseId - testCaseId of current test/suite.
68
+ * @param {String} suite - suite description, optional.
69
+ */
70
+ static setTestCaseId(testCaseId, suite) {
71
+ process.emit(EVENTS.SET_TEST_CASE_ID, { testCaseId, suite });
72
+ }
73
73
 
74
- /**
75
- * Emit set status to current launch event.
76
- * @param {String} status - status of current launch.
77
- */
78
- static setLaunchStatus(status) {
79
- process.emit(EVENTS.SET_LAUNCH_STATUS, status);
80
- }
74
+ /**
75
+ * Emit set status to current launch event.
76
+ * @param {String} status - status of current launch.
77
+ */
78
+ static setLaunchStatus(status) {
79
+ process.emit(EVENTS.SET_LAUNCH_STATUS, status);
80
+ }
81
81
 
82
- /**
83
- * Emit set status event.
84
- * @param {String} status - status of current test/suite.
85
- * @param {String} suite - suite description, optional.
86
- */
87
- static setStatus(status, suite) {
88
- process.emit(EVENTS.SET_STATUS, { status, suite });
89
- }
82
+ /**
83
+ * Emit set status event.
84
+ * @param {String} status - status of current test/suite.
85
+ * @param {String} suite - suite description, optional.
86
+ */
87
+ static setStatus(status, suite) {
88
+ process.emit(EVENTS.SET_STATUS, { status, suite });
89
+ }
90
90
  }
91
91
 
92
92
  module.exports = PublicReportingAPI;