Make less stable tests leverage the retry count of asyncTest.

This commit is contained in:
John-David Dalton
2014-06-10 09:40:53 -07:00
parent 3d1ee9dcf0
commit 885b56000b

View File

@@ -2152,7 +2152,7 @@
} }
}); });
test('should support a `maxWait` option', 2, function() { asyncTest('should support a `maxWait` option', 1, function() {
if (!(isRhino && isModularize)) { if (!(isRhino && isModularize)) {
var limit = (argv || isPhantom) ? 1000 : 320, var limit = (argv || isPhantom) ? 1000 : 320,
withCount = 0, withCount = 0,
@@ -2171,11 +2171,16 @@
withMaxWait(); withMaxWait();
withoutMaxWait(); withoutMaxWait();
} }
ok(withCount > 0); var actual = [Boolean(withCount), Boolean(withoutCount)];
ok(!withoutCount);
setTimeout(function() {
deepEqual(actual, [true, false]);
QUnit.start();
}, 1);
} }
else { else {
skipTest(2); skipTest();
QUnit.start();
} }
}); });
@@ -9331,10 +9336,10 @@
}); });
_.times(2, function(index) { _.times(2, function(index) {
test('should trigger a call when invoked repeatedly' + (index ? ' and `leading` is `false`' : ''), 1, function() { asyncTest('should trigger a call when invoked repeatedly' + (index ? ' and `leading` is `false`' : ''), 1, function() {
if (!(isRhino && isModularize)) { if (!(isRhino && isModularize)) {
var count = 0, var count = 0,
limit = 256, limit = (argv || isPhantom) ? 1000 : 320,
options = index ? { 'leading': false } : {}; options = index ? { 'leading': false } : {};
var throttled = _.throttle(function() { var throttled = _.throttle(function() {
@@ -9345,10 +9350,16 @@
while ((new Date - start) < limit) { while ((new Date - start) < limit) {
throttled(); throttled();
} }
ok(count > 1); var actual = count > 1;
setTimeout(function() {
ok(actual);
QUnit.start();
}, 1);
} }
else { else {
skipTest(); skipTest();
QUnit.start();
} }
}); });
}); });
@@ -9523,7 +9534,7 @@
setTimeout(function() { setTimeout(function() {
deepEqual(actual, expected); deepEqual(actual, expected);
QUnit.start(); QUnit.start();
}, 48); }, 42);
} }
else { else {
skipTest(2); skipTest(2);