2016-05-20 04:09:45 -04:00
|
|
|
// /*global jasmine, __karma__, window*/
|
|
|
|
Error.stackTraceLimit = Infinity;
|
2015-12-12 22:20:56 -05:00
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
|
|
|
|
2016-05-20 04:09:45 -04:00
|
|
|
__karma__.loaded = function () {
|
|
|
|
};
|
|
|
|
|
|
|
|
function isJsFile(path) {
|
|
|
|
return path.slice(-3) == '.js';
|
2015-12-12 22:20:56 -05:00
|
|
|
}
|
|
|
|
|
2016-05-20 04:09:45 -04:00
|
|
|
function isSpecFile(path) {
|
|
|
|
return /\.spec\.js$/.test(path);
|
2015-12-12 22:20:56 -05:00
|
|
|
}
|
2016-04-10 18:04:04 -04:00
|
|
|
|
2016-05-20 04:09:45 -04:00
|
|
|
function isBuiltFile(path) {
|
|
|
|
var builtPath = '/base/app/';
|
|
|
|
return isJsFile(path) && (path.substr(0, builtPath.length) == builtPath);
|
2016-04-10 18:04:04 -04:00
|
|
|
}
|
|
|
|
|
2016-05-20 04:09:45 -04:00
|
|
|
var allSpecFiles = Object.keys(window.__karma__.files)
|
|
|
|
.filter(isSpecFile)
|
|
|
|
.filter(isBuiltFile);
|
|
|
|
|
2016-05-21 17:31:22 -04:00
|
|
|
System.config({
|
2016-05-20 04:09:45 -04:00
|
|
|
baseURL: '/base',
|
2016-05-21 17:31:22 -04:00
|
|
|
packageWithIndex: true // sadly, we can't use umd packages (yet?)
|
|
|
|
});
|
2016-05-20 04:09:45 -04:00
|
|
|
|
2016-05-21 17:31:22 -04:00
|
|
|
System.import('systemjs.config.js')
|
|
|
|
.then(function () {
|
|
|
|
return Promise.all([
|
|
|
|
System.import('@angular/core/testing'),
|
|
|
|
System.import('@angular/platform-browser-dynamic/testing')
|
|
|
|
])
|
|
|
|
})
|
|
|
|
.then(function (providers) {
|
|
|
|
var testing = providers[0];
|
|
|
|
var testingBrowser = providers[1];
|
|
|
|
|
|
|
|
testing.setBaseTestProviders(
|
|
|
|
testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
|
|
|
|
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
|
|
|
|
|
|
|
|
})
|
|
|
|
.then(function() {
|
|
|
|
// Finally, load all spec files.
|
|
|
|
// This will run the tests directly.
|
|
|
|
return Promise.all(
|
|
|
|
allSpecFiles.map(function (moduleName) {
|
|
|
|
return System.import(moduleName);
|
|
|
|
}));
|
|
|
|
})
|
|
|
|
.then(__karma__.start, __karma__.error);
|