jenkins-bot has submitted this change and it was merged.
Change subject: qunit/testrunner: Log relevant node in unfinished animations
and reset
......................................................................
qunit/testrunner: Log relevant node in unfinished animations and reset
Having unfinished animations affect other test can be a problem,
but when it does happen, having just a number isn't helpful in
trying to pinpoint the cause.
Logging a description of the element should make this relatively
straight forward.
Also reset the animations after the test so that the next test has a
clean start (instead of the current situation where every subsequent
test, until the animation finishes, also reports it as a failure).
Example:
Unfinished animation #0 in fx queue on <div class="mw-notification
mw-notification-tag-legacy" style="opacity: 0; "/>
Change-Id: I41058c4cba3383e3ad1456990ccf8dae4ca64951
---
M tests/qunit/data/testrunner.js
1 file changed, 13 insertions(+), 3 deletions(-)
Approvals:
Mattflaschen: Looks good to me, approved
jenkins-bot: Verified
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: merged
Gerrit-Change-Id: I41058c4cba3383e3ad1456990ccf8dae4ca64951
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits