how to fix 404 warnings for images during karma unit testing

That is because you need to configurate karma to load then serve them when requested 😉 In your karma.conf.js file you should already have defined files and/or patterns like : // list of files / patterns to load in the browser files : [ {pattern: ‘app/lib/angular.js’, watched: true, included: true, served: true}, {pattern: ‘app/lib/angular-*.js’, watched: … Read more

angular 4 unit testing error `TypeError: ctor is not a constructor`

This can be an error in the providers declarations. When you try to mock a provider and use useClass instead of useValue the error “TypeError: ctor is not a constructor” is fired. Here is an example that fires the error : providers: [{provide: OrderService, useClass: new OrderServiceMock()}] The correct declaration is : providers: [{provide: OrderService, … Read more

Error: You need to include some adapter that implements __karma__.start method

It does seem like this is a very general error, however in my case the problem was either that I didn’t run karma start from the correct folder, or that I didn’t restart it after changing the configuration. I’ll leave this question open and hopefully it can become a resource for others who experience this … Read more

Karma run single test

If you are using the Karma/Jasmine stack, use: fdescribe(“when …”, function () { // to [f]ocus on a single group of tests fit(“should …”, function () {…}); // to [f]ocus on a single test case }); … and: xdescribe(“when …”, function () { // to e[x]clude a group of tests xit(“should …”, function () {…}); … Read more

Can Protractor and Karma be used together?

Not recommended by the current maintainer of Protractor: https://github.com/angular/protractor/issues/9#issuecomment-19927049 Protractor and Karma should not be used together; instead they provide separate systems for running tests. Protractor and Karma cover different aspects of testing – Karma is intended mostly for unit tests, while Protractor should be used for end to end testing. Protractor is built on … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)