qunit.completenessTest: Suppress mw.log.warn in walkTheObject
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 23 Jun 2014 23:28:43 +0000 (01:28 +0200)
committerKrinkle <krinklemail@gmail.com>
Sun, 29 Jun 2014 20:59:38 +0000 (20:59 +0000)
Lots of false positives where triggered for deprecation notices
while iterating over the object.

Change-Id: I710946062edd38b8d72ced6d67bd4bb7613246e3

resources/src/jquery/jquery.qunit.completenessTest.js

index 77e38d3..8d38401 100644 (file)
@@ -12,7 +12,7 @@
  *
  * @author Timo Tijhof, 2011-2012
  */
-( function ( $ ) {
+( function ( mw, $ ) {
        'use strict';
 
        var util,
@@ -64,6 +64,8 @@
         *  were not called from that instance.
         */
        function CompletenessTest( masterVariable, ignoreFn ) {
+               var warn,
+                       that = this;
 
                // Keep track in these objects. Keyed by strings with the
                // method names (ie. 'my.foo', 'my.bar', etc.) values are boolean true.
                this.lazyLimit = 2000;
                this.lazyCounter = 0;
 
-               var that = this;
-
                // Bind begin and end to QUnit.
                QUnit.begin( function () {
+                       // Suppress warnings (e.g. deprecation notices for accessing the properties)
+                       warn = mw.log.warn;
+                       mw.log.warn = $.noop;
+
                        that.walkTheObject( masterVariable, null, masterVariable, [] );
                        log( 'CompletenessTest/walkTheObject', that );
+
+                       // Restore warnings
+                       mw.log.warn = warn;
+                       warn = undefined;
                });
 
                QUnit.done( function () {
        /* Expose */
        window.CompletenessTest = CompletenessTest;
 
-}( jQuery ) );
+}( mediaWiki, jQuery ) );