@@ -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
98101exports . 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
105116exports . 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
0 commit comments