Some more tests

This PR could really use some more eyes, especially for the watch mode test. I'm kind of anxious of all the child_process hackery/tricks as I'm not that proficient in Node.js.

See also #1795.
OK, that sounds a lot better than my current hack. Will try to implement it.