Skip to content

Commit

Permalink
Merge pull request #124 from reportportal/develop
Browse files Browse the repository at this point in the history
Release 5.0.6
  • Loading branch information
AmsterGet authored Jan 13, 2022
2 parents 627407d + 5cbf65a commit 946f71a
Show file tree
Hide file tree
Showing 25 changed files with 3,499 additions and 3,445 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ root = true
[*]

indent_style = space
indent_size = 4
indent_size = 2

end_of_line = lf
charset = utf-8
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"jasmine": true
},
"rules": {
"indent": ["error", 4],
"indent": ["error", 2],
"max-len": ["error", 120],
"valid-jsdoc": ["error", { "requireReturn": false }],
"consistent-return": 0
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/CI-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,23 @@ on:
- README.md
- CHANGELOG.md
pull_request:
branches:
- develop
- master

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [10, 12, 14, 16]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: ${{ matrix.node }}
- name: Clean install of node dependencies
run: npm ci
- name: Run lint
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Configure git
run: |
git config --global user.email "reportportal.io"
Expand Down
3 changes: 0 additions & 3 deletions .istanbul.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .npmignore

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Fixed
- Security vulnerabilities (axios, path-parse, minimist)
### Changed
- Package size reduced

## [5.0.5] - 2021-05-25
### Added
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Library is used only for implementors of custom listeners for ReportPortal.
* [Cucumber integration](https://github.com/reportportal/agent-js-cucumber)
* [Codecept integration](https://github.com/reportportal/agent-js-codecept)
* [Postman integration](https://github.com/reportportal/agent-js-postman)
* [TestCafe integration](https://github.com/reportportal/agent-js-testcafe)
* [Webdriverio integration](https://github.com/reportportal/agent-js-webdriverio)
* [Playwright integration](https://github.com/reportportal/agent-js-playwright)

Examples for test framework integrations from the list above described in [examples](https://github.com/reportportal/examples-js) repository.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.5
5.0.6-SNAPSHOT
14 changes: 7 additions & 7 deletions analytics/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ const ua = require('universal-analytics');
const { GOOGLE_ANALYTICS_INSTANCE } = require('./constants');

class Analytics {
constructor(agentParams) {
this.agentParams = agentParams;
this.visitorInstance = ua(GOOGLE_ANALYTICS_INSTANCE);
}
constructor(agentParams) {
this.agentParams = agentParams;
this.visitorInstance = ua(GOOGLE_ANALYTICS_INSTANCE);
}

trackEvent(event) {
this.visitorInstance.event(event.category, event.action, event.label).send();
}
trackEvent(event) {
this.visitorInstance.event(event.category, event.action, event.label).send();
}
}

module.exports = Analytics;
2 changes: 1 addition & 1 deletion analytics/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const pjson = require('./../package.json');
const pjson = require('../package.json');

const PJSON_VERSION = pjson.version;
const PJSON_NAME = pjson.name;
Expand Down
14 changes: 7 additions & 7 deletions analytics/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ const { PJSON_VERSION, PJSON_NAME } = require('./constants');

const CLIENT_JAVASCRIPT = `Client name "${PJSON_NAME}", version "${PJSON_VERSION}"`;
const CLIENT_JAVASCRIPT_EVENTS = {
START_LAUNCH: {
category: CLIENT_JAVASCRIPT,
action: 'Start launch',
},
START_LAUNCH: {
category: CLIENT_JAVASCRIPT,
action: 'Start launch',
},
};

const getAgentEventLabel = agentParams => `Agent name "${agentParams.name}", version "${agentParams.version}"`;
const getAgentEventLabel = (agentParams) => `Agent name "${agentParams.name}", version "${agentParams.version}"`;

module.exports = {
CLIENT_JAVASCRIPT_EVENTS,
getAgentEventLabel,
CLIENT_JAVASCRIPT_EVENTS,
getAgentEventLabel,
};
14 changes: 7 additions & 7 deletions lib/constants/events.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const EVENTS = {
SET_DESCRIPTION: 'rp:setDescription',
SET_TEST_CASE_ID: 'rp:setTestCaseId',
SET_STATUS: 'rp:setStatus',
SET_LAUNCH_STATUS: 'rp:setLaunchStatus',
ADD_ATTRIBUTES: 'rp:addAttributes',
ADD_LOG: 'rp:addLog',
ADD_LAUNCH_LOG: 'rp:addLaunchLog',
SET_DESCRIPTION: 'rp:setDescription',
SET_TEST_CASE_ID: 'rp:setTestCaseId',
SET_STATUS: 'rp:setStatus',
SET_LAUNCH_STATUS: 'rp:setLaunchStatus',
ADD_ATTRIBUTES: 'rp:addAttributes',
ADD_LOG: 'rp:addLog',
ADD_LAUNCH_LOG: 'rp:addLaunchLog',
};

module.exports = { EVENTS };
16 changes: 8 additions & 8 deletions lib/constants/statuses.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const RP_STATUSES = {
PASSED: 'passed',
FAILED: 'failed',
SKIPPED: 'skipped',
STOPPED: 'stopped',
INTERRUPTED: 'interrupted',
CANCELLED: 'cancelled',
INFO: 'info',
WARN: 'warn',
PASSED: 'passed',
FAILED: 'failed',
SKIPPED: 'skipped',
STOPPED: 'stopped',
INTERRUPTED: 'interrupted',
CANCELLED: 'cancelled',
INFO: 'info',
WARN: 'warn',
};

module.exports = { RP_STATUSES };
122 changes: 61 additions & 61 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,84 +2,84 @@ const fs = require('fs');
const glob = require('glob');
const os = require('os');
const RestClient = require('./rest');
const pjson = require('./../package.json');
const pjson = require('../package.json');

const MIN = 3;
const MAX = 256;
const PJSON_VERSION = pjson.version;
const PJSON_NAME = pjson.name;

const getUUIDFromFileName = filename => filename.match(/rplaunch-(.*)\.tmp/)[1];
const getUUIDFromFileName = (filename) => filename.match(/rplaunch-(.*)\.tmp/)[1];

module.exports = {
formatName(name) {
const len = name.length;
// eslint-disable-next-line no-mixed-operators
return ((len < MIN) ? (name + new Array(MIN - len + 1).join('.')) : name).slice(-MAX);
},
formatName(name) {
const len = name.length;
// eslint-disable-next-line no-mixed-operators
return ((len < MIN) ? (name + new Array(MIN - len + 1).join('.')) : name).slice(-MAX);
},

now() {
return new Date().valueOf();
},
now() {
return new Date().valueOf();
},

getServerResult(url, request, options, method) {
return RestClient
.request(method, url, request, options);
},
getServerResult(url, request, options, method) {
return RestClient
.request(method, url, request, options);
},

readLaunchesFromFile() {
const files = glob.sync('rplaunch-*.tmp');
const ids = files.map(getUUIDFromFileName);
readLaunchesFromFile() {
const files = glob.sync('rplaunch-*.tmp');
const ids = files.map(getUUIDFromFileName);

return ids;
},
return ids;
},

saveLaunchIdToFile(launchId) {
const filename = `rplaunch-${launchId}.tmp`;
fs.open(filename, 'w', (err) => {
if (err) {
throw err;
}
});
},
saveLaunchIdToFile(launchId) {
const filename = `rplaunch-${launchId}.tmp`;
fs.open(filename, 'w', (err) => {
if (err) {
throw err;
}
});
},

getSystemAttribute() {
const osType = os.type();
const osArchitecture = os.arch();
const RAMSize = os.totalmem();
const nodeVersion = process.version;
const systemAttr = [{
key: 'client',
value: `${PJSON_NAME}|${PJSON_VERSION}`,
system: true,
}, {
key: 'os',
value: `${osType}|${osArchitecture}`,
system: true,
}, {
key: 'RAMSize',
value: RAMSize,
system: true,
}, {
key: 'nodeJS',
value: nodeVersion,
system: true,
}];
getSystemAttribute() {
const osType = os.type();
const osArchitecture = os.arch();
const RAMSize = os.totalmem();
const nodeVersion = process.version;
const systemAttr = [{
key: 'client',
value: `${PJSON_NAME}|${PJSON_VERSION}`,
system: true,
}, {
key: 'os',
value: `${osType}|${osArchitecture}`,
system: true,
}, {
key: 'RAMSize',
value: RAMSize,
system: true,
}, {
key: 'nodeJS',
value: nodeVersion,
system: true,
}];

return systemAttr;
},
return systemAttr;
},

generateTestCaseId(codeRef, params) {
if (!codeRef) {
return;
}
generateTestCaseId(codeRef, params) {
if (!codeRef) {
return;
}

if (!params) {
return codeRef;
}
if (!params) {
return codeRef;
}

const parameters = params.reduce((result, item) => (item.value ? result.concat(item.value) : result), []);
const parameters = params.reduce((result, item) => (item.value ? result.concat(item.value) : result), []);

return `${codeRef}[${parameters}]`;
},
return `${codeRef}[${parameters}]`;
},
};
Loading

0 comments on commit 946f71a

Please sign in to comment.