Karma runner console – output only failed tests

Looking at http://karma-runner.github.io/0.10/config/configuration-file.html Have you tried setting the config to use an empty reporters array? Karma v0.10 defaults to a reporters config of [‘progress’], which is likely causing your verbose output. You might like the ‘dots’ reporter. You can try it on the CLI using karma start yourconfig.js –reporters dots

Testing whether certain elements are visible or not

This behavior has changed in Angular 1.2 because of ng-animate. The code for ngShow is: var ngShowDirective = [‘$animate’, function($animate) { return function(scope, element, attr) { scope.$watch(attr.ngShow, function ngShowWatchAction(value){ $animate[toBoolean(value) ? ‘removeClass’ : ‘addClass’](element, ‘ng-hide’); }); }; }]; Which means that it will add/remove class ng-hide to hide/show the element. Thus, as an example, the … Read more

Angular2, testing and resolved data: How to test ngOnInit?

What is the behavior or the ngOnInit method? All it does is assign the value of the org when the route data is resolved. So that’s all you really need to test. let routeStub; beforeEach(() => { routeStub = { data: null } TestBed.configureTestingModule({ providers: [ { provide: ActivatedRoute, useValue: routeStub } ] }) }) … Read more

What testing does Selenium cover over and above Karma?

There is a huge difference between Karma and Selenium. Selenium has a built-in browser control mechanism, while Karma does not. So Selenium is more suited to end to end testing, for example with nightwatch.js. Karma is designed for unit tests, so it is much harder to achieve end to end tests on it, you can … Read more

Nullinjectorerror: no provider for FormBuilder (I’m importing ReactiveFormsModule)

Open app.component.spec.ts and add ReactiveFormsModule to imports array. app.component.spec.ts describe(‘AppComponent’, () => { beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ ReactiveFormsModule <================================= add this ], declarations: [ AppComponent, HoursCalculatorComponent ], }).compileComponents(); }));

Difference between Karma and Mocha

Imagine the following scenario: Write your own test suites with Mocha Use Karma to run programmatically your Mocha tests cross-browser and cross-devices More, integrate Karma with your Jasmine existing environment Even more, integrate Karma in your Continuous Integration cycle Use a million Karma plugin to check coverage, complexity, framework stuff, etc… The power of Karma … Read more

Updating the version of Jasmine used in karma-jasmine

You can know the jasmine version you are using by running the following Spec: describe(‘Test to print out jasmine version’, function() { it(‘prints jasmine version’, function() { console.log(‘jasmine-version:’); console.log(jasmine.version || (jasmine.getEnv().versionString && jasmine.getEnv().versionString())); }); }); and then checking the karma output in your console or browser. It should be something like: LOG: ‘jasmine-version:’ LOG: ‘2.3.4’ … Read more

Mocking $httpBackend – how to handle “Unexpected request, No more request expected”?

Your test fails because a request is made which you haven’t specified. Try to add: $httpBackend.when(‘GET’, ‘views/core/main/main.html’).respond(fakedMainResponse); Of course you should also define fakedMainResponse. Please take a look also at the documentation (section Request Expectations vs Backend Definitions) which says: Request expectations provide a way to make assertions about requests made by the application and … Read more

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