From: Timo Tijhof Date: Mon, 23 Jun 2014 23:28:43 +0000 (+0200) Subject: qunit.completenessTest: Suppress mw.log.warn in walkTheObject X-Git-Tag: 1.31.0-rc.0~15155^2 X-Git-Url: http://git.cyclocoop.org/wiki/Target_page?a=commitdiff_plain;h=21b59aabf4205e345fc00300140d87690cdc425c;p=lhc%2Fweb%2Fwiklou.git qunit.completenessTest: Suppress mw.log.warn in walkTheObject Lots of false positives where triggered for deprecation notices while iterating over the object. Change-Id: I710946062edd38b8d72ced6d67bd4bb7613246e3 --- diff --git a/resources/src/jquery/jquery.qunit.completenessTest.js b/resources/src/jquery/jquery.qunit.completenessTest.js index 77e38d3c60..8d38401eb9 100644 --- a/resources/src/jquery/jquery.qunit.completenessTest.js +++ b/resources/src/jquery/jquery.qunit.completenessTest.js @@ -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. @@ -77,12 +79,18 @@ 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 () { @@ -294,4 +302,4 @@ /* Expose */ window.CompletenessTest = CompletenessTest; -}( jQuery ) ); +}( mediaWiki, jQuery ) );