var orgModule = QUnit.module;
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.teardown.call( this );
}
- if ( this.sandbox ) {
- this.sandbox.verifyAndRestore();
- }
+ this.sandbox.verifyAndRestore();
}
}, executeNow );
};