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

Angular 2 - Unit test error: TypeError: Cannot read property 'subscribe' of undefined

So, I'm getting the error TypeError: Cannot read property 'subscribe' of undefined for all the test cases in my module. In my component I'm injecting "ActivatedRoute" and "Router" and in my ngOnInit(), I'm getting some data that I'm passing within…
Tomarto
  • 2,755
  • 6
  • 27
  • 37
2
votes
1 answer

Uncaught Error: Module parse failed:You may need an appropriate loader to handle this file type

I caught this error when run karma test. Uncaught Error: Module parse failed:…
W.Wei
  • 245
  • 5
  • 13
2
votes
0 answers

Angular: Setting timeout in Jasmine

I'm running Unit Tests using jasmine 2.5 and karma 1.4. For a few of them I receive timeout errors: Chrome 58.0.3029 (Windows 7 0.0.0) BeratungdetailsComponent should be in Testfall 2 Soring 29 FAILED Error: Timeout - Async callback was not invoked…
Torsten
  • 43
  • 5
2
votes
1 answer

this.strategyService.getAllstrategys(...).subscribe is not a function

I caught this error when i made test for angular test.following are parts of my code. Failed: this.strategyService.getAllstrategys(...).subscribe is not a function TypeError: this.strategyService.getAllstrategys(...).subscribe is not a…
W.Wei
  • 245
  • 5
  • 13
2
votes
1 answer

How to start a browser with specific URL on a remote machine using Karma or other tool?

For e2e tests, I use Testcafe that allows run tests on remote devices. To start tests on remote devices I must enter a generated by Testcafe URL in a remote browser. Can anybody suggest a solution when I can remotely start a browser and tell it to…
2
votes
0 answers

Travis test keep failling saying this Loading "grunt-karma.js" tasks...ERROR TypeError: Cannot read property 'emit' of undefined

Please we are facing a travis test on PR in the community-app. with the following error: https://travis-ci.org/openMF/community-app/builds/230628985?utm_source=github_status&utm_medium=notification please can someone give a hand? we have give some…
tony pro
  • 405
  • 3
  • 12
2
votes
2 answers

error in unit test vue.js karma (webpack): undefined is not a constructor

I'm using the webpack template generated by Vue's CLI and have been trying to add some unit tests. And example has already been provided and it works perfectly: import Vue from 'vue' import Hello from '@/components/Hello' describe('Hello.vue', ()…
kevguy
  • 4,328
  • 1
  • 24
  • 45
2
votes
0 answers

How do I run Jasmine tests for Angular 2 in Visual Studio Code?

I know that you can do a "karma start" from the command line and run all tests. How do you run all tests from Visual Studio Code? What if you are creating a test and need to debug the test in Visual Studio Code. How would you do that?
Greg Finzer
  • 6,714
  • 21
  • 80
  • 125
2
votes
0 answers

Karma Runner Unable To Identify Moment Timezone In AngularJS App

I had moment.js included previously on my Karma.conf.js which works fine. Recently, I have included moment-timezone.js library using bower and added dependency files in karma.conf.js. After this steps all of the specs are failing, due to undefined…
Satyaki
  • 751
  • 2
  • 10
  • 25
2
votes
1 answer

Phantom JS weakmap Error

im using webpack, angular 2, karma 0.13, jasmine 2.4.1 i have no reference to weakmap in my application. could not resolve with latest version of phantomjs ***> START: ts-loader: Using typescript@2.2.2 and C:\\tsconfig.json 26 04 2017…
Fun Living
  • 97
  • 1
  • 3
  • 11
2
votes
0 answers

JHipster and Karma: Error when i launch npm run test:watch

I try to create my unit tests in my project with Jhipster 4.3 with Angular2. But when i launch: npm run test:watch I have an error when i open http://localhost:9876/# and i can't debug my test: Chrome 57.0.2987 (Windows 10 0.0.0) ERROR You need to…
Echo
  • 91
  • 5
2
votes
0 answers

How to set up rollup with karma and babel?

I try to set up rollup with karma and babel for test. I face two problems. First, it cause error Uncaught TypeError about default. Uncaught TypeError: Cannot use 'in' operator to search for 'default' in undefined Second, it doesn't find external…
egaoneko
  • 389
  • 1
  • 5
  • 24
2
votes
3 answers

How to set CHROME_BIN in jenkins when deploying to production for angular test coverage

I have a maven project that I deployed to a jenkins server, and I would like to run code coverage report there for my AngularJS code. I have jenkins installed a service on my local machine, and have my tests running there when I build my…
mupierrix
  • 85
  • 2
  • 2
  • 12
2
votes
0 answers

VueJS event callback spy doesn't work

I have a VueJS component text-editor that I call as such in my tests: import Vue from 'vue'; import TextEditor from '../src/TextEditor.vue'; import expect, {spyOn} from 'expect'; describe("", (done) => { beforeEach(() => { …
2
votes
0 answers

Angular 2+ Karma doesn't load main style-sheet referenced in .angular-cli.json file

Karma doesn't load stylesheet referenced in angular-cli.json file
Prashan Fernando
  • 281
  • 4
  • 11
1 2 3
99
100