title: Prevent proxyquire to call original code?
body: <p>I am trying to test around a mongoose model. </p>
  
  <p>I use proxyquire to mock it integrally, but since the original file register the model, I get </p>
  
  <pre><code>OverwriteModelError: Cannot overwrite `EEG` model once compiled.
  </code></pre>
  
  <p>Since everything I need is already injected by proxyquire, how can I tell it to not load the model?</p>
  
  <p>Code to test:</p>
  
  <pre><code>var mongoose = require('mongoose');
  
  var db = {},
      Test = require('./model/Test.js'),
      config = require('./config.json');
  
  var dbURL = config.medical.url,
      dbName = config.medical.name;
  
  function connect(callback) {
      db = mongoose.createConnection(dbURL + dbName);
      db.on('error', (err) =&gt; {
          callback(err);
      });
      db.once('open', function () {
          callback();
      }); 
  }
  
  function save(data, callback) {
      new Test({
          data
      }).save((err) =&gt; {
          callback(err);
      });
  }
  
  module.exports = {
      connect: connect,
      save: save
  }
  </code></pre>
  
  <p>model/Test.js:</p>
  
  <pre><code>var mongoose = require('mongoose');
  
  //Should not get called when proxyquired
  module.exports = mongoose.model('Test', mongoose.Schema({
      date: Date,
      data: String
  }));
  </code></pre>
  
  <p>test/test.js:</p>
  
  <pre><code>//...
  describe('save', (done) =&gt; {
      it('Expect to successfully save the Test', (done) =&gt; {
          var stub = {
                  Test: function Test() {
                      this.save = (callback) =&gt; {
                          callback();
                      }
                  }
              },
              test = proxyquire('./../test.js', {
                  './model/Test.js': stub.Test
              });
  
          test.save({data: 'data'}, (err) =&gt; {
              try {
                  expect(err).to.not.be.ok;
                  done();
              } catch(err) {
                  done(err);
              }
          });
      });
  
      it('Expect to throw any error raised', (done) =&gt; {
          var stub = {
                  Test: function Test() {
                      this.save = (callback) =&gt; {
                          callback('ERROR');
                      }
                  }
              },
              //This line raise a error because Test is already compiled
              test = proxyquire('./../test.js', {
                  './model/Test.js': stub.Test
              });
  
          test.save({data: 'data'}, (err) =&gt; {
              try {
                  expect(err).to.not.be.ok;
                  done();
              } catch(err) {
                  done(err);
              }
          });
      });
      //...
  </code></pre>
  
  <p>A alternative method I found would be to proxyquire mongoose in Test, and mock it to prevent the registration, but it would be a lot of code, and I have other test where this model get called 4 or 5 layers deep, so proxyquiring every level would be really cumbersome, while I can mock the highers function.</p>