Rewrite for yeoman-generator 0.17.x

I'm running it on `end` on purpose, because of the `chdir` problem for which I didn't manage to find a workaround. generator-mocha has to chdir to `test`, which screws up wiredep.