Rohan Rohan - 1 month ago 8
Javascript Question

what is the difference between karma and phantomJS

I know that Karma is a test runner for JS Unit Testing frameworks like Jasmine or Mocha. And PhantomJS provides headless browser for running Jasmine or Mocha Tests.

But, what is the difference between Karma and PhantomJS? Are they two competing tools, or do I use PhantomJS on top of Karma to run my unit tests without a browser?

Answer Source

PhantomJS has nothing to do with testing. In the unit testing scope it would become one of the target browsers.

PhantomJS allows you to run unit tests in a browser when a desktop environment doesn't exist.

Karma is a runner that provides the finished reports on how successful the tests where.

Jasmine is the library used to write unit tests.

So to clarify

Jasmine unit tests are run by Karma inside the browser PhantomJS.