Backup and restore the entire require cache
Add tests for fix for #1 (thanks @nathasm!)