Skip to content

Commit

Permalink
feat(client): show error if no adapter is included
Browse files Browse the repository at this point in the history
Before this fix, Karma would just execute "an empty" test suite. The next run would however end up with an exception (Property "start" is not a function).

This should make it easier to understand.
  • Loading branch information
vojtajina committed Nov 30, 2013
1 parent 3308b98 commit 7213877
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/karma.js
Expand Up @@ -177,7 +177,9 @@ var Karma = function(socket, context, navigator, location) {

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

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

3 comments on commit 7213877

@jamie-pate
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this invalidates the instructions here: http://karma-runner.github.io/0.10/plus/requirejs.html
Or perhaps i'm not loading an adapter..

@vojtajina
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jamie-pate you either have to load an adapter that defines __karma__.start or you have to define it yourself. I don't see anything that would invalidate the instructions from http://karma-runner.github.io/0.10/plus/requirejs.html - what exactly?

When using RequireJS you still need some testing framework - for instance load Jasmine (karma-jasmine plugin), its adapter does define __karma__.start.

@jamie-pate
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes there was a problem with my configuration or a require js error causing this message to appear. Eventually got it working... Nothing to see here :)

Please sign in to comment.