https://bugzilla.wikimedia.org/show_bug.cgi?id=30339

--- Comment #3 from Krinkle <krinklem...@gmail.com> 2011-08-15 08:25:39 UTC ---
Implementation details:
* New Special:UnitTesting page (user scripts disabled, isListed returns false
depending on $wgEnableSpecialUnitTesting)
* Shows a list of frameworks, by default only qunit
* [[Special:UnitTesting/qunit]] outputs the QUnit base html and loads
testrunner (which loads jquery.qunit and the other stuff we need) + all test
suites by passing $wgUnitTestingQUnitSuites to OutputPage's addModules().

TBD:
* As can be seen in the patch in the comment above wgUnitTestingQUnitSuites in
DefaultSettings, adding stuff for extensions looks a little funky. The reason
is simple, we don't want all test suites to be registered unless
wgEnableSpecialUnitTesting is true (to avoid polluting the start up module with
a lot of crap and making it twice or three times as big). I also considered
adding a global variable just for these modules and calling register() myself
in the SpecialUnitTesting page, but that doesn't work either because load.php
doesn't know on what page we are, so they wouldn't be registered. Plus, that
would mess up or not work at all with caching since startup has (and should
have) only 1 cache. StartUp should never depend on user or page. So I attempted
to create a hook inside ResourceLoader->__construct() that is only ran if
wgEnableSpecialUnitTesting is true. And if it is register the modules and add
the array_keys of the modules to $wgUnitTestingQUnitSuites.

The problem is that didn't work because ResourceLoader->__construct() runs
AFTER SpecialUnitTesting->execute(), so when SpecialUnitTesting->execute() did
addModules( wgUnitTestingQUnitSuites ), nothing was added. That's why I work
around this by letting extensions add their array keys to
wgUnitTestingQUnitSuites in the global scope right away, and the registry
separately through the hook. If anybody has a better solution, I would love to
change it since I'm not liking this very much.

Problems:
* When I applied this patch and set wgEnableSpecialUnitTesting to true, and
visited [[Special:UnitTesting/qunit]], I got :
> Uncaught RangeError: Maximum call stack size exceeded
in my console and none of the test suites was loaded. As a result many other
modules are broken too. (such as Exception thrown by user.options: Cannot read
property 'options' of undefined).

I suspect $.inArray in resolve() inside mw.loader's scope is doing something
wrong.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to