Fork me on GitHub

Jasmine Maven Plugin

As one might intuit, the jasmine-maven-plugin is a Maven plugin for the JavaScript testing framework, Jasmine.

If you’re using Maven, you’re probably writing Java (but, hey, you could be using it for any JVM-language). And if you’re anything like me, you’re here to figure out how to treat your client-side code with the same degree of professionalism that you already show server-side code. Maybe that means you want a painless way to test-drive your JavaScript. Maybe you’re trying to figure out how to incorporate JavaScript tests on your continuous integration server without requiring any browser shenanigans.

The good news

  • it helps you practice TDD/BDD as you write JavaScript
  • it can run as part of your build using PhantomJS with no added configuration on your part
  • it has full-on support for the burgeoning CoffeeScript language! Any files with a “.coffee” extension will be compiled just in time for your specs to run
  • it is extremely customizable

Usage

Below is a simple configuration using all the default options. You can find full usage information here.

  <plugin>
    <groupId>com.github.searls</groupId>
    <artifactId>jasmine-maven-plugin</artifactId>
    <version>2.0</version>
    <executions>
      <execution>
        <goals>
          <goal>test</goal>
        </goals>
      </execution>
    </executions>
  </plugin>