Throw Errors instead of strings. Add 'grunt test' task.

Throw Errors instead of strings. Add 'grunt test' task. Fix a couple of JSLint issues.

(Side note: npm install didn't work for me. I had to first install casperjs and then npm install worked. grunt-casperjs seems to have installation problems).