use angular2/test_lib for tests

This commit is contained in:
Tim Lancina
2015-10-08 12:28:59 -05:00
parent a92ea015bd
commit 3203fa16a1
2 changed files with 18 additions and 13 deletions

View File

@@ -8,6 +8,7 @@ module.exports = function(config) {
frameworks: ['jasmine'],
files: buildConfig.scripts.concat([
'node_modules/angular2/bundles/test_lib.dev.js',
'dist/tests/**/*.spec.js',
'scripts/karma/test-main.js'
]),

View File

@@ -4,19 +4,23 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 50;
// we will call `__karma__.start()` later, once all the specs are loaded.
__karma__.loaded = function() {};
Promise.all(
Object.keys(window.__karma__.files) // All files served by Karma.
.filter(onlySpecFiles)
.map(window.file2moduleName) // Normalize paths to module names.
.map(function(path) {
return System.import(path).then(function(module) {
if (module.hasOwnProperty('run')) {
module.run();
} else {
console.warn('WARNING: Module ' + path + ' does not implement a run() method. No tests run.');
}
});
}))
System.import('angular2/src/core/dom/browser_adapter').then(function(browser_adapter) {
browser_adapter.BrowserDomAdapter.makeCurrent();
}).then(function() {
return Promise.all(
Object.keys(window.__karma__.files) // All files served by Karma.
.filter(onlySpecFiles)
.map(window.file2moduleName) // Normalize paths to module names.
.map(function(path) {
return System.import(path).then(function(module) {
if (module.hasOwnProperty('run')) {
module.run();
} else {
console.warn('WARNING: Module ' + path + ' does not implement a run() method. No tests run.');
}
});
}))
})
.then(function() {
__karma__.start();
}, function(error) {