Quite simple, it's a custsom Java Junit Runner that allows you to embed Javascript Unit tests (using Jasmine) in your Java-based projects. It fully integrates with your most beloved IDE, your most hated version control system and of course your most needed CI env.
So let's rephrase:
* Run Javascript (the <ahref="https://github.com/pivotal/jasmine"target="_blank">Jasmine</a> - behavior driven - way) "specs" in Java
* Talks like a duck-erhm, any other Junit Java test. Just use a custom annotation (see below)
Yes! It allows you to test your jQuery plugins or your spaghetti GUI+Logic code, neatly woven together.
You can use <ahref="https://github.com/velesin/jasmine-jquery"target="_blank">jasmine-jquery</a> matchers. I've modified `jasmine.Fixtures` to support Envjs+Rhino. This means you can test stuff like this:
```javascript
beforeEach(function() {
loadFixtures("myFixture.html");
});
it("should be visible and blue", function() {
var div = $('#myDivInFixtureHtml');
expect(div).toBeVisible();
expect(div.css('color')).toBe('blue');
});
```
Fixtures are automatically cleaned up. See src/test/javascript/lib/jasminedir/jasmine-jquery-rhino.js
#### But wait, CSS Style Parsing does not work in Envjs 1.2, how come this does?
See env.utils.js. Cover your eyes - hacks present.
Yes! When the debug mode flag in `@JasmineSuite` has been set to `true`, you can use the <ahref="http://www.mozilla.org/rhino/debugger.html"target="_blank">Rhino Debugger</a> to set breakpoints.
After pressing "GO", the tests will run and you can inspect stuff and step through the code.
#### What about integrated debugging inside my IDE?
Tough luck. I've tried to get <ahref="http://wiki.eclipse.org/JSDT"target="_blank">JSDT</a> working but no avail.
You can still use Firebug to debug when generating a specRunner HTML file (see below).
* specs: one or more spec file to run. You may also use the [glob syntax described here](https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher%28java.lang.String%29).For example to load all javascript files in subdir use subdir/*.js. Default behavior: use java Class name (replaces Test with Spec, see example).
* sources: one or more JS production file which your spec needs (included before specs, d'uh). You can use the same glob syntax as the specs option.
Currently, Jasmine Junit Runner relies on Rhino 1.7R2 (+ es5-shim) & Envjs 1.2 to interpret JS code. It also uses Jamsine 1.0.2 to read your spec files. All js libs are located in test/javascript/lib .
* You can define n number of _PUBLIC_ methods annotated with `@Before` or `@After`
* You can, but don't have to, take the `RhinoContext` object as the only parameter. This allows you to set stuff up in JS space before running the spec.