Skip to content

Commit

Permalink
fix(client): show error if an adapter is removed
Browse files Browse the repository at this point in the history
Before we would only show the error when this happens in the first run.
It's not likely to happen, but if the adapter is removed in a subsequent run, it would throw "null is not a function".
  • Loading branch information
vojtajina committed Dec 24, 2013
1 parent 66f50d7 commit a8b250c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions client/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ var Karma = function(socket, iframe, opener, navigator, location) {
}
};

var UNIMPLEMENTED_START = function() {
this.error('You need to include some adapter that implements __karma__.start method!');
};

// all files loaded, let's start the execution
this.loaded = function() {
// has error -> cancel
Expand All @@ -178,7 +182,7 @@ var Karma = function(socket, iframe, opener, navigator, location) {
}

// remove reference to child iframe
this.start = null;
this.start = UNIMPLEMENTED_START;
};

this.store = function(key, value) {
Expand All @@ -199,9 +203,7 @@ var Karma = function(socket, iframe, opener, navigator, location) {

// supposed to be overriden by the context
// TODO(vojta): support multiple callbacks (queue)
this.start = function() {
this.error('You need to include some adapter that implements __karma__.start method!');
};
this.start = UNIMPLEMENTED_START;

socket.on('execute', function(cfg) {
// reset hasError and reload the iframe
Expand Down

0 comments on commit a8b250c

Please sign in to comment.