From 6656612660b71177a3085eaeded236c96b5491e6 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 6 Mar 2014 03:33:59 +0100 Subject: [PATCH] qunit: Disable sinonjs-ie as it breaks the clock sandbox The ie fixes file assumes running in the global scope. Since it runs locally in our environment, it ends up destroying its references to e.g. the Date object. Then when calling sandbox.useFakeTimers, the Date constructor will yield an object with no methods and tests will fail at a random point when e.g. trying to access date.getTime(). * Remove 'clock' from the sinon properties we inject into the test context. We use the sandbox instead (just like for server). This also fixes a shadow clash with the tests that stored the clock instance in `this.clock`. Change-Id: I6085bccf5038e4751da48ee765fe81560f58c6e8 --- tests/qunit/QUnitTestResources.php | 8 +++++++- tests/qunit/data/testrunner.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/qunit/QUnitTestResources.php b/tests/qunit/QUnitTestResources.php index 58509c1cd2..7eb1d03339 100644 --- a/tests/qunit/QUnitTestResources.php +++ b/tests/qunit/QUnitTestResources.php @@ -9,7 +9,13 @@ return array( 'test.sinonjs' => array( 'scripts' => array( 'resources/sinonjs/sinon-1.9.0.js', - 'resources/sinonjs/sinon-ie-1.9.0.js', + // We want tests to work in IE, but can't include this as it + // will break the placeholders in Sinon because the hack it uses + // to hijack IE globals relies on running in the global scope + // and in ResourceLoader this won't be running in the global scope. + // Including it results (among other things) in sandboxed timers + // being broken due to Date inheritance being undefined. + // 'resources/sinonjs/sinon-ie-1.9.0.js', ), 'targets' => array( 'desktop', 'mobile' ), ), diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js index ba00ff9a7c..73ae0e656a 100644 --- a/tests/qunit/data/testrunner.js +++ b/tests/qunit/data/testrunner.js @@ -82,7 +82,7 @@ sinon.config = { injectIntoThis: true, injectInto: null, - properties: ['spy', 'stub', 'mock', 'clock', 'sandbox'], + properties: ['spy', 'stub', 'mock', 'sandbox'], // Don't fake timers by default useFakeTimers: false, useFakeServer: false -- 2.20.1