Special:JavaScriptTest: send RL errors to the js console
authorStephane Bisson <sbisson@wikimedia.org>
Tue, 31 Jan 2017 16:21:00 +0000 (11:21 -0500)
committerStephane Bisson <sbisson@wikimedia.org>
Mon, 6 Feb 2017 19:18:14 +0000 (14:18 -0500)
ResourceLoader errors, like invalid dependencies, are
hard to spot and only result in the special page
not finding any tests.

This is not a perfect solution but it would have
saved me a full day of troubleshooting.

Change-Id: I247174f89772b84b4cad31deffb03152921df020

includes/specials/SpecialJavaScriptTest.php

index 0e2e7db..dc6a619 100644 (file)
@@ -137,7 +137,9 @@ class SpecialJavaScriptTest extends SpecialPage {
                $code .= '(function () {'
                        . 'var start = window.__karma__ ? window.__karma__.start : QUnit.start;'
                        . 'try {'
-                       . 'mw.loader.using( ' . Xml::encodeJsVar( $modules ) . ' ).always( start );'
+                       . 'mw.loader.using( ' . Xml::encodeJsVar( $modules ) . ' )'
+                       . '.always( start )'
+                       . '.fail( function ( e ) { throw e; } );'
                        . '} catch ( e ) { start(); throw e; }'
                        . '}());';