title: Not modifying a loaded node module
body: <p>In my Node app, have a config file like this:</p>
  
  <pre><code>module.exports = {
      BUILD_DIR: '/some.path',
      OTHER_CONFIG: 42,
      // ...
  };
  </code></pre>
  
  <p>I also have some tests doing things like</p>
  
  <pre><code>var appConfig = require('./path/to/appConfig');
  appConfig.BUILD_DIR = 'tmp/some/path';
  // and stuff done with appConfig
  </code></pre>
  
  <p>To my big surprise doing this apparently modifies the state of the module. My next test that requires it will have <code>BUILD_DIR</code> set to 'tmp/some/path'. I did not realize modules had this kind of state across requires. How do I get rid of this effect in my test? Also, how can I prevent people from modifying the state of this module? If someone includes it, they should always get what it defines, and not possibly something some other code wrote to it.</p>