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

Commit 8fd840e

Browse files
chirayukVictor Savkin
authored and
Victor Savkin
committed
chore(specs): minor style change
1 parent 6c5a161 commit 8fd840e

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
@@ -150,20 +150,13 @@ void afterEach(Function fn) {
150150
int _numShards = 1;
151151
int _shardId = 0;
152152
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]));
164157

165158
_initSharding() {
166-
_travisMode = (_safeJsGet("__karma__.config.clientArgs.travis") != null);
159+
_failOnIit = (_safeJsGet("__karma__.config.clientArgs.travis") != null);
167160
_numShards = _safeJsGet("__karma__.config.clientArgs.travis.numKarmaShards");
168161
_shardId = _safeJsGet("__karma__.config.clientArgs.travis.karmaShardId");
169162
if (_numShards == null || _shardId == null) {
@@ -195,15 +188,15 @@ void _it(String name, Function fn) {
195188
var it = _itFirstTime;
196189

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

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

0 commit comments

Comments
 (0)