O'Reilly logo

PhantomJS Cookbook by Rob Friesel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running Jasmine unit tests with PhantomJS

This recipe will illustrate a basic Jasmine-based test suite and how to execute its test runner under PhantomJS while extracting useful test feedback.

Getting ready

To run this recipe, we will need JavaScript code to test, and the tests for that code. To test our code, we will use the Jasmine test framework.

Note

Jasmine is a JavaScript framework used for writing tests in a behavior-driven development (BDD) style. We will use it here because it is widely used, and the tests are generally easy to read. Jasmine is open source (MIT licensed) and we can find its documentation at http://jasmine.github.io/.

We will be using Jasmine version 1.3.1; we can download this version at https://github.com/pivotal/jasmine/tree/v1.3.1 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required