( function () {
var orgModule = QUnit.module;
- QUnit.module = function ( name, localEnv ) {
+ QUnit.module = function ( name, localEnv, executeNow ) {
+ if ( QUnit.config.moduleStack.length ) {
+ // When inside a nested module, don't add our Sinon
+ // setup/teardown a second time.
+ return orgModule.apply( this, arguments );
+ }
+
+ if ( arguments.length === 2 && typeof localEnv === 'function' ) {
+ executeNow = localEnv;
+ localEnv = undefined;
+ }
+
localEnv = localEnv || {};
orgModule( name, {
setup: function () {
this.sandbox.verifyAndRestore();
}
- } );
+ }, executeNow );
};
}() );
( function () {
var orgModule = QUnit.module;
- QUnit.module = function ( name, localEnv ) {
+ QUnit.module = function ( name, localEnv, executeNow ) {
var fixture;
+
+ if ( arguments.length === 2 && typeof localEnv === 'function' ) {
+ executeNow = localEnv;
+ localEnv = undefined;
+ }
+
localEnv = localEnv || {};
orgModule( name, {
setup: function () {
fixture.parentNode.removeChild( fixture );
}
- } );
+ }, executeNow );
};
}() );
return {
setup: function () {
-
// Greetings, mock environment!
mw.config = new MwMap();
mw.config.set( freshConfigCopy( localEnv.config ) );
);
} );
// Force animations to stop to give the next test a clean start
+ $.timers = [];
$.fx.stop();
throw new Error( 'Unfinished animations: ' + timers );