qunit: Disable sinonjs-ie as it breaks the clock sandbox
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 6 Mar 2014 02:33:59 +0000 (03:33 +0100)
committerKrinkle <krinklemail@gmail.com>
Tue, 11 Mar 2014 22:35:18 +0000 (22:35 +0000)
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
tests/qunit/data/testrunner.js

index 58509c1..7eb1d03 100644 (file)
@@ -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' ),
        ),
index ba00ff9..73ae0e6 100644 (file)
@@ -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