* Upstream https://github.com/jquery/qunit.git
- tag: v1.8.0
- tree: https://github.com/jquery/qunit/tree/v1.8.0
- commit: https://github.com/jquery/qunit/commit/
8a7fc96381b14792ff1c380ffa6682396658a4c2
* Misc:
- Updated existing release-note entry for QUnit update
- This release introduces the query parameter "module=", which,
contrary to "filter=" reduces the tests to be run to only tests
within the module by that exact name ("filter" does a string search
so filter=foo also matched "module: bar, test: does bafoola quux?".
We should update our TestSwarm configuration to use this parameter
instead.
Change-Id: Iee3f40ca5d50694038e759268c07c2694c98bbc6
- * QUnit v1.7.0 - A JavaScript Unit Testing Framework
+ * QUnit v1.8.0 - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
*
* http://docs.jquery.com/QUnit
*
- * QUnit v1.7.0 - A JavaScript Unit Testing Framework
+ * QUnit v1.8.0 - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
*
* http://docs.jquery.com/QUnit
*
testId = 0,
fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
toString = Object.prototype.toString,
testId = 0,
fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
toString = Object.prototype.toString,
+
+ config.current = undefined;
+ config.current.ignoreGlobalErrors = true;
try {
block.call( config.current.testEnvironment );
} catch (e) {
actual = e;
}
try {
block.call( config.current.testEnvironment );
} catch (e) {
actual = e;
}
+ config.current.ignoreGlobalErrors = false;
if ( actual ) {
// we don't want to validate thrown error
if ( actual ) {
// we don't want to validate thrown error
}
QUnit.urlParams = urlParams;
}
QUnit.urlParams = urlParams;
+
+ // String search anywhere in moduleName+testName
config.filter = urlParams.filter;
config.filter = urlParams.filter;
+
+ // Exact match of the module name
+ config.module = urlParams.module;
+
config.testNumber = parseInt( urlParams.testNumber, 10 ) || null;
// Figure out if we're running the tests from a server or not
config.testNumber = parseInt( urlParams.testNumber, 10 ) || null;
// Figure out if we're running the tests from a server or not
},
pushFailure: function( message, source ) {
},
pushFailure: function( message, source ) {
+ if ( !config.current ) {
+ throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) );
+ }
+
var output,
details = {
result: false,
var output,
details = {
result: false,
addEvent( window, "load", QUnit.load );
addEvent( window, "load", QUnit.load );
-// addEvent(window, "error" ) gives us a useless event object
-window.onerror = function( message, file, line ) {
- if ( QUnit.config.current ) {
- QUnit.pushFailure( message, file + ":" + line );
- } else {
- QUnit.test( "global failure", function() {
- QUnit.pushFailure( message, file + ":" + line );
- });
+// `onErrorFnPrev` initialized at top of scope
+// Preserve other handlers
+onErrorFnPrev = window.onerror;
+
+// Cover uncaught exceptions
+// Returning true will surpress the default browser handler,
+// returning false will let it run.
+window.onerror = function ( error, filePath, linerNr ) {
+ var ret = false;
+ if ( onErrorFnPrev ) {
+ ret = onErrorFnPrev( error, filePath, linerNr );
+
+ // Treat return value as window.onerror itself does,
+ // Only do our handling if not surpressed.
+ if ( ret !== true ) {
+ if ( QUnit.config.current ) {
+ if ( QUnit.config.current.ignoreGlobalErrors ) {
+ return true;
+ }
+ QUnit.pushFailure( error, filePath + ":" + linerNr );
+ } else {
+ QUnit.test( "global failure", function() {
+ QUnit.pushFailure( error, filePath + ":" + linerNr );
+ });
+ }
+ return false;
+ }
+
+ return ret;
+/** @return Boolean: true if this test should be ran */
function validTest( test ) {
var include,
filter = config.filter && config.filter.toLowerCase(),
function validTest( test ) {
var include,
filter = config.filter && config.filter.toLowerCase(),
+ module = config.module,
fullName = (test.module + ": " + test.testName).toLowerCase();
if ( config.testNumber ) {
return test.testNumber === config.testNumber;
}
fullName = (test.module + ": " + test.testName).toLowerCase();
if ( config.testNumber ) {
return test.testNumber === config.testNumber;
}
+ if ( module && test.module !== module ) {
+ return false;
+ }
+
if ( !filter ) {
return true;
}
if ( !filter ) {
return true;
}