Last modified: 2014-09-15 08:48:21 UTC
I was thinking about creating some QUnit tests for one of my user scripts and also for a gadget, but AFAIK there is no standard way to do this. The [[Special:JavaScriptTest/qunit]] only says "This function has not been enabled on this wiki." but maybe it should provide a way to let users to run their QUnit tests, e.g. by defining the page name of a script, or some URL param. For example, if a wiki has some gadgets the users (mainly sysops and gadget editors) could follow links to pages such as [[Special:JavaScriptTest/qunit/<some name related to the gadget>]] (or use a URL param, as in "Special:JavaScriptTest/qunit?gadget=foo") as soon as a gadget is changed, to ensure the latest changes didn't broke anything.
One thing I'm not sure is where these tests should be defined: if a gadget has internal name "foo", but is defined on pages with different names, such as "MediaWiki:gadget-bar.js" and "MediaWiki:gadget-bar.css", where would we define the QUnit tests which would be executed when accessing * [[Special:JavaScriptTest/qunit/foo]] * Special:JavaScriptTest/qunit?gadget=foo Should it be... * ... in [[MediaWiki:Gadget-foo/QUnit.js]] ? (then it would not be very obvious for users that its code is related to [[MediaWiki:Gadget-bar.js]]) * ... in [[MediaWiki:Gadget-bar/QUnit.js]] (or [[MediaWiki:Gadget-bar.js/QUnit.js]]) ? (this would mean there could be more than one page where the Unit tests of a single gadget are defined - as many as the number of parts of this gadget) What do you think?
We can probably do this once the Gadgets 2.0 infrastructure is in place...making this depend upon that.