geraintluff/tv4 — pull request #40 by Bartvds (2013-06-15 11:38:36+00:00)
Title: Migrated the tests to grunt+mocha

I moved all the test to mocha, as proposed in #39. I accidentally all the tests instead of only a few; your style was so consistent I could use semi-auto search/replace most tests.

Notes:

* The mocha convention is to put tests in /test which is convenient since yours were in /tests (plural) so it allowed to keep the original ones fully functional so you validate things are right and can later just drop the old folder.

* The script concat's all the cases to one long test file. This is because node.js doesn't do globals very well, and otherwise I'd have to prepend cross node/browser compatible boilerplate everywhere. Now you have short and clean test files, but this makes stack traces a tiny bit less useful (but only the test-part of the stack where nothing really happens, not the interesting functional code).

* You'll need to sweep the tests for acceptance, comments and notes: there are a tiny few odd cases.

* For all assertions that weren't just boolean-valid checks I left the original assertions commented-out. You'll want to review and remove those later.

* To run it you'll have to `npm install` to pull dependencies, then `grunt test` to run tests in both node and phantomjs (so you get 2 nearly identical reports).

* Since it's there you later might want to move your code build/concat/minify to grunt as well, there are many plugins to do this and it'd allow your users to rebuild easily.

It was a fun sidestep to do this, and now I know everything tests-out I'll return to the implementing projects :)