Fix and improve mocha generator

- Make it runnable in PhantomJS
- Extract spec out into a separate file
Upgrade libs