2016-10-04 23:39:20 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-05-20 16:22:57 -04:00
|
|
|
/*global jasmine, __karma__, window*/
|
2016-06-24 14:17:17 -04:00
|
|
|
Error.stackTraceLimit = 5;
|
2016-05-20 16:22:57 -04:00
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
|
|
|
|
2016-10-04 23:39:20 -04:00
|
|
|
__karma__.loaded = function() {};
|
2016-05-20 16:22:57 -04:00
|
|
|
|
2017-12-17 18:10:54 -05:00
|
|
|
window.isNode = false;
|
|
|
|
window.isBrowser = true;
|
|
|
|
|
2016-05-20 16:22:57 -04:00
|
|
|
function isJsFile(path) {
|
|
|
|
return path.slice(-3) == '.js';
|
|
|
|
}
|
|
|
|
|
|
|
|
function isSpecFile(path) {
|
|
|
|
return path.slice(-7) == 'spec.js';
|
|
|
|
}
|
|
|
|
|
|
|
|
function isBuiltFile(path) {
|
|
|
|
var builtPath = '/base/dist/';
|
|
|
|
return isJsFile(path) && (path.substr(0, builtPath.length) == builtPath);
|
|
|
|
}
|
|
|
|
|
2016-10-04 23:39:20 -04:00
|
|
|
var allSpecFiles = Object.keys(window.__karma__.files).filter(isSpecFile).filter(isBuiltFile);
|
2016-05-20 16:22:57 -04:00
|
|
|
|
|
|
|
// Load our SystemJS configuration.
|
|
|
|
System.config({
|
2016-10-04 23:39:20 -04:00
|
|
|
baseURL: '/base',
|
2016-05-20 16:22:57 -04:00
|
|
|
});
|
|
|
|
|
2016-10-04 23:39:20 -04:00
|
|
|
System.config({
|
2018-02-27 17:06:06 -05:00
|
|
|
map: {
|
|
|
|
'@angular': 'dist/all/@angular',
|
|
|
|
'rxjs': 'node_modules/rxjs',
|
|
|
|
},
|
2016-10-04 23:39:20 -04:00
|
|
|
packages: {
|
|
|
|
'@angular/core/testing': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/compiler/testing': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/common/testing': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/platform-browser/testing': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/platform-browser-dynamic/testing': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
|
2018-11-20 11:02:35 -05:00
|
|
|
'@angular/private/testing': {main: 'index.js', defaultExtension: 'js'},
|
2017-11-07 12:21:48 -05:00
|
|
|
'@angular/upgrade/static': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/router/upgrade': {main: 'index.js', defaultExtension: 'js'},
|
2016-10-04 23:39:20 -04:00
|
|
|
'@angular/router/testing': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
|
2018-02-27 17:06:06 -05:00
|
|
|
'rxjs/ajax': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'rxjs/operators': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'rxjs/testing': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'rxjs/websocket': {main: 'index.js', defaultExtension: 'js'},
|
|
|
|
'rxjs': {main: 'index.js', defaultExtension: 'js'},
|
2016-10-04 23:39:20 -04:00
|
|
|
}
|
|
|
|
});
|
2016-05-20 16:22:57 -04:00
|
|
|
|
2016-10-04 23:39:20 -04:00
|
|
|
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];
|
2016-05-20 16:22:57 -04:00
|
|
|
|
2016-10-04 23:39:20 -04:00
|
|
|
testing.TestBed.initTestEnvironment(
|
|
|
|
testingBrowser.BrowserDynamicTestingModule,
|
|
|
|
testingBrowser.platformBrowserDynamicTesting());
|
2016-05-20 16:22:57 -04:00
|
|
|
|
2016-10-04 23:39:20 -04:00
|
|
|
})
|
|
|
|
.then(function() {
|
|
|
|
// Finally, load all spec files.
|
|
|
|
// This will run the tests directly.
|
|
|
|
return Promise.all(
|
|
|
|
allSpecFiles.map(function(moduleName) { return System.import(moduleName); }));
|
|
|
|
})
|
2017-04-06 08:11:58 -04:00
|
|
|
.then(__karma__.start, function(v) { console.error(v); });
|