1 | "use strict";
|
2 | var __rest = (this && this.__rest) || function (s, e) {
|
3 | var t = {};
|
4 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
5 | t[p] = s[p];
|
6 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
7 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
8 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
9 | t[p[i]] = s[p[i]];
|
10 | }
|
11 | return t;
|
12 | };
|
13 | intern.registerLoader(function (options) {
|
14 | var globalObj = typeof window !== 'undefined' ? window : global;
|
15 | var _a = options.internLoaderPath, internLoaderPath = _a === void 0 ? 'node_modules/systemjs/dist/system.src.js' : _a, loaderConfig = __rest(options, ["internLoaderPath"]);
|
16 | loaderConfig.baseURL = loaderConfig.baseURL || intern.config.basePath;
|
17 | if (intern.environment === 'browser') {
|
18 | return intern.loadScript(internLoaderPath).then(function () {
|
19 | return configAndLoad(SystemJS);
|
20 | });
|
21 | }
|
22 | else {
|
23 | var SystemJS_1 = (globalObj.require || require)('systemjs');
|
24 | return configAndLoad(SystemJS_1);
|
25 | }
|
26 | function configAndLoad(loader) {
|
27 | intern.log('Using SystemJS loader');
|
28 | intern.log('Configuring SystemJS with:', loaderConfig);
|
29 | loader.config(loaderConfig);
|
30 | return function (modules) {
|
31 | intern.log('Loading modules with SystemJS:', modules);
|
32 | return modules.reduce(function (previous, suite) {
|
33 | if (previous) {
|
34 | return previous.then(function () { return loader.import(suite); });
|
35 | }
|
36 | return loader.import(suite);
|
37 | }, null);
|
38 | };
|
39 | }
|
40 | });
|
41 |
|
\ | No newline at end of file |