title: Mocha js Calling After() too Soon?
body: <p>New to Mocha unit testing, I have a few Mocha examples that are running fine, but I have been trying for hours to get this one to run and no matter what I do, after() is called way earlier than I feel it should. Here's an example:</p>
  
  <pre><code>var dummyData = require('./dummyData.js')
  
  describe('mochaTest', function() {
  
      after(function(done) {
          dummyData.cleanDb(function(){
              done();
          })
      });
  
      it('should hit the db to get dummy data and send', function(done) {
  
          dummyData.createDummyData(function(data1, data2, Lookup) {
              Lookup.lookup({
                  data1: data1,
                  data2: data2
              }, function(err, result) {
                  done();
              });
          });
      });
  })
  </code></pre>
  
  <p>And then in dummyData.js:</p>
  
  <pre><code>exports.createDummyData = function(cb){
     doSomeStuff(function (err, patient) {
       // Connect to db, get some data to pass.
          var Lookup = require(./Lookup.js);
          cb(data1, data2, Lookup);
  
     })
  }
  
  exports.cleanDb = function(cb) {
     // Clear db connections.
     cb();
  }
  </code></pre>
  
  <p>The problem is that right after the test is run, the after() function gets called and the Lookup function can't hit the db, because the db connection has been cleared. Why is after being called so early, it shouldn't be called until the it statement calls done() right?</p>