Move test error catching code before any other script files.

This commit is contained in:
John-David Dalton
2014-05-28 11:58:18 -04:00
parent 7cb47c8494
commit a893d43d16
3 changed files with 33 additions and 21 deletions

View File

@@ -12,6 +12,17 @@
<h1>Test</h1>
</div>
</div>
<script>
// avoid reporting tests to Sauce Labs when script errors occur
if (location.port == '9001') {
window.onerror = function(message) {
if (window.QUnit) {
QUnit.config.done.length = 0;
}
global_test_results = { 'message': message };
};
}
</script>
<script src="../vendor/qunit/qunit/qunit.js"></script>
<script src="../vendor/qunit-extras/qunit-extras.js"></script>
<script src="../vendor/json-js/json2.js"></script>
@@ -42,13 +53,6 @@
}
};
// 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>');

View File

@@ -11,6 +11,17 @@
</style>
</head>
<body>
<script>
// avoid reporting tests to Sauce Labs when script errors occur
if (location.port == '9001') {
window.onerror = function(message) {
if (window.QUnit) {
QUnit.config.done.length = 0;
}
global_test_results = { 'message': message };
};
}
</script>
<script src="../vendor/qunit/qunit/qunit.js"></script>
<script src="../vendor/qunit-extras/qunit-extras.js"></script>
<script src="../vendor/platform.js/platform.js"></script>
@@ -154,13 +165,6 @@
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();

View File

@@ -19,6 +19,17 @@
</div>
<img id="chart_image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==">
</div>
<script>
// avoid reporting tests to Sauce Labs when script errors occur
if (location.port == '9001') {
window.onerror = function(message) {
if (window.QUnit) {
QUnit.config.done.length = 0;
}
global_test_results = { 'message': message };
};
}
</script>
<script src="../vendor/qunit/qunit/qunit.js"></script>
<script src="../vendor/qunit-extras/qunit-extras.js"></script>
<script src="../vendor/jquery/jquery.js"></script>
@@ -128,13 +139,6 @@
}
};
// 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)
else {
delete QUnit.config.excused.Chaining['select/reject/sortBy'];