@@ -12,6 +12,11 @@ import io from 'socket.io-client';
1212interface Arguments {
1313 [ x : string ] : unknown ;
1414 cf : string | boolean ;
15+ group ?: string ;
16+ headless ?: boolean ;
17+ parallel ?: number ;
18+ e ?: string ;
19+ s ?: string ;
1520}
1621
1722interface ISocketData {
@@ -27,11 +32,13 @@ export default class RunProject {
2732 private configFilePath : string | undefined = undefined ;
2833 private config : IConfig | undefined = undefined ;
2934 private projectId : number | undefined = undefined ;
35+ private argv : Arguments ;
3036
3137 constructor ( argv : Arguments ) {
3238 if ( typeof argv . cf === 'string' ) {
3339 this . configFilePath = argv . cf ;
3440 }
41+ this . argv = argv ;
3542 }
3643
3744 public exitHandler ( ) : void {
@@ -140,6 +147,26 @@ export default class RunProject {
140147 return testCases ;
141148 }
142149
150+ private applyArgsToConfig ( ) : void {
151+ if ( this . config ) {
152+ if ( this . argv . group ) {
153+ this . config . run_settings . build_name = this . argv . group ;
154+ }
155+ if ( this . argv . headless ) {
156+ this . config . run_settings . headless = this . argv . headless ;
157+ }
158+ if ( this . argv . parallel ) {
159+ this . config . run_settings . parallel = this . argv . parallel ;
160+ }
161+ if ( this . argv . e ) {
162+ this . config . run_settings . cypressEnv = this . argv . e . split ( ',' ) ;
163+ }
164+ if ( this . argv . s ) {
165+ this . config . run_settings . cypressSpecs = this . argv . s ;
166+ }
167+ }
168+ }
169+
143170 public async start ( ) : Promise < void > {
144171 let config : IConfig ;
145172 try {
@@ -168,10 +195,12 @@ export default class RunProject {
168195
169196 this . config = config ;
170197
171- this . archiver = new Archiver ( config ) ;
172- this . uploader = new Uploader ( config ) ;
173- this . poller = new Poller ( config , this ) ;
174- this . tunnel = new Tunnel ( config ) ;
198+ this . applyArgsToConfig ( ) ;
199+
200+ this . archiver = new Archiver ( this . config ) ;
201+ this . uploader = new Uploader ( this . config ) ;
202+ this . poller = new Poller ( this . config , this ) ;
203+ this . tunnel = new Tunnel ( this . config ) ;
175204
176205 let zipFile : string ;
177206
@@ -180,7 +209,7 @@ export default class RunProject {
180209 return ;
181210 }
182211
183- if ( config . run_settings . start_tunnel ) {
212+ if ( this . config . run_settings . start_tunnel ) {
184213 const tunnelSpinner = ora ( 'Starting TestingBot Tunnel' ) . start ( ) ;
185214 await this . tunnel . start ( ) ;
186215 tunnelSpinner . succeed ( 'TestingBot Tunnel Ready' ) ;
0 commit comments