Skip to content

Commit 82892ba

Browse files
committed
Fixing the specs split and join issue for command line args and config key
1 parent d253999 commit 82892ba

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

bin/helpers/utils.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,29 @@ exports.setBuildName = (bsConfig, args) => {
9595
}
9696
}
9797

98+
// specs can be passed from bstack configuration file
99+
// specs can be passed via command line args as a string
100+
// command line args takes precedence over config
98101
exports.setUserSpecs = (bsConfig, args) => {
99-
if (!this.isUndefined(args.specs) && args.specs.length > 0 && !this.isUndefined(args.specs[0])) {
100-
bsConfig['run_settings']['specs'] = args.specs;
102+
let bsConfigSpecs = bsConfig.run_settings.specs;
103+
104+
if (!this.isUndefined(args.specs)) {
105+
bsConfig.run_settings.specs = args.specs.split(/\s{0,},\s+/).join(',');
106+
} else if (!this.isUndefined(bsConfigSpecs) && Array.isArray(bsConfigSpecs)) {
107+
bsConfig.run_settings.specs = bsConfigSpecs.join(',');
108+
} else if (!this.isUndefined(bsConfigSpecs) && typeof(bsConfigSpecs) == "string") {
109+
bsConfig.run_settings.specs = bsConfigSpecs.split(/\s{0,},\s+/).join(',');
110+
} else {
111+
bsConfig.run_settings.specs = null;
101112
}
102113
}
103114

104-
// env option must be set only from args
115+
// env option must be set only from command line args as a string
105116
exports.setTestEnvs = (bsConfig, args) => {
106117
if (!this.isUndefined(args.env)) {
107-
bsConfig['run_settings']['env'] = args.env;
118+
bsConfig.run_settings.env = args.env.split(/\s{0,},\s+/).join(',');
108119
} else {
109-
bsConfig['run_settings']['env'] = null;
120+
bsConfig.run_settings.env = null;
110121
}
111122
}
112123

bin/runner.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ var argv = yargs
168168
's': {
169169
alias: ['specs', 'spec'],
170170
describe: Constants.cliMessages.RUN.SPECS_DESCRIPTION,
171-
type: "array",
171+
type: "string",
172172
default: undefined
173173
},
174174
'env': {
175175
describe: Constants.cliMessages.RUN.ENV_DESCRIPTION,
176-
type: "array",
176+
type: "string",
177177
default: undefined
178178
}
179179
})

0 commit comments

Comments
 (0)