[Framework] Add RequireJS configurator

Add a configuration step (as part of the resolve phase)
to the framework layer, where bundle-defined paths and shims
are passed to RequireJS configuration. This permits both
the use of non-AMD modules and the exposure of libraries
across bundles. WTD-568.
This commit is contained in:
Victor Woeltjen
2015-01-02 17:46:50 -08:00
parent d281bd52de
commit 96aaea5e58
8 changed files with 191 additions and 9 deletions

View File

@@ -0,0 +1,30 @@
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,runs*/
define(
["../../src/resolve/RequireConfigurator"],
function (RequireConfigurator) {
"use strict";
describe("The RequireJS configurator", function () {
var mockRequire,
configurator;
beforeEach(function () {
mockRequire = jasmine.createSpyObj(
"requirejs",
[ "config" ]
);
configurator = new RequireConfigurator(mockRequire);
});
it("configures RequireJS when invoked", function () {
// Verify precondition - no config call
expect(mockRequire.config).not.toHaveBeenCalled();
// Configure with an empty set of bundles
configurator.configure([]);
// Should have invoked require.config
expect(mockRequire.config).toHaveBeenCalled();
});
});
}
);