Skip to content

Commit

Permalink
fix: add more launch attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Jan 19, 2024
1 parent 905360c commit 9d4ff46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
17 changes: 10 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const {
attachScreenshot, finishLaunch
} = require("./helpers/rpHelpers");
const {finishTestItem} = require("./helpers/rpHelpers");
const { version } = require('./package.json');
const deepMerge = require('lodash.merge');

const helpers = container.helpers();
let helper;
Expand All @@ -33,12 +35,13 @@ const defaultConfig = {
projectName: '',
launchName: 'codeceptjs tests',
launchDescription: '',
attributes: [
{
key: 'agent',
value: 'codeceptjs-rphelper',
}
],
launchAttributes: [{
key: 'platform',
value: process.platform
},{
key: 'rphelper-version',
value: version,
}],
debug: false,
rerun: undefined,
enabled: false
Expand All @@ -47,7 +50,7 @@ const defaultConfig = {
const requiredFields = ['projectName', 'token', 'endpoint'];

module.exports = (config) => {
config = Object.assign(defaultConfig, config);
config = deepMerge(defaultConfig, config);

for (let field of requiredFields) {
if (!config[field]) throw new Error(`ReportPortal config is invalid. Key ${field} is missing in config.\nRequired fields: ${requiredFields} `)
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@
"axios": "1.6.2",
"chai": "4.3.10",
"joi": "17.11.0",
"lodash": "4.17.21",
"mocha": "10.2.0",
"playwright": "1.39.0",
"ts-node": "10.9.2",
"sleep-promise": "9.1.0"
"sleep-promise": "9.1.0",
"ts-node": "10.9.2"
}
}
2 changes: 0 additions & 2 deletions test/codecept.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ exports.config = {
launchAttributes: [{
key: 'yourKey',
value: 'yourValue',
}, {
key: 'platform', value: process.platform
}],
projectName: 'default_personal',
rerun: false,
Expand Down

0 comments on commit 9d4ff46

Please sign in to comment.