title: How do I mock my config file for testing?
body: <p>I have a Koa app I just started and I need to test something that grabs data from a config file.</p>
  
  <p>I need to test with specific data, but I'm not sure how to modify what data the test receives from the config file.</p>
  
  <p>Example:</p>
  
  <p>app.js</p>
  
  <pre><code>var router = require('koa-router');
  var config = require('./config.js');
  var db     = require('./db.js');
  var auth   = require('./auth');
  var app    = require('koa')();
  
  router.get('/', function *() {
    if(auth(this.req, config.credentials.secret)) { // Authenticates request based on a hash created using a shared secret
      this.body = "Request has been authenticated";
    }
  });
  
  app.use(router.routes());
  app = module.exports = http.createServer(app.callback());
  
  app.listen(3000);
  </code></pre>
  
  <p>appSpec.js</p>
  
  <pre><code>var request = require('supertest');
  var app = require('../app.js');
  
  describe('app', function() {
    it('should authenticate all requests against config shared secret', function() {
      var secret    = 'some_secret';
      var validHash = /* hash created from test secret and query */;
  
      request(app)
        .get('/')
        .query({query: 'some_query'})
        .query({hash: validHash})
        .expect(403, done);
  
    });
  });
  </code></pre>
  
  <p>This spec will fail because the app will use the secret from the config file(empty string) instead of my test secret.</p>