Skip to content

Commit 0d91e79

Browse files
committed
adding implementation of adding specs and env to run setting when provided
1 parent 3c39e4a commit 0d91e79

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

bin/commands/runs.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ module.exports = function run(args) {
2424
// accept the build name from command line if provided
2525
utils.setBuildName(bsConfig, args);
2626

27+
// accept the specs list from command line if provided
28+
utils.setUserSpecs(bsConfig, args);
29+
30+
// accept the env list from command line and set it
31+
utils.setTestEnvs(bsConfig, args);
32+
2733
// Validate browserstack.json values and parallels specified via arguments
2834
return capabilityHelper.validate(bsConfig, args).then(function (validated) {
2935
logger.info(validated);

bin/helpers/utils.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ exports.setBuildName = (bsConfig, args) => {
9595
}
9696
}
9797

98+
exports.setUserSpecs = (bsConfig, args) => {
99+
if (!this.isUndefined(args.specs)) {
100+
bsConfig['run_settings']['specs'] = args.specs;
101+
}
102+
}
103+
104+
// env option must be set only from args
105+
exports.setTestEnvs = (bsConfig, args) => {
106+
if (!this.isUndefined(args.env)) {
107+
bsConfig['run_settings']['env'] = args.env;
108+
} else {
109+
bsConfig['run_settings']['env'] = null;
110+
}
111+
}
112+
98113
exports.isUndefined = value => (value === undefined || value === null);
99114

100115
exports.isFloat = value => (Number(value) && Number(value) % 1 !== 0);

0 commit comments

Comments
 (0)