@@ -9,6 +9,7 @@ import Reporter from '../reporter';
99import Task from './task' ;
1010import { GeneralError } from '../errors/runtime' ;
1111import MESSAGE from '../errors/runtime/message' ;
12+ import { assertType , is } from '../errors/runtime/type-assertions' ;
1213
1314
1415const DEFAULT_SELECTOR_TIMEOUT = 10000 ;
@@ -26,6 +27,7 @@ export default class Runner extends EventEmitter {
2627
2728 this . opts = {
2829 externalProxyHost : null ,
30+ proxyBypass : null ,
2931 screenshotPath : null ,
3032 takeScreenshotsOnFails : false ,
3133 skipJsErrors : false ,
@@ -118,6 +120,21 @@ export default class Runner extends EventEmitter {
118120 assets . forEach ( asset => this . proxy . GET ( asset . path , asset . info ) ) ;
119121 }
120122
123+ _validateRunOptions ( ) {
124+ const concurrency = this . bootstrapper . concurrency ;
125+ const speed = this . opts . speed ;
126+ const proxyBypass = this . opts . proxyBypass ;
127+
128+ if ( typeof speed !== 'number' || isNaN ( speed ) || speed < 0.01 || speed > 1 )
129+ throw new GeneralError ( MESSAGE . invalidSpeedValue ) ;
130+
131+ if ( typeof concurrency !== 'number' || isNaN ( concurrency ) || concurrency < 1 )
132+ throw new GeneralError ( MESSAGE . invalidConcurrencyFactor ) ;
133+
134+ if ( proxyBypass )
135+ assertType ( is . string , null , '"proxyBypass" argument' , proxyBypass ) ;
136+ }
137+
121138
122139 // API
123140 embeddingOptions ( opts ) {
@@ -142,9 +159,6 @@ export default class Runner extends EventEmitter {
142159 }
143160
144161 concurrency ( concurrency ) {
145- if ( typeof concurrency !== 'number' || isNaN ( concurrency ) || concurrency < 1 )
146- throw new GeneralError ( MESSAGE . invalidConcurrencyFactor ) ;
147-
148162 this . bootstrapper . concurrency = concurrency ;
149163
150164 return this ;
@@ -165,8 +179,9 @@ export default class Runner extends EventEmitter {
165179 return this ;
166180 }
167181
168- useProxy ( externalProxyHost ) {
182+ useProxy ( externalProxyHost , proxyBypass ) {
169183 this . opts . externalProxyHost = externalProxyHost ;
184+ this . opts . proxyBypass = proxyBypass ;
170185
171186 return this ;
172187 }
@@ -194,12 +209,13 @@ export default class Runner extends EventEmitter {
194209 this . opts . assertionTimeout = assertionTimeout === void 0 ? DEFAULT_ASSERTION_TIMEOUT : assertionTimeout ;
195210 this . opts . pageLoadTimeout = pageLoadTimeout === void 0 ? DEFAULT_PAGE_LOAD_TIMEOUT : pageLoadTimeout ;
196211
197- if ( typeof speed !== 'number' || isNaN ( speed ) || speed < 0.01 || speed > 1 )
198- throw new GeneralError ( MESSAGE . invalidSpeedValue ) ;
199-
200212 this . opts . speed = speed ;
201213
202- var runTaskPromise = this . bootstrapper . createRunnableConfiguration ( )
214+ var runTaskPromise = Promise . resolve ( )
215+ . then ( ( ) => {
216+ this . _validateRunOptions ( ) ;
217+ return this . bootstrapper . createRunnableConfiguration ( ) ;
218+ } )
203219 . then ( ( { reporterPlugins, browserSet, tests, testedApp } ) => {
204220 this . emit ( 'done-bootstrapping' ) ;
205221
0 commit comments