Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174738

Change subject: [WIP] Debug QUnit race condition
......................................................................

[WIP] Debug QUnit race condition

Change-Id: I41058c4cba3383e3ad1456990ccf8dae4ca64951
---
M tests/qunit/data/testrunner.js
1 file changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/38/174738/1

diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js
index 96a88f0..b800bc2 100644
--- a/tests/qunit/data/testrunner.js
+++ b/tests/qunit/data/testrunner.js
@@ -228,6 +228,7 @@
                                },
 
                                teardown: function () {
+                                       var timers;
                                        log( 'MwEnvironment> TEARDOWN for "' + 
QUnit.config.current.module
                                                + ': ' + 
QUnit.config.current.testName + '"' );
 
@@ -244,9 +245,18 @@
                                        // Check for incomplete 
animations/requests/etc and throw
                                        // error if there are any.
                                        if ( $.timers && $.timers.length !== 0 
) {
-                                               // Test may need to use fake 
timers, wait for animations or
-                                               // call $.fx.stop().
-                                               throw new Error( 'Unfinished 
animations: ' + $.timers.length );
+                                               timers = $.timers.length;
+                                               // Tests shoulld use fake 
timers or wait for animations to complete
+                                               $.each( $.timers, function ( i, 
timer ) {
+                                                       var node = timer.elem;
+                                                       mw.log.warn( 
'Unfinished animation #' + i + ' in ' + timer.queue + ' queue on ' +
+                                                               
mw.html.element( node.nodeName.toLowerCase(), $(node).getAttrs() )
+                                                       );
+                                               } );
+                                               // Force animations to stop to 
give the next test a clean start
+                                               $.fx.stop();
+
+                                               throw new Error( 'Unfinished 
animations: ' + timers );
                                        }
                                        if ( $.active !== undefined && $.active 
!== 0 ) {
                                                // Test may need to use fake 
XHR, wait for requests or

-- 
To view, visit https://gerrit.wikimedia.org/r/174738
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41058c4cba3383e3ad1456990ccf8dae4ca64951
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to