Javascript - Karma (Test runner)

About

Karma is a javascript test runner that permit to execute test code in multiple real browsers via phantomJs.

Karma is not a testing framework, nor an assertion library. Karma just launches an HTTP server, and generates the test reports on how successful the tests were.

Karma is essentially a tool which spawns a web server that executes source code against test code for each of the browsers connected with another test runner framework.

Testing framework

There are already plugins for most of the common testing frameworks:

Installation

  • Installation
npm install # if Karma and all the required plugins are already defined in package.json
npm install --save-dev karma
npm install --save-dev <required_karma_plugin> <another_required_karma_plugin>
  • Configuration
#For macOS and Linux:
./node_modules/karma/bin/karma init
#For Windows:
npm install -g karma-cli
karma init

Conf

Tests are run according to a karma.conf.js configuration file which is generated in the interactive mode.

Documentation / Reference





Discover More
Javascript - Qunit Test Framework

Qunit is a unit test framework for Javascript. Qunit consists of: qunit.js, the test runner and testing framework, qunit.css, which styles the test suite page to display test results the mandatory...
Javascript Test - Runner

in Javascript. See also: Winner: Jest because: it's fully integrated in my IDE it supports React out of the box it can also test Typescript it forces you to not start a browser to test...



Share this page:
Follow us:
Task Runner