From 21b59aabf4205e345fc00300140d87690cdc425c Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 24 Jun 2014 01:28:43 +0200 Subject: [PATCH] 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 --- .../src/jquery/jquery.qunit.completenessTest.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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 ) ); -- 2.20.1