diff --git a/test/asset/test-ui.js b/test/asset/test-ui.js index d09f15719..5b9a72128 100644 --- a/test/asset/test-ui.js +++ b/test/asset/test-ui.js @@ -164,6 +164,9 @@ // used to indicate testing a modularized build ui.isModularize = /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|node)|modularize|npm)\b/.test([location.pathname, location.search, ui.buildPath]); + // used to indicate testing in Sauce Labs' automated test cloud + ui.isSauceLabs = location.port == '9001'; + // expose `ui` window.ui = ui; diff --git a/test/backbone.html b/test/backbone.html index 737e3cd50..10b59cc35 100644 --- a/test/backbone.html +++ b/test/backbone.html @@ -64,6 +64,12 @@ mixinPrereqs(_); return; } + // avoid reporting tests to Sauce Labs when errors occur + if (ui.isSauceLabs) { + window.onerror = function() { + QUnit.config.done.length = 0; + }; + } var reBasename = /[\w.-]+$/, basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''), modulePath = ui.buildPath.replace(/\.js$/, ''), @@ -127,4 +133,4 @@ }()); - \ No newline at end of file + diff --git a/test/index.html b/test/index.html index 9e44b13e3..1982ab7eb 100644 --- a/test/index.html +++ b/test/index.html @@ -185,6 +185,12 @@ if (!window.require) { return; } + // avoid reporting tests to Sauce Labs when errors occur + if (ui.isSauceLabs) { + window.onerror = function() { + QUnit.config.done.length = 0; + }; + } var reBasename = /[\w.-]+$/, basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''), modulePath = ui.buildPath.replace(/\.js$/, ''), @@ -303,4 +309,4 @@ }; - \ No newline at end of file + diff --git a/test/underscore.html b/test/underscore.html index 022049de0..ac31ff2cc 100644 --- a/test/underscore.html +++ b/test/underscore.html @@ -124,7 +124,7 @@ }; // only excuse in Sauce Labs (buggy Safari and timers) - if (location.port != '9001') { + if (!ui.isSauceLabs) { 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']; @@ -176,6 +176,12 @@ if (!window.require) { return; } + // avoid reporting tests to Sauce Labs when errors occur + if (ui.isSauceLabs) { + window.onerror = function() { + QUnit.config.done.length = 0; + }; + } var reBasename = /[\w.-]+$/, basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''), modulePath = ui.buildPath.replace(/\.js$/, ''), @@ -239,4 +245,4 @@
  • <%= data %>
  • - \ No newline at end of file +