diff --git a/scripts/karma/karma.conf.js b/scripts/karma/karma.conf.js index d05990d431..ac5855f203 100644 --- a/scripts/karma/karma.conf.js +++ b/scripts/karma/karma.conf.js @@ -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' ]), diff --git a/scripts/karma/test-main.js b/scripts/karma/test-main.js index c0deefdd35..de357b69bb 100644 --- a/scripts/karma/test-main.js +++ b/scripts/karma/test-main.js @@ -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) {