Jump to: navigation, search
Available from version 1.19.0 (r107919)
Add new javascript test suites. This is called after the addition of MediaWiki core test suites.
Define function:
public static function onResourceLoaderTestModules( array &$modules, ResourceLoader &$rl ) { ... }
Attach hook:

In extension.json:

	"Hooks": {
		"ResourceLoaderTestModules": "MyExtensionHooks::onResourceLoaderTestModules"

For MediaWiki ≤1.25:

$wgHooks['ResourceLoaderTestModules'][] = 'MyExtensionHooks::onResourceLoaderTestModules';
Called from: File(s): ResourceLoader.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:ResourceLoaderTestModules extensions.


  • $modules: array of javascript testing modules, keyed by framework (e.g. 'qunit').
  • $rl: ResourceLoader object


This hook is run from ResourceLoader::registerTestModules on wikis that have $wgEnableJavaScriptTest set to true.

Don't forget to add the module that is being tested to the dependencies!
$modules['qunit']['ext.example.test'] = [
	'scripts' => [
	'dependencies' => [
	'localBasePath' => __DIR__,
	'remoteExtPath' => 'Example',

The array syntax is equal to that of ResourceLoaderRegisterModules and $wgResourceModules. This means idioms such as remoteExtPath and remoteSkinPath work here too.

See revision 109127 for an example of adding test support to an extension.

See also[edit]