@@ -149,20 +149,13 @@ void afterEach(Function fn) {
149
149
int _numShards = 1 ;
150
150
int _shardId = 0 ;
151
151
int _itCount = 0 ;
152
- bool _travisMode = false ;
153
-
154
- _safeJsGet (dottedName) {
155
- var result = js.context;
156
- var parts = dottedName.split ("." );
157
- for (int i = 0 ; i < parts.length; i++ ) {
158
- result = result[parts[i]];
159
- if (result == null ) break ;
160
- }
161
- return result;
162
- }
152
+ bool _failOnIit = false ;
153
+
154
+ _safeJsGet (dottedName) => dottedName.split ("." ).fold (
155
+ js.context, (a, b) => (a == null ? a : a[b]));
163
156
164
157
_initSharding () {
165
- _travisMode = (_safeJsGet ("__karma__.config.clientArgs.travis" ) != null );
158
+ _failOnIit = (_safeJsGet ("__karma__.config.clientArgs.travis" ) != null );
166
159
_numShards = _safeJsGet ("__karma__.config.clientArgs.travis.numKarmaShards" );
167
160
_shardId = _safeJsGet ("__karma__.config.clientArgs.travis.karmaShardId" );
168
161
if (_numShards == null || _shardId == null ) {
@@ -194,15 +187,15 @@ void _it(String name, Function fn) {
194
187
var it = _itFirstTime;
195
188
196
189
void iit (String name, Function fn) {
197
- if (_travisMode ) {
198
- throw "iit is not allowed when running under Travis " ;
190
+ if (_failOnIit ) {
191
+ throw "iit is not allowed when running under a CI server " ;
199
192
}
200
193
gns.iit (name, _injectify (fn));
201
194
}
202
195
203
196
void ddescribe (String name, Function fn) {
204
- if (_travisMode ) {
205
- throw "ddescribe is not allowed when running under Travis " ;
197
+ if (_failOnIit ) {
198
+ throw "ddescribe is not allowed when running under a CI server " ;
206
199
}
207
200
gns.ddescribe (name, fn);
208
201
}
0 commit comments