[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:
30
platform/framework/test/resolve/RequireConfiguratorSpec.js
Normal file
30
platform/framework/test/resolve/RequireConfiguratorSpec.js
Normal 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();
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user