Commit 4ee4cf57 authored by Ward Bell's avatar Ward Bell

chore: test configuration refactoring for readability

parent 11943f67
...@@ -41,30 +41,29 @@ System.config({ packages: packages }); ...@@ -41,30 +41,29 @@ System.config({ packages: packages });
// Configure Angular for the browser and // Configure Angular for the browser and
// with test versions of the platform providers // with test versions of the platform providers
System.import('angular2/testing') Promise.all([
.then(function (testing) { System.import('angular2/testing'),
return System.import('angular2/platform/testing/browser') System.import('angular2/platform/testing/browser')
.then(function (providers) { ])
testing.setBaseTestProviders( .then(function (results) {
providers.TEST_BROWSER_PLATFORM_PROVIDERS, var testing = results[0];
providers.TEST_BROWSER_APPLICATION_PROVIDERS var browser = results[1];
); testing.setBaseTestProviders(
}); browser.TEST_BROWSER_PLATFORM_PROVIDERS,
browser.TEST_BROWSER_APPLICATION_PROVIDERS);
// Load all spec files
// (e.g. 'base/app/hero.service.spec.js')
return Promise.all(
Object.keys(window.__karma__.files)
.filter(onlySpecFiles)
.map(function (moduleName) {
moduleNames.push(moduleName);
return System.import(moduleName);
}));
}) })
// Load all spec files .then(success, fail);
// (e.g. 'base/app/hero.service.spec.js')
.then(function () {
return Promise.all(
Object.keys(window.__karma__.files)
.filter(onlySpecFiles)
.map(function (moduleName) {
moduleNames.push(moduleName);
return System.import(moduleName);
}));
})
.then(success, fail);
////// Helpers ////// ////// Helpers //////
......
...@@ -51,7 +51,8 @@ module.exports = function () { ...@@ -51,7 +51,8 @@ module.exports = function () {
} }
}); });
// Configure Angular for the browser and
// with test versions of the platform providers
Promise.all([ Promise.all([
System.import('angular2/testing'), System.import('angular2/testing'),
System.import('angular2/platform/testing/browser') System.import('angular2/platform/testing/browser')
...@@ -63,8 +64,9 @@ module.exports = function () { ...@@ -63,8 +64,9 @@ module.exports = function () {
browser.TEST_BROWSER_PLATFORM_PROVIDERS, browser.TEST_BROWSER_PLATFORM_PROVIDERS,
browser.TEST_BROWSER_APPLICATION_PROVIDERS); browser.TEST_BROWSER_APPLICATION_PROVIDERS);
// Load all spec files
return Promise.all(wallaby.tests.map(function (specFile) { return Promise.all(wallaby.tests.map(function (specFile) {
return System.import(specFile.replace(/\.js$/, '')); return System.import(specFile);
})); }));
}) })
.then(function () { .then(function () {
...@@ -76,6 +78,7 @@ module.exports = function () { ...@@ -76,6 +78,7 @@ module.exports = function () {
}, 0); }, 0);
}); });
}, },
debug: true debug: true
}; };
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment