A clean exit

I was running some tests recently using Mocha and I wanted to re-run the tests when files changed. Typically this kind of functionality is built into test runners, but a) I’m not that familiar with Mocha (meh, it’s just a tool) and b) I’ve got nodemon (which I wrote) 🙌.The thing is: when I ran a failing test with nodemon and mocha, the way mocha exits (in this particular case) makes nodemon think that the command totally failed with process failed, unhandled exit code (2). Cleaning the exit is a good trick to know.

Link: http://feedproxy.google.com/~r/remysharp/~3/ZJtJsa1lbYw/a-clean-exit