Fwiw, I've been taking to writing these as something like

```
rm -rf node_modules
npm install .
grunt test
```

Or something so that we run tests on build too.  If you need mongo running, you can check out how I setup the traps on the build script for user-api to make sure that it gets shut down as well.