Fingertips / headless-squirrel

A command-line JavaScript test runner for the Mac

This URL has Read+Write access

name age message
file .gitignore Sat Apr 11 17:35:39 -0700 2009 Added Jeweler task [alloy]
file README.rdoc Wed Apr 15 02:15:17 -0700 2009 Don't use local links [alloy]
file Rakefile Fri Aug 21 09:46:39 -0700 2009 Raise a HeadlessSquirrel::TestCase::JSError whe... [alloy]
file VERSION.yml Fri Aug 21 10:10:25 -0700 2009 Version bump to 0.5.0 [alloy]
directory bin/ Tue Apr 14 02:32:18 -0700 2009 Renamed JSTestSan to Headless Squirrel [alloy]
file headless-squirrel.gemspec Fri Aug 21 10:22:35 -0700 2009 Regenerated gemspec for version 0.5.0 [alloy]
directory html/ Tue Apr 14 02:52:35 -0700 2009 Added headless-squirrel image [alloy]
directory lib/ Fri Aug 21 10:08:18 -0700 2009 Instead of raising an exception when a JavaScri... [alloy]
file regression_test.rdoc Sat Apr 11 18:57:46 -0700 2009 Added output of current regression run [alloy]
directory test/ Fri Aug 21 10:09:52 -0700 2009 Removed obsolete test [alloy]
README.rdoc

Headless Squirrel

A JavaScript test runner to run tests from the comfort of your terminal.

Why?

Because we want to run tests in a real browser environment, in our case WebKit, but in the same fashion we run out other (Rails) unit tests.

And we want to write the tests in a way that we can easily run them on other browsers as well, you know, html and js… This way we can run the tests from the terminal during regular development but still test on other browsers by loading the html/js files manually.

Read more at superalloy.nl/2009/04/13/js-test-san.html

Install & Usage

  $ sudo gem install Fingertips-headless-squirrel -s http://gems.github.com
  $ jstest path/to/a/unit_test.html

To automatically run your test see github.com/alloy/kicker/tree/master.

Problems?

You betcha! (See the example.)

But these shouldn’t likely be a typical use case, I hope. So it actually works quite well seeing how many tests pass ;) The one that does fail has to do with the fact that there’s no window at all. I haven’t yet tried if it will simply work with a NSWindow. Also not sure yet why the end result says 2 failures…

Example:

This is the output of the regression tests which are the Prototype unit tests:

  $ ./bin/jstest test/regression/prototype/unit/*_test.html
  ...................................................................................................................................
  .......F...........................................................................................................................
  ..............................................................................................

    1) Failed:
  testViewportDimensions (Unit test file | Dom | default template | 2009-04-11 15:28) [test/regression/prototype/unit/dom_test.html]:
  Failure: NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THIS TEST TO PASS
  expected: <50>, actual: <0>
  Failure: NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THIS TEST TO PASS
  expected: <50>, actual: <0>

  Finished in 17.725139 seconds.

  356 tests, 2246 assertions, 2 failures, 0 errors

See regression_test.rdoc for more tests.