qunit: Restore sinon.sandbox after teardown instead of before
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 7 Jul 2015 14:46:32 +0000 (15:46 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 7 Jul 2015 14:50:13 +0000 (15:50 +0100)
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

tests/qunit/data/testrunner.js

index 7c3d699..b828357 100644 (file)
                                        }
                                },
                                teardown: function () {
-                                       this.sandbox.verifyAndRestore();
-
                                        if ( localEnv.teardown ) {
                                                localEnv.teardown.call( this );
                                        }
+
+                                       this.sandbox.verifyAndRestore();
                                }
                        } );
                };