Skip to content
Sorry for the crappy name. Test is a CLI tester that uses Packager, Jasmine, and JsTestDriver all in one command.
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
.gitignore
.gitmodules
README.md
jstd.tpl.php
test
test.php

README.md

Test

I know. It's not a fancy name, and it's very ambiguous. Test is inappropriate as well, since we're running Specs. So go figure.

Overview

This is really just a wrapper to js-test-driver and Packager. It's meant to add some sugar for testing and developing with MooTools.

Normally you have to pollute your repository with .conf files and copies of js-test-driver every where. Moreover, the source files have to be included and that becomes too tedious too quickly.

By the time that this goes out to production the goal is a one line execution to find out if your code is passing or failing from any directory.

Status

Currently testing in Windows 7 with msysgit and PHP 5.3+ (although PHP 5.2+ is probably fine).

Getting Started

git clone http://github.com/ibolmo/mootools-test mootools/test
mkdir jstestdriver
wget http://code.google.com/p/js-test-driver/downloads/detail?name=JsTestDriver-1.2.2.jar jstestdriver/
cd mootools/test
git submodule update --init

# optional (I'm assuming ~/bin is in your path)
ln -s lib/packager/packager ~/bin/packager

packager regsiter path/to/your/package.yml

Your package.yml should include your Specs (temporary workaround). For example from my mootools-extras.

name: "ibolmo"

...

sources:
  - "Source/Types/Object.js"
  - "Source/Element/Element.js"
  - "Specs/Types/Object.js"

Your Specs/Types/Object.js should provide the Spec (again a temporary workaround).

/*
---

name: Specs.Object

requires: Object

provides: Specs.Object

...
*/

describe('Object', function(){
    ....

Once the above is done then you can: (following the above example. Replace with your specs)

php test.php -p ibolmo/Specs.Object

You're told that no browser was captured (this is normal). Launch your favorite browser(s) and go to http://localhost:9876/capture.

Run again:

php test.php -p ibolmo/Specs.Object

Your spec should should run now and js-test-driver will report any errors.

DDD Notes (ignore if you're not contributing)

"-" prefix means that it lacks implementation.

Test packages

test -p ibolmo/Specs.Object
test -p Core/Specs.Core Core/Specs.Array

Stop the jstd server

test -s

Reset the server files

test -r

-Run the test in a particular browser

test -p ibolmo/Specs.Object -b path/to/chrome.exe
test -p ibolmo/Specs.Object -b path/to/chrome.exe -b path/to/firefox.exe

-Run a specific spec

test -p ibolmo/Specs.Object -t Object.set
test -p ibolmo/Specs.Object -t Object.set -t Object.get
Something went wrong with that request. Please try again.