This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/initializers/auto-load-modules.js.es6
David Taylor febd7621ea Qunit plugin rake tasks (#4985)
* Allow running specific plugin tests using ENV variables

* Add a `rake plugin:qunit` task to match the existing `rake plugin:spec` task

* Improve docker.rake to allow running specific plugin qunit tests

* Purge cache before and after qunit tests

* Stop module auto-loader trying to auto-load tests

* Use URL query parameters to pass config into Qunit, avoiding caching issues

* Oops, searchParams doesn’t work in phantomJS. Parse the URL manually.

* Escape ampersands before passing URL to phantomJS, otherwise multiple parameters go wrong
2017-07-26 09:07:46 -04:00

19 lines
515 B
JavaScript

import { registerHelpers } from 'discourse-common/lib/helpers';
export function autoLoadModules(container, registry) {
Object.keys(requirejs.entries).forEach(entry => {
if ((/\/helpers\//).test(entry) && !(/-test/).test(entry)) {
requirejs(entry, null, null, true);
}
if ((/\/widgets\//).test(entry) && !(/-test/).test(entry)) {
requirejs(entry, null, null, true);
}
});
registerHelpers(registry);
}
export default {
name: 'auto-load-modules',
initialize: autoLoadModules
};