Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit e519352

Browse files
committed
chore(specs): minor style change
1 parent 52b3ab5 commit e519352

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

test/_specs.dart

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,13 @@ void afterEach(Function fn) {
149149
int _numShards = 1;
150150
int _shardId = 0;
151151
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]));
163156

164157
_initSharding() {
165-
_travisMode = (_safeJsGet("__karma__.config.clientArgs.travis") != null);
158+
_failOnIit = (_safeJsGet("__karma__.config.clientArgs.travis") != null);
166159
_numShards = _safeJsGet("__karma__.config.clientArgs.travis.numKarmaShards");
167160
_shardId = _safeJsGet("__karma__.config.clientArgs.travis.karmaShardId");
168161
if (_numShards == null || _shardId == null) {
@@ -194,15 +187,15 @@ void _it(String name, Function fn) {
194187
var it = _itFirstTime;
195188

196189
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";
199192
}
200193
gns.iit(name, _injectify(fn));
201194
}
202195

203196
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";
206199
}
207200
gns.ddescribe(name, fn);
208201
}

0 commit comments

Comments
 (0)