TODO list:
[ ] Move to promise-based fs API. [ ] Move to simpler test framework with nicer API. [ ] Tidy up tests around logging. [ ] Improve logging (output levels, formatting). [ ] Better use of spying in tests so child modules aren't called. [ ] Split stuff into more files.