jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/363999 )
Change subject: qunit: Remove redundant conditional for sandbox teardown
......................................................................
qunit: Remove redundant conditional for sandbox teardown
Follows-up 0a208911a257, which added support for the `executeNow`
parameter to QUnit.module.
To properly support nested modules, we also need to skip registering
a second setup and teardown because nested modules already run the
beforeEach (setup), and afterEach (teardown), of their parent modules.
During setup this would needlessly create two sandboxes and override
the 'sandbox' property on the same 'this' context object. During
teardown it would fail because the inner module's teardown would
have already torn down the sandbox.
Change-Id: Ib17bbbef45b2bd0247979cf0fa8aed17800c54a0
---
M tests/qunit/data/testrunner.js
1 file changed, 7 insertions(+), 3 deletions(-)
Approvals:
Aleksey Bekh-Ivanov (WMDE): Looks good to me, but someone else must approve
jenkins-bot: Verified
Jforrester: Looks good to me, approved
diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js
index d7da5a0..f023ddd 100644
--- a/tests/qunit/data/testrunner.js
+++ b/tests/qunit/data/testrunner.js
@@ -64,6 +64,12 @@
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;
@@ -85,9 +91,7 @@
localEnv.teardown.call( this );
}
- if ( this.sandbox ) {
- this.sandbox.verifyAndRestore();
- }
+ this.sandbox.verifyAndRestore();
}
}, executeNow );
};
--
To view, visit https://gerrit.wikimedia.org/r/363999
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib17bbbef45b2bd0247979cf0fa8aed17800c54a0
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Aleksey Bekh-Ivanov (WMDE) <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits