@reportportal/client-javascript
Advanced tools
Comparing version 5.0.8 to 5.0.9
@@ -6,5 +6,5 @@ /* eslint-disable quotes,no-console,class-methods-use-this */ | ||
const RestClient = require('./rest'); | ||
const Analytics = require('../analytics/analytics'); | ||
const Statistics = require('../statistics/statistics'); | ||
const { EVENT_NAME } = require('../statistics/constants'); | ||
const { RP_STATUSES } = require('./constants/statuses'); | ||
const { CLIENT_JAVASCRIPT_EVENTS, getAgentEventLabel } = require('../analytics/events'); | ||
@@ -38,3 +38,3 @@ const MULTIPART_BOUNDARY = Math.floor(Math.random() * 10000000000).toString(); | ||
this.baseURL = [params.endpoint, params.project].join('/'); | ||
const headers = { | ||
this.headers = { | ||
'User-Agent': 'NodeJS', | ||
@@ -44,3 +44,2 @@ Authorization: `bearer ${params.token}`, | ||
}; | ||
this.headers = headers; | ||
this.token = params.token; | ||
@@ -54,3 +53,3 @@ this.config = params; | ||
}); | ||
this.analytics = new Analytics(agentParams); | ||
this.statistics = new Statistics(EVENT_NAME, agentParams); | ||
this.launchUuid = ''; | ||
@@ -120,13 +119,7 @@ this.nonRetriedItemMap = new Map(); | ||
triggerAnalyticsEvent() { | ||
triggerStatisticsEvent() { | ||
if (process.env.REPORTPORTAL_CLIENT_JS_NO_ANALYTICS) { | ||
return; | ||
} | ||
if (this.analytics.agentParams) { | ||
const label = getAgentEventLabel(this.analytics.agentParams); | ||
this.analytics.trackEvent(Object.assign(CLIENT_JAVASCRIPT_EVENTS.START_LAUNCH, { label })); | ||
} else { | ||
this.analytics.trackEvent(CLIENT_JAVASCRIPT_EVENTS.START_LAUNCH); | ||
} | ||
this.statistics.trackEvent(); | ||
} | ||
@@ -215,3 +208,3 @@ | ||
} | ||
this.triggerAnalyticsEvent(); | ||
this.triggerStatisticsEvent(); | ||
return { | ||
@@ -314,5 +307,5 @@ tempId, | ||
* | ||
* @Returns {Promise} | ||
* @returns {Promise} - action promise | ||
*/ | ||
mergeLaunches(mergeOptions= {}) { | ||
mergeLaunches(mergeOptions = {}) { | ||
if (this.isLaunchMergeRequired) { | ||
@@ -319,0 +312,0 @@ const launchUUIds = helpers.readLaunchesFromFile(); |
{ | ||
"name": "@reportportal/client-javascript", | ||
"version": "5.0.8", | ||
"description": "ReportPortal client for node.js", | ||
"version": "5.0.9", | ||
"description": "ReportPortal client for Node.js", | ||
"author": "ReportPortal.io", | ||
"contributors": [ | ||
{ | ||
"name": "Artsiom Tkachou", | ||
"email": "artsiom_tkachou@epam.com" | ||
}, | ||
{ | ||
"name": "Alexey Krylov", | ||
"email": "lexecon117@gmail.com" | ||
} | ||
], | ||
"homepage": "https://github.com/reportportal/client-javascript", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/reportportal/client-javascript.git" | ||
"scripts": { | ||
"build": "npm run clean && tsc", | ||
"clean": "rimraf ./build", | ||
"lint": "eslint ./statistics/**/* ./lib/**/* ./spec/**/*", | ||
"format": "npm run lint -- --fix", | ||
"test": "nyc ./node_modules/jasmine/bin/jasmine.js", | ||
"test:coverage": "nyc report --reporter=lcov --reporter=text-summary" | ||
}, | ||
@@ -26,3 +19,3 @@ "directories": { | ||
"/lib", | ||
"/analytics", | ||
"/statistics", | ||
"/VERSION" | ||
@@ -32,42 +25,50 @@ ], | ||
"engines": { | ||
"node": ">= 10.0.0" | ||
"node": ">=10.x" | ||
}, | ||
"dependencies": { | ||
"axios": "^0.27.2", | ||
"axios-retry": "^3.2.4", | ||
"glob": "^7.2.0", | ||
"axios-retry": "^3.4.0", | ||
"glob": "^7.2.3", | ||
"ini": "^4.0.0", | ||
"uniqid": "^5.4.0", | ||
"universal-analytics": "^0.5.3" | ||
"uuid": "^9.0.0" | ||
}, | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"build": "npm run clean && tsc", | ||
"clean": "rimraf ./build", | ||
"lint": "eslint ./analytics/**/* ./lib/**/* ./spec/**/*", | ||
"format": "npm run lint -- --fix", | ||
"test": "nyc ./node_modules/jasmine/bin/jasmine.js", | ||
"test:coverage": "nyc report --reporter=lcov --reporter=text-summary" | ||
}, | ||
"devDependencies": { | ||
"@types/jasmine": "^4.3.1", | ||
"@types/node": "^18.14.2", | ||
"@typescript-eslint/eslint-plugin": "^5.54.0", | ||
"@typescript-eslint/parser": "^5.54.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-config-airbnb-typescript": "^17.0.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-node": "^11.1.0", | ||
"typescript": "^4.7.4", | ||
"jasmine": "^3.5.0", | ||
"lodash": "^4.17.11", | ||
"nock": "^13.2.9", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jasmine": "^3.10.0", | ||
"jasmine-ts": "^0.4.0", | ||
"lodash": "^4.17.21", | ||
"nock": "^13.3.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.7.1", | ||
"prettier": "^2.8.4", | ||
"rimraf": "^3.0.2", | ||
"@types/jasmine": "^4.0.3", | ||
"@types/node": "^18.7.6", | ||
"@typescript-eslint/eslint-plugin": "^5.33.1", | ||
"@typescript-eslint/parser": "^5.33.1", | ||
"eslint-config-airbnb-typescript": "^17.0.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jasmine-ts": "^0.4.0", | ||
"ts-node": "^10.9.1" | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.9.5" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Artsiom Tkachou", | ||
"email": "artsiom_tkachou@epam.com" | ||
}, | ||
{ | ||
"name": "Alexey Krylov", | ||
"email": "lexecon117@gmail.com" | ||
} | ||
], | ||
"homepage": "https://github.com/reportportal/client-javascript", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/reportportal/client-javascript.git" | ||
}, | ||
"bugs": { | ||
@@ -74,0 +75,0 @@ "url": "https://github.com/reportportal/client-javascript/issues" |
# ReportPortal js client | ||
This Client is to communicate with the Report Portal on node js. | ||
This Client is to communicate with the Report Portal on Node.js. | ||
@@ -30,5 +30,5 @@ Library is used only for implementors of custom listeners for ReportPortal. | ||
```javascript | ||
let RPClient = require('@reportportal/client-javascript'); | ||
const RPClient = require('@reportportal/client-javascript'); | ||
let rpClient = new RPClient({ | ||
const rpClient = new RPClient({ | ||
token: "00000000-0000-0000-0000-000000000000", | ||
@@ -97,3 +97,3 @@ endpoint: "http://your-instance.com:8080/api/v1", | ||
```javascript | ||
let launchObj = rpClient.startLaunch({ | ||
const launchObj = rpClient.startLaunch({ | ||
name: "Client test", | ||
@@ -130,3 +130,3 @@ startTime: rpClient.helpers.now(), | ||
```javascript | ||
let launchObj = rpClient.startLaunch(); | ||
const launchObj = rpClient.startLaunch(); | ||
launchObj.promise.then((response) => { | ||
@@ -146,6 +146,8 @@ console.log(`Launch real id: ${response.id}`); | ||
ReportPortal is supporting now integrations with more than 15 test frameworks simultaneously. In order to define the most popular agents and plan the team workload accordingly, we are using Google analytics. | ||
ReportPortal is supporting now integrations with more than 15 test frameworks simultaneously. | ||
In order to define the most popular agents and plan the team workload accordingly, we are using Google Analytics. | ||
ReportPortal collects only information about agent name and version. This information is sent to Google analytics on the launch start. Please help us to make our work effective. | ||
If you still want to switch Off Google analytics, please change env variable. | ||
ReportPortal collects only information about agent name, version and version of Node.js. This information is sent to Google Analytics on the launch start. | ||
Please help us to make our work effective. | ||
If you still want to switch Off Google Analytics, please change env variable. | ||
'REPORTPORTAL_CLIENT_JS_NO_ANALYTICS=true' | ||
@@ -158,3 +160,3 @@ | ||
// launchObj - object returned by method 'startLaunch' | ||
let launchFinishObj = rpClient.finishLaunch(launchObj.tempId, { | ||
const launchFinishObj = rpClient.finishLaunch(launchObj.tempId, { | ||
endTime: rpClient.helpers.now() | ||
@@ -212,3 +214,3 @@ }); | ||
// launchObj - object returned by method 'startLaunch' | ||
let suiteObj = rpClient.startTestItem({ | ||
const suiteObj = rpClient.startTestItem({ | ||
description: makeid(), | ||
@@ -219,3 +221,3 @@ name: makeid(), | ||
}, launchObj.tempId); | ||
let stepObj = rpClient.startTestItem({ | ||
const stepObj = rpClient.startTestItem({ | ||
description: makeid(), | ||
@@ -245,2 +247,3 @@ name: makeid(), | ||
type | Item type, one of 'SUITE', 'STORY', 'TEST', 'SCENARIO', 'STEP', 'BEFORE_CLASS', 'BEFORE_GROUPS','BEFORE_METHOD', 'BEFORE_SUITE', 'BEFORE_TEST', 'AFTER_CLASS', 'AFTER_GROUPS', 'AFTER_METHOD', 'AFTER_SUITE', 'AFTER_TEST' | ||
hasStats | (optional) Changes behavior for item of type 'STEP'. When set to true, step is treaten as a test case (entity containig statistics). When false, step becomes a nested step. Default: true | ||
description | (optional) description of the launch (supports markdown syntax) | ||
@@ -247,0 +250,0 @@ startTime | (optional) start time item(unix time). Default: rpClient.helpers.now() |
Sorry, the diff of this file is not supported yet
66053
1189
316
6
13
3
+ Addedini@^4.0.0
+ Addeduuid@^9.0.0
+ Addedini@4.1.3(transitive)
+ Addeduuid@9.0.1(transitive)
- Removeduniversal-analytics@^0.5.3
- Removeddebug@4.4.0(transitive)
- Removedms@2.1.3(transitive)
- Removeduniversal-analytics@0.5.3(transitive)
- Removeduuid@8.3.2(transitive)
Updatedaxios-retry@^3.4.0
Updatedglob@^7.2.3