Skip to content

Commit

Permalink
update dependencies and fix env arg parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Valiantsin2021 committed Feb 9, 2024
1 parent 7eb00fb commit ce7a641
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
1 change: 1 addition & 0 deletions Readme.md
Expand Up @@ -42,6 +42,7 @@ newman-parallel [options]

- the process logic will check the environment variables if there is no Name of the collection/product passed in arguments
- If environment variable equal to the name of the collection's filename is set to true, the framework will run the collection/s that match.
- If the environment variable ENV is set to name of the enfironment file, the framework will use this environment file (in such case you do not need to pass arg E=<name>, otherwise it will have priority over the ENV var)

### Examples

Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -44,7 +44,7 @@
"allure-commandline": "2.27.0",
"allure-patch": "^1.0.3",
"async": "^3.2.5",
"newman": "6.1.0",
"newman": "6.1.1",
"newman-reporter-htmlextra": "1.23.0",
"newman-reporter-junitfull": "^1.1.1"
},
Expand All @@ -53,6 +53,6 @@
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.1.3",
"husky": "^4.3.8",
"prettier": "3.2.4"
"prettier": "3.2.5"
}
}
15 changes: 7 additions & 8 deletions src/newman-parallel.js
Expand Up @@ -66,21 +66,20 @@ class NewmanRunner {
*/
static parseArgs(args) {
// Extract collection and environment names from arguments
let product =
process.env.COLLECTION || args.filter(arg => arg.includes('C='))[0]
let envName = process.env.ENV || args.filter(arg => arg.includes('E='))[0]

let product = args.filter(arg => arg.includes('C='))[0]
let envName = args.filter(arg => arg.includes('E='))[0]
// Check the ALL argument passed in CLI
let runAll = args.filter(arg => /ALL/.test(arg)).length > 0
// If collection name is provided in arguments, extract it
if (product) {
product = product.split('=')[1] ?? product
}

// If environment name is provided in arguments, extract it
if (envName) {
if (envName?.includes('=')) {
envName = envName.split('=')[1]
} else {
envName = process.env.ENV || ''
}
// Check the ALL argument passed in CLI
let runAll = args.filter(arg => /ALL/.test(arg)).length > 0
return { product: product, env: envName, runAll: runAll }
}
/**
Expand Down

0 comments on commit ce7a641

Please sign in to comment.