Home > jazz

jazz

Jazz is a project mainly written in JAVASCRIPT and RUBY, based on the MIT license.

Run javascript tests from various frameworks in various environments

= jazz

  • http://github.com/smparkes/jazz
  • http://groups.google.com/group/jazz-talk
  • jazz-talk at freenode

== Description

Support for running JS tests and specs under env.js and browsers. jazz cooperates with wake and envjs to track dependences for incremental build and test.

== Install

You can install the gem via gem install smparkes-jazz. If you want to install from github (http://github.com/smparkes/jazz), you'll need to checkout the Jasmine submodule (git submodule update --init) and also need to make sure you have the prerequisites listed in the gemspec in the Rakefile. rake gemspec will then build and copy the necessary parts of Jasmine.

If you want to run the examples/tests, you'll need jQuery. The git submodule update --init command will have brought in jQuery, but you'll need to build it: cd vendor/jquery && make.

Even if you install the gem, you may want to get the github files to see and run the examples.

== Use

From the root of a project, i.e., the parent of the spec directory, you can use the jazz command as you would the rspec spec command, e.g.,

 jazz spec/foo_spec.js spec/bar_spec.js

You can also execute HTML specs via jazz:

 jazz spec/foo_spec.html

or even normal pages, that have the proper hooks to run as examples (see below).

HTML files must be valid XML, i.e., XHTML, at this time.

The HTML fixture must load the necessary test files. Any number of fixtures can be passed to the jazz command.

jazz uses env.js to run the tests, feeding it your HTML and JavaScript, plus the necessary JavaScript and controls to make the tests run correctly. You can see the entire envjsrb command by passing jazz the -v flag.

The Jasmine tests are configured to report results in streaming XML (JUnit format, more or less), which jazz turns into the familiar rspec format. The --xml flag causes jazz to display the raw XML output.

To run all the tests in the spec directory repeatedly you can use wake:

rake test

or

wake

See jazz's Wakefile file and the discussion on examples below.

You can also try using autojaz as you would use autospec:

autojaz

You'll need to install the ZenTest gem if you don't have it installed; jazz can be used without ZenTest installed, but autojaz cannot be. Note that autojaz may be deprecated in favor of wake.

Screen shot at http://www.scrnshots.com/users/smparkes/screenshots/206033

== Examples

There are examples in examples/ and spec/examples/. You can run the tests with rake test which will run wake against the Wakefile. (Wake as a runner will probably replace autojaz.) You'll need the wake gem.

Running wake will run all the tests and then watch the file system for changes. When it sees a change, it reruns the test. It knows how to find the HTML fixtures for specs where they exist in the right place, or it just runs the JavaScript spec itself. An example of the former is the pair example/hello_world.html and spec/example/hello_world_spec.js: jazz will reload the HTML if either file is changed. An example of the latter is spec/example/plain_spec.js.

You can also load the individual HTML files in the browser to run the tests there. For example, on a Mac, open example/hello_world.html. (The idea is that for production, the spec helper files are changed to not load the tests: that should be the only change necessary. Or the