mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
Attempt to detect more false test errors.
This commit is contained in:
@@ -42,6 +42,13 @@
|
||||
}
|
||||
};
|
||||
|
||||
// avoid reporting tests to Sauce Labs when script errors occur
|
||||
if (ui.isSauceLabs) {
|
||||
window.onerror = function(message) {
|
||||
QUnit.config.done.length = 0;
|
||||
global_test_results = { 'message': message };
|
||||
};
|
||||
}
|
||||
// load Lo-Dash
|
||||
if (!ui.isModularize) {
|
||||
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
||||
|
||||
@@ -152,6 +152,15 @@
|
||||
delete String.prototype._contains;
|
||||
}
|
||||
|
||||
QUnit.config.hidepassed = true;
|
||||
|
||||
// avoid reporting tests to Sauce Labs when script errors occur
|
||||
if (ui.isSauceLabs) {
|
||||
window.onerror = function(message) {
|
||||
QUnit.config.done.length = 0;
|
||||
global_test_results = { 'message': message };
|
||||
};
|
||||
}
|
||||
// load Lo-Dash and expose it to the bad extensions/shims
|
||||
if (!ui.isModularize) {
|
||||
addBizarroMethods();
|
||||
@@ -159,8 +168,6 @@
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
QUnit.config.hidepassed = true;
|
||||
|
||||
// store Lo-Dash to test for bad extensions/shims
|
||||
if (!ui.isModularize) {
|
||||
var lodashBizarro = window._;
|
||||
|
||||
@@ -33,7 +33,7 @@ var maxJobRetries = 3,
|
||||
|
||||
/** Used as the static file server middleware */
|
||||
var mount = ecstatic({
|
||||
'cache': false,
|
||||
'cache': 'no-cache',
|
||||
'root': process.cwd()
|
||||
});
|
||||
|
||||
@@ -55,6 +55,9 @@ var push = Array.prototype.push;
|
||||
/** Used to detect error messages */
|
||||
var reError = /\berror\b/i;
|
||||
|
||||
/** Used to detect valid job ids */
|
||||
var reJobId = /^[a-z0-9]{32}$/;
|
||||
|
||||
/** Used to display the wait throbber */
|
||||
var throbberDelay = 500,
|
||||
waitCount = -1;
|
||||
@@ -70,7 +73,7 @@ var advisor = getOption('advisor', true),
|
||||
maxDuration = getOption('maxDuration', 360),
|
||||
port = ports[Math.min(_.sortedIndex(ports, getOption('port', 9001)), ports.length - 1)],
|
||||
publicAccess = getOption('public', true),
|
||||
queueTimeout = getOption('queueTimeout', 360),
|
||||
queueTimeout = getOption('queueTimeout', 600),
|
||||
recordVideo = getOption('recordVideo', true),
|
||||
recordScreenshots = getOption('recordScreenshots', false),
|
||||
runner = getOption('runner', 'test/index.html').replace(/^\W+/, ''),
|
||||
@@ -399,7 +402,7 @@ function onJobStatus(error, res, body) {
|
||||
platform = options.platforms[0],
|
||||
description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + capitalizeWords(platform[0]),
|
||||
elapsed = (_.now() - this.timestamp) / 1000,
|
||||
errored = !jobResult || reError.test(message),
|
||||
errored = !jobResult || reError.test(message) || reError.test(jobStatus),
|
||||
expired = (elapsed >= queueTimeout && !_.contains(jobStatus, 'in progress')),
|
||||
failures = _.result(jobResult, 'failed'),
|
||||
label = options.name + ':',
|
||||
@@ -409,9 +412,11 @@ function onJobStatus(error, res, body) {
|
||||
if (!this.running || this.stopping) {
|
||||
return;
|
||||
}
|
||||
this.id = jobId;
|
||||
this.result = jobResult;
|
||||
this.url = jobUrl;
|
||||
if (reJobId.test(jobId)) {
|
||||
this.id = jobId;
|
||||
this.result = jobResult;
|
||||
this.url = jobUrl;
|
||||
}
|
||||
this.emit('status', jobStatus);
|
||||
|
||||
if (!completed && !expired) {
|
||||
@@ -524,8 +529,8 @@ Job.prototype.remove = function(callback) {
|
||||
this.removing = true;
|
||||
return this.stop(function() {
|
||||
var onRemove = _.bind(onJobRemove, this);
|
||||
if (this.id == null) {
|
||||
onRemove();
|
||||
if (!reJobId.test(this.id)) {
|
||||
_.defer(onRemove);
|
||||
return;
|
||||
}
|
||||
request.del(_.template('https://saucelabs.com/rest/v1/${user}/jobs/${id}', this), {
|
||||
@@ -637,7 +642,7 @@ Job.prototype.stop = function(callback) {
|
||||
this.checking = false;
|
||||
}
|
||||
var onStop = _.bind(onGenericStop, this);
|
||||
if (!this.running) {
|
||||
if (!this.running || !reJobId.test(this.id)) {
|
||||
_.defer(onStop);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -128,8 +128,15 @@
|
||||
}
|
||||
};
|
||||
|
||||
// avoid reporting tests to Sauce Labs when script errors occur
|
||||
if (ui.isSauceLabs) {
|
||||
window.onerror = function(message) {
|
||||
QUnit.config.done.length = 0;
|
||||
global_test_results = { 'message': message };
|
||||
};
|
||||
}
|
||||
// only excuse in Sauce Labs (buggy Safari and timers)
|
||||
if (!ui.isSauceLabs) {
|
||||
else {
|
||||
delete QUnit.config.excused.Chaining['select/reject/sortBy'];
|
||||
delete QUnit.config.excused.Chaining['select/reject/sortBy in functional style'];
|
||||
delete QUnit.config.excused.Functions['throttle repeatedly with results'];
|
||||
|
||||
Reference in New Issue
Block a user