Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP-899 Move System null-check to a useful location #94

Merged
merged 1 commit into from
Aug 25, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@
*/

(function(karma, System) {
if (!System) {
throw new Error("SystemJS was not found. Please make sure you have " +
"initialized jspm via installing a dependency with jspm, " +
"or by running 'jspm dl-loader'.");
}

System.config({ baseURL: 'base' });

var promises = [];

// Prevent immediately starting tests.
window.__karma__.loaded = function() {

Expand All @@ -36,27 +44,19 @@
for (var i = 0; i < karma.config.jspm.expandedFiles.length; i++) {
var modulePath = karma.config.jspm.expandedFiles[i];
var promise = System['import'](extractModuleName(modulePath))
['catch'](function(e){
['catch'](function(e) {
throw e;
});
promises.push(promise);
}

// Promise comes from the systemjs polyfills
Promise.all(promises).then(function(){
Promise.all(promises).then(function() {
karma.start();
});
};

function extractModuleName(fileName){
function extractModuleName(fileName) {
return fileName.replace(/\.js$/, "");
}

var promises = [];

if(!System){
throw new Error("SystemJS was not found. Please make sure you have " +
"initialized jspm via installing a dependency with jspm, " +
"or by running 'jspm dl-loader'.");
}
})(window.__karma__, window.System);