Questions tagged [karma-runner]

Karma provides developers a testing environment where they don't have to set up many things, rather just write code and get instant feedback in order to improve productivity and creativity.

Basic functionality

For all browsers connected to Karma's web server, source code is executed directly against test code. Developers receive the results of the tests on the command line with the ability to see which tests passed or failed for each browser.

Notice that Karma is only a test-runner, meaning it does not do testing itself. It runs tests implemented in some other test framework (e.g. Jasmine, QUnit, or Mocha).

Features

  • It can launch and run the test through real browsers.
  • It monitors file update on disk, and can instantly re-run required test giving very quick feedback on changes.
4608 questions
2
votes
0 answers

VueJS + jQuery testing with PhantomJS: on demand content after .click() is not loaded

I have a Vue component, in which I use Semantic UI's Embed component. This has a placeholder image, and when the icon in the middle of it is clicked, the video content is loaded. It uses jQuery to attach the iframe of the video to the DOM. I would…
mdhtr
  • 75
  • 1
  • 9
2
votes
1 answer

Angular + Jasmine: Testing the Output of a child component using spyOn

I'm implementing a test suite (Karma+Jasmine) into our Angular App, but I'm having problems with this specific case. Let's say I need to test a component called MessageComponent which emits an event hitting a button. How can I make sure the event is…
2
votes
0 answers

Why is Karma starting my complete React App when unit testing a single utils function?

I am trying to use Karma to test my React JS app. However, it get all kind of errors because it is trying to load/start the complete app. My first error was Invariant Violation: _registerComponent(…): Target container is not a DOM element …
edbras
  • 4,145
  • 9
  • 41
  • 78
2
votes
2 answers

Angular 2 Testing with Karma/Jasmine : Enable view of spec.ts files in Chrome

Does anyone if there is a more detailed blog post or video review dissecting the makeup of the configuration of the project that gets talked about in the The first karma test (1st-specs.testing.zip)? I say this because if you setup an Angular…
JGFMK
  • 8,425
  • 4
  • 58
  • 92
2
votes
0 answers

How to import an external module with rollup and karma

I'm trying to use this library to generate some console output from my application. I'm running my tests using karma with jasmine framework and preprocessing my source and test files with buble compiler and rollup bundler. I have tested that the…
2
votes
0 answers

Unit testing Angular2 component template with sortby pipe

I have a component that contains an ngFor loop in it's template. I'm using an order by pipe called 'ngx-order-pipe' in order to be able to sort my objects by a property called 'orderNum'. The sorting works perfectly when I run it but I'm having…
2
votes
1 answer

How to use stomp with angular 1.5/es6 and webpack

I am struggling to include stomp in my project. With both versions jmesnil/stomp-websocket or the subspequent forkJSteunou/webstomp-client. I tried to import properly: import Stomp from 'stompjs';//or 'webstomp-client'; import SockJS from…
Olivvv
  • 1,140
  • 1
  • 13
  • 37
2
votes
1 answer

Expected spy log to have been called

I have created a simple JS function which i want to test but when i run it is showing error Expected spy log to have been called what am i doing wrong ? Function function helloWorld() { console.log('hey'); } Test spec describe('Hello world',…
Sumit Khanduri
  • 3,619
  • 7
  • 30
  • 40
2
votes
1 answer

Test module can't resolve module being tested [Angular4, Karma, Jasmine]

I have a small TypeScript app created as a demo project. It is using Angular 4, Karma, Webpack 2 and Jasmine. The app builds successfully and I can run it in a browser. The tests do not work, when I run karma start in the command line, I see a…
danwellman
  • 9,068
  • 8
  • 60
  • 88
2
votes
1 answer

How to test an angular service function nested promises?

Heres what my service kind of looks like TestService.initializeDefaults = function() { var qPromise = $q.defer(); $q.all({localResource : localResource.fetch(), item :…
dan
  • 21
  • 1
2
votes
0 answers

Karma tests fail with Browser DISCONNECTED error, exit code: 1

We have a total of 2016 unit test cases written with Jasmine and are using Karma to run them. The tests run for a period of 1 min 30 sec to 2 min and then suddenly Karma disconnects from the browser.Here is a screenshot of the console logs. The…
2
votes
0 answers

caused by: undefined is not a constructor in angular 2 karma test

I have seen the same questions but wasn't helpful for me I am new to angular 2 karma testing. I was trying to test a simple component which has a title , an input box and a button. I learned the basics of karma test from angular.io and was trying to…
babootan
  • 21
  • 3
2
votes
0 answers

Karma mocha not recognizing JSX code

I am attempting to add automated testing to a react application using karma and mocha. The application is written using ES6 and JSX so I am also using webpack. I have imported the webpack config into the karma configuration settings, but I am still…
zak
  • 21
  • 2
2
votes
0 answers

Using Karma in Angular4-cli project after ng eject

After using the ng eject command for using webpack and his config file, all the test enviroment stopped working. Using npm test deploys a karma instance but no test are executed, this is the output: 26 05 2017 09:20:47.957:WARN [karma]: No captured…
Pablo
  • 534
  • 11
  • 31
1 2 3
99
100