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