From: Timo Tijhof Date: Tue, 7 Jul 2015 14:46:32 +0000 (+0100) Subject: qunit: Restore sinon.sandbox after teardown instead of before X-Git-Tag: 1.31.0-rc.0~10858^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=3e59344c695ed6f57582bd111c8d898743753423;p=lhc%2Fweb%2Fwiklou.git qunit: Restore sinon.sandbox after teardown instead of before This was causing pending (mocked) XHR requests to sometimes be cleaned up prematurely. As a general rule, setup always calls its parent first. And teardown always calls its parent last. The inner callback runs within the scope of the outer one and should still have acces to the sinon mocks. Change-Id: Ic4d9243c04af73e529b689e650d35ddabaa7f4b9 --- diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js index 7c3d6991a6..b8283572fd 100644 --- a/tests/qunit/data/testrunner.js +++ b/tests/qunit/data/testrunner.js @@ -90,11 +90,11 @@ } }, teardown: function () { - this.sandbox.verifyAndRestore(); - if ( localEnv.teardown ) { localEnv.teardown.call( this ); } + + this.sandbox.verifyAndRestore(); } } ); };